CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CondCore/ORA/src/MappingDatabase.h

Go to the documentation of this file.
00001 #ifndef INCLUDE_ORA_MAPPINGDATABASE_H
00002 #define INCLUDE_ORA_MAPPINGDATABASE_H
00003 
00004 #include "Sequences.h"
00005 //
00006 #include <string>
00007 #include <map>
00008 #include <vector>
00009 #include <set>
00010 
00011 namespace Reflex{
00012   class Type;
00013 }
00014 
00015 namespace ora {
00016 
00017   class IDatabaseSchema;
00018   class MappingTree;
00019   class MappingElement;
00020   class MappingRawData;
00021   class MappingRawElement;
00022 
00027   class MappingDatabase {
00028 
00029     public:
00030 
00031     static std::string versionOfClass( const Reflex::Type& dictionary );
00032     public:
00034     explicit MappingDatabase( IDatabaseSchema& schema );
00035 
00037     ~MappingDatabase();
00038 
00039     std::string newMappingVersionForContainer( const std::string& className );
00040     
00041     std::string newMappingVersionForDependentClass( const std::string& containerName, const std::string& className );
00042 
00043     bool getMappingByVersion( const std::string& version, MappingTree& destination  );
00044     
00045     void removeMapping( const std::string& version );
00046 
00047     bool getMappingForContainer( const Reflex::Type& containerClass, int containerId, MappingTree& destination  );
00048 
00049     bool getBaseMappingForContainer( const std::string& className, int containerId, MappingTree& destination  );
00050 
00051     bool getDependentMappingsForContainer( int containerId, std::vector<MappingElement>& destination  );
00052 
00053     bool getDependentClassesForContainer( int containerId, std::set<std::string>& list );
00054 
00055     bool getClassVersionListForMappingVersion( const std::string& mappingVersion, std::set<std::string>& destination );
00056 
00057     bool getClassVersionListForContainer( int containerId, std::map<std::string,std::string>& versionMap );
00058 
00059     void insertClassVersion( const Reflex::Type& dictionaryEntry, int dependencyIndex, int containerId, const std::string& mappingVersion, bool asBase=false );
00060 
00061     void insertClassVersion( const std::string& className, const std::string& classVersion, int dependencyIndex, int containerId, const std::string& mappingVersion, bool asBase=false );
00062 
00063     void setMappingVersionForClass( const Reflex::Type& dictionaryEntry, int containerId, const std::string& mappingVersion , bool dependency=false);
00064 
00065     void storeMapping( const MappingTree& mappingStructure );
00066     
00067     bool getMappingVersionsForContainer( int containerId, std::set<std::string>& versionList );
00068 
00069     const std::set<std::string>& versions();
00070     
00071     void clear();
00072     
00073     private:
00074     void buildElement( MappingElement& parentElement, const std::string& scopeName,
00075                        std::map<std::string,std::vector<MappingRawElement> >& innerElements );
00076     void unfoldElement( const MappingElement& element, MappingRawData& destination );
00077 
00078     private:
00079       
00081     IDatabaseSchema& m_schema;
00082     NamedSequence m_mappingSequence;
00083     std::set<std::string> m_versions;
00084     bool m_isLoaded;
00085     bool m_writingEnabled;
00086 
00087   };
00088 
00089 }
00090 
00091 #endif