Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:24

0001 #ifndef CondCore_CondDB_GTSchema_h
0002 #define CondCore_CondDB_GTSchema_h
0003 
0004 #include "DbCore.h"
0005 #include "IDbSchema.h"
0006 //
0007 #include <boost/date_time/posix_time/posix_time.hpp>
0008 
0009 namespace cond {
0010 
0011   namespace persistency {
0012 
0013     conddb_table(GLOBAL_TAG) {
0014       conddb_column(NAME, std::string);
0015       conddb_column(VALIDITY, cond::Time_t);
0016       conddb_column(DESCRIPTION, std::string);
0017       conddb_column(RELEASE, std::string);
0018       conddb_column(SNAPSHOT_TIME, boost::posix_time::ptime);
0019       conddb_column(INSERTION_TIME, boost::posix_time::ptime);
0020 
0021       class Table : public IGTTable {
0022       public:
0023         explicit Table(coral::ISchema& schema);
0024         ~Table() override {}
0025         bool exists() override;
0026         void create() override;
0027         bool select(const std::string& name) override;
0028         bool select(const std::string& name, cond::Time_t& validity, boost::posix_time::ptime& snapshotTime) override;
0029         bool select(const std::string& name,
0030                     cond::Time_t& validity,
0031                     std::string& description,
0032                     std::string& release,
0033                     boost::posix_time::ptime& snapshotTime) override;
0034         void insert(const std::string& name,
0035                     cond::Time_t validity,
0036                     const std::string& description,
0037                     const std::string& release,
0038                     const boost::posix_time::ptime& snapshotTime,
0039                     const boost::posix_time::ptime& insertionTime) override;
0040         void update(const std::string& name,
0041                     cond::Time_t validity,
0042                     const std::string& description,
0043                     const std::string& release,
0044                     const boost::posix_time::ptime& snapshotTime,
0045                     const boost::posix_time::ptime& insertionTime) override;
0046 
0047       private:
0048         coral::ISchema& m_schema;
0049       };
0050     }
0051 
0052     conddb_table(GLOBAL_TAG_MAP) {
0053       static constexpr unsigned int PAYLOAD_HASH_SIZE = 40;
0054 
0055       conddb_column(GLOBAL_TAG_NAME, std::string);
0056       // to be changed to RECORD_NAME!
0057       conddb_column(RECORD, std::string);
0058       // to be changed to RECORD_LABEL!
0059       conddb_column(LABEL, std::string);
0060       conddb_column(TAG_NAME, std::string);
0061 
0062       class Table : public IGTMapTable {
0063       public:
0064         explicit Table(coral::ISchema& schema);
0065         ~Table() override {}
0066         bool exists() override;
0067         void create() override;
0068         bool select(const std::string& gtName,
0069                     std::vector<std::tuple<std::string, std::string, std::string> >& tags) override;
0070         bool select(const std::string& gtName,
0071                     const std::string& preFix,
0072                     const std::string& postFix,
0073                     std::vector<std::tuple<std::string, std::string, std::string> >& tags) override;
0074         void insert(const std::string& gtName,
0075                     const std::vector<std::tuple<std::string, std::string, std::string> >& tags) override;
0076 
0077       private:
0078         coral::ISchema& m_schema;
0079       };
0080     }
0081 
0082     class GTSchema : public IGTSchema {
0083     public:
0084       explicit GTSchema(coral::ISchema& schema);
0085       ~GTSchema() override {}
0086       bool exists() override;
0087       void create() override;
0088       GLOBAL_TAG::Table& gtTable() override;
0089       GLOBAL_TAG_MAP::Table& gtMapTable() override;
0090 
0091     private:
0092       GLOBAL_TAG::Table m_gtTable;
0093       GLOBAL_TAG_MAP::Table m_gtMapTable;
0094     };
0095 
0096   }  // namespace persistency
0097 }  // namespace cond
0098 #endif