/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Rdb.h

Go to the documentation of this file.
00001 // $Header: /bes/bes/BossCvs/Calibration/rdbModel/rdbModel/Rdb.h,v 1.1.1.1 2005/10/17 06:10:53 maqm Exp $
00002 #ifndef RDBMODEL_RDB_H
00003 #define RDBMODEL_RDB_H
00004 #include <vector>
00005 #include <string>
00006 // #include "detModel/Sections/Section.h"
00007 
00008 #include "rdbModel/Management/Visitor.h"
00009 
00010 namespace rdbModel {
00011   
00012   class Table;
00013   class Column;
00014   class Index;
00015   //  class Assertion;
00016   class XercesBuilder;
00017   class Connection;
00018   class Row;
00019 
00020     // Values for database fields may be specified in various ways
00021   enum FIELDTYPE {
00022     FIELDTYPElit = 0,  // literal value
00023     FIELDTYPEold,      // col name, refers to (value of) col in existing row
00024     FIELDTYPEtoBe,     // col name, refers to (value of) col in proposed row
00025     FIELDTYPEask,       // supply value at the time of the operation
00026     FIELDTYPElitDef,   // literal but may be overridden
00027     FIELDTYPEoldDef,   // comes from existing row, may be overridden
00028     FIELDTYPEtoBeDef  // comes from proposed row, may be overridden
00029   };
00030 
00041   class Rdb {    
00042   public:
00047     virtual ~Rdb();
00048     Rdb() : m_connection(0) { }
00049 
00050 
00051     unsigned getMajorVersion(){return m_majorVersion;};
00052     unsigned getMinorVersion(){return m_minorVersion;};
00053 
00054     const std::string& getCVSid(){return m_CVSid;};
00055 
00056     const std::string& getDbName(){return m_dbName;};
00057     // Not sure we want to expose this:
00058     // This method gives back a pointer to the tables vector
00059     //    std::vector <Table*>  getTables(){return m_tables;};  
00060 
00061     Table* getTable(const std::string& name) const;
00062     Column* getColumn(const std::string& tableName, 
00063                       const std::string& colName) const;
00064 
00065     Index* getIndex(const std::string& tableName, 
00066                       const std::string& indexName) const;
00067 
00068     unsigned int getNTable() const {return m_tables.size();}
00069 
00070     // Do we want an unset as well?  Or just call this with arg == 0 ?
00071     void setConnection(Connection* connection);
00072 
00078     int insertRow(const std::string& tName, Row& row, int* serial=0) const;
00079 
00086     int insertLatest(Table* t, Row& row, int* serial=0) const;
00087     int insertLatest(const std::string& tName, Row& row, int* serial=0) const;
00088 
00089     int supersedeRow(const std::string& tName, Row& row, int oldKey, 
00090                      int* newKey=0) const;
00091 
00095     int updateRows(const std::string& tName, Row& row, Assertion* where) const;
00096 
00097 
00099     unsigned int  accept(Visitor* v);
00100     // This is the non recursive accept for the visitor pattern
00101     // Not yet sure we need it
00102     //    Visitor::VisitorState acceptNotRec(Visitor* v);
00103 
00104     // This method builds a global volumes map for all the sections 
00105     //    void buildVolumeMap();
00106     // This method builds the global constants maps for all the constants
00107     //void buildConstantsMap();
00108 
00109   private:
00110     // Must make each concrete implementation of Builder a friend since
00111     // derived classes don't inherit friendliness.
00112     friend class rdbModel::XercesBuilder;
00113 
00114     //    void setDTDversion(std::string pdtd){m_DTDversion = pdtd;};
00115     void setCVSid(std::string pcvs){m_CVSid = pcvs;};
00116 
00117     void addTable(Table* t){m_tables.push_back(t);};
00118 
00119     // Maybe have private table map to support look-up by name?
00120     // Or maybe don't bother.  The target application will have
00121     // a very small number of tables, so a linear search is
00122     // perfectly ok.
00123 
00124     std::vector<Table* > m_tables;  
00125   
00127     std::string m_dbName;
00129     unsigned m_majorVersion;
00130     unsigned m_minorVersion;
00131     //    std::string m_DTDversion;
00133     std::string m_CVSid;
00134     Connection* m_connection;
00135 
00136   };
00137 }
00138 
00139 #endif //RDB_H
00140 

Generated on Tue Nov 29 22:57:56 2016 for BOSS_7.0.2 by  doxygen 1.4.7