00001 #ifndef DBInterface_h
00002 #define DBInterface_h
00003
00004 #ifdef USE_CONDDB
00005
00006
00007 #include "lccd.h"
00008
00009
00010
00011 class ICondDBMgr ;
00012 class ICondDBDataAccess;
00013 class ICondDBFolderMgr;
00014 class ICondDBTagMgr;
00015 class ICondDBObject;
00016
00017
00018
00019 #include "lcio.h"
00020 #include "EVENT/LCCollection.h"
00021
00022
00023 #include <iostream>
00024
00025 namespace lccd {
00026
00028 typedef std::vector< lcio::LCCollection* > ColVec ;
00029
00030
00049 class DBInterface {
00050
00051 public:
00052
00061 DBInterface( const std::string& folder, bool update=false ) ;
00062
00070 DBInterface( const std::string& dbInit, const std::string& folder, bool update=false) ;
00071
00073 virtual ~DBInterface() ;
00074
00077 ICondDBMgr* condDBMgr() { return _condDBmgr ; }
00078
00081 ICondDBDataAccess* condDataAccess() { return _condDataAccess ; }
00082
00085 ICondDBFolderMgr* condFolderMgr() { return _condFolderMgr ; }
00086
00089 ICondDBTagMgr * condTagMgr() { return _condTagMgr ; }
00090
00091
00094 const std::string& folderName() { return _folder ; }
00095
00096
00099 void storeCollection( LCCDTimeStamp since, LCCDTimeStamp till,
00100 lcio::LCCollection* col,
00101 const std::string& description ) ;
00102
00103
00127 lcio::LCCollection* findCollection( LCCDTimeStamp timeStamp,
00128 LCCDTimeStamp& since, LCCDTimeStamp& till,
00129 const std::string& tag="" ) ;
00130
00135 lcio::LCCollection* findCollection( LCCDTimeStamp timeStamp,
00136 const std::string& tag="" ) ;
00137
00143 void findCollections( ColVec& colVec, const std::string& tag="" ) ;
00144
00145
00151 void findCollections( ColVec& colVec, LCCDTimeStamp timeStamp ) ;
00152
00153
00159 void tagFolder( const std::string& tagName, const std::string& description="", std::string usingTagName = "");
00160
00161
00170 void createDBFile( const std::string& tag="" ) ;
00171
00172
00180 void createSimpleFile( LCCDTimeStamp timeStamp, const std::string& tag, bool allLayers=false ) ;
00181
00182
00183 protected:
00185 void init() ;
00186
00190 lcio::LCCollection* collectionFromCondDBObject( ICondDBObject* object, const std::string& tag ) ;
00191
00192
00193
00194 ICondDBMgr* _condDBmgr ;
00195 ICondDBDataAccess* _condDataAccess ;
00196 ICondDBFolderMgr* _condFolderMgr ;
00197 ICondDBTagMgr * _condTagMgr ;
00198
00199
00200 private:
00201
00202 std::string _dbInit ;
00203 std::string _folder ;
00204 bool _update ;
00205 std::string _dbName ;
00206 };
00207
00208 } ;
00209
00210 #endif // USE_CONDDB
00211 #endif // DBInterface_h