CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/CondCore/ORA/src/TransactionCache.h

Go to the documentation of this file.
00001 #ifndef INCLUDE_ORA_TRANSACTIONCACHE_H
00002 #define INCLUDE_ORA_TRANSACTIONCACHE_H
00003 
00004 #include "CondCore/ORA/interface/Handle.h"
00005 //
00006 #include <string>
00007 #include <map>
00008 #include <boost/shared_ptr.hpp>
00009 #include <boost/weak_ptr.hpp>
00010 
00011 namespace ora {
00012 
00013   class DatabaseContainer;
00014   class DatabaseUtilitySession;
00015 
00016   class TransactionCache {
00017     public:
00018     TransactionCache();
00019 
00020     virtual ~TransactionCache();
00021 
00022     void clear();
00023 
00024     void setDbExists( bool exists );
00025 
00026     bool dbExistsLoaded();
00027 
00028     bool dbExists();
00029 
00030     void addContainer( int id, const std::string& name, Handle<DatabaseContainer>& contPtr );
00031 
00032     void eraseContainer( int id, const std::string& name );
00033 
00034     Handle<DatabaseContainer> getContainer( int id );
00035     
00036     Handle<DatabaseContainer> getContainer( const std::string& name );
00037 
00038     const std::map<int, Handle<DatabaseContainer> >& containers();
00039 
00040     void dropDatabase();
00041 
00042     std::map<std::string,std::string>& dbParams();
00043 
00044     void setUtility( Handle<DatabaseUtilitySession>& utility );
00045 
00046     Handle<DatabaseUtilitySession> utility();
00047 
00048     bool isLoaded();
00049 
00050     void setLoaded();
00051 
00052     void setNamedReference( const std::string& name, boost::shared_ptr<void>& data );
00053 
00054     boost::shared_ptr<void> getNamedReference( const std::string& name );
00055 
00056     void setDropPermission( bool allowed );
00057     bool dropPermissionLoaded();
00058     bool dropPermission();
00059 
00060     private:
00061     void cleanUpNamedRefCache();
00062 
00063     private:
00064     std::pair<bool,bool> m_dbExists;
00065     std::map<std::string, int> m_containersByName;
00066     std::map<int, Handle<DatabaseContainer> > m_containersById;
00067     std::map<std::string,std::string> m_dbParams;
00068     Handle<DatabaseUtilitySession> m_utility;
00069     bool m_loaded;
00070     std::map<std::string,boost::weak_ptr<void> > m_namedRefCache;
00071     std::pair<bool,bool> m_dropPermission;
00072   };
00073 }
00074 
00075 #endif