1 / 5

A suggestion of database I/O interface

A suggestion of database I/O interface. Yuan Ye 2004-3-10. Current interface. void Get_GeoMdcTube(vector<GeoMdcTube>& VecB); void Get_GeoMdcWire(vector<GeoMdcWire> &VecC); void Get_MdcSignalLayer2AllLayer(vector<MdcSignalLayer2AllLayer> &VecD); void Set_GeoMdcWire();

duff
Télécharger la présentation

A suggestion of database I/O interface

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A suggestion of database I/O interface Yuan Ye 2004-3-10

  2. Current interface void Get_GeoMdcTube(vector<GeoMdcTube>& VecB); void Get_GeoMdcWire(vector<GeoMdcWire> &VecC); void Get_MdcSignalLayer2AllLayer(vector<MdcSignalLayer2AllLayer> &VecD); void Set_GeoMdcWire(); void Set_GeoMdcTube(); void Set_BesGeoMdc(); void Set_MdcSignalLayer2AllLayer(); void Open(char *fDatabaseName,char *fHostName,char *fPort,char *fOptions); void Close(PGconn *conn); ~DB2BesGeoMdc(); }; #ifndef __DB2BesGeoMdc_h #define __DB2BesGeoMdc_h #include <vector> #include "BesGeoMdc.h" #include "GeoMdcTube.h" #include "GeoMdcWire.h" #include "MdcSignalLayer2AllLayer.h" using namespace std; #include </usr/include/pgsql/libpq-fe.h> class DB2BesGeoMdc {public: void Get_BesGeoMdc(vector<BesGeoMdc> &VecA);

  3. Stream type I/O interface • Table independent • Manpower economical • Depress error possibility • Common interface, user needn’t to know how database organized

  4. An example BesDBIO.h void Skip(int); void SkipLine(void); private: void Exit_db(PGconn *); private: int rowPointer,columnPointer; PGresult *res; PGconn *conn; }; #endif //BesDBIO_H #ifndef BesDBIO_H #define BesDBIO_H using namespace std; #include </usr/include/pgsql/libpq-fe.h> class BesDBIO { public: BesDBIO(char*); ~BesDBIO(void); BesDBIO& operator>>(int&); BesDBIO& operator>>(float&); BesDBIO& operator>>(double&); BesDBIO& operator>>(char*);

  5. How to use #include "BesDBIO.h " BesDBIO mdcIO("geomdcsegmentinfo"); for(i=0; i<fSegmentNo; i++){ mdcIO>>name>>length>>innerR>>outR>>z; mdcIO.SkipLine(); fMdcSegment[i].SetName(name); fMdcSegment[i].SetLength(length); fMdcSegment[i].SetInnerR(innerR); fMdcSegment[i].SetOutR(outR); fMdcSegment[i].SetZ(z); } Name Length InnerR OutR Z mm mm mm mm Mdc 2582 59 810 0 OutCylinder 2206 790 801.5 0 InnerCylinder 780 63.5 64.5 0 MiddleClip 30 790 810 1118 BelowClip 20 778 810 1143 RightClip 18 796 810 1162 Tail 120 800 810 1231 OutEndPlane1 18 743.6 794 1162 OutEndPlane2 18 728.3 743.6 1159 OutEndPlane3 18 711.5 728.3 1156 OutEndPlane4 18 695 711.5 1153 OutEndPlane5 18 678.8 695 1150 OutEndPlane6 18 662.8 678.8 1147

More Related