CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #ifndef INCLUDE_ORA_MAPPINGTREE_H
00002 #define INCLUDE_ORA_MAPPINGTREE_H
00003 
00004 #include "MappingElement.h"
00005 //
00006 #include <set>
00007 
00008 namespace ora {
00009 
00010   struct TableInfo {
00011       TableInfo():
00012         m_dependency( false ),
00013         m_tableName(""),
00014         m_idColumns(),
00015         m_dataColumns(),
00016         m_parentTableName(""),
00017         m_refColumns(){
00018       }
00019       TableInfo( const TableInfo& rhs ):
00020         m_dependency( rhs.m_dependency ),
00021         m_tableName( rhs.m_tableName ),
00022         m_idColumns( rhs.m_idColumns ),
00023         m_dataColumns( rhs.m_dataColumns ),
00024         m_parentTableName(rhs.m_parentTableName),
00025         m_refColumns(rhs.m_refColumns){
00026       }
00027       TableInfo& operator=( const TableInfo& rhs ){
00028         m_dependency = rhs.m_dependency;
00029         m_tableName = rhs.m_tableName;
00030         m_idColumns = rhs.m_idColumns;
00031         m_dataColumns = rhs.m_dataColumns;
00032         m_parentTableName = rhs.m_parentTableName;
00033         m_refColumns = rhs.m_refColumns;
00034         return *this;
00035       }
00036       bool m_dependency;
00037       std::string m_tableName;
00038       std::vector<std::string> m_idColumns;
00039       std::map<std::string,std::string> m_dataColumns;
00040       std::string m_parentTableName;
00041       std::vector<std::string> m_refColumns;
00042   };
00043   
00044 
00049   class MappingTree
00050   {
00051     
00053   public:
00055     MappingTree();
00056 
00058     explicit MappingTree( const std::string& version );
00059 
00060     MappingTree( const MappingTree& rhs );
00061 
00063     ~MappingTree();
00064 
00065     MappingTree& operator=( const MappingTree& rhs );
00066     
00067     void setVersion( const std::string& version);
00068     
00072     const std::string& version() const;
00073 
00080     MappingElement& setTopElement( const std::string& className,
00081                                    const std::string& tableName,
00082                                    bool isDependent = false );
00083 
00084     void setDependency( const MappingTree& parentTree );
00085 
00089     const MappingElement& topElement() const;
00093     MappingElement& topElement();
00094     
00098     const std::string& className() const;
00099 
00101     void override(const MappingTree& source);
00102 
00103     std::vector<TableInfo> tables() const;
00104 
00105     void printXML( std::ostream& outputStream ) const;
00106     
00107   private:
00111     std::string m_version;
00112 
00116     MappingElement m_element;
00117 
00118     std::auto_ptr<TableInfo> m_parentTable;
00119 
00120   };
00121 }
00122 
00123 inline const std::string&
00124 ora::MappingTree::version() const {
00125   return m_version;
00126 }
00127 
00128 inline void
00129 ora::MappingTree::setVersion( const std::string& version ){
00130   m_version = version;
00131 }
00132 
00133 inline const std::string&
00134 ora::MappingTree::className() const {
00135   return m_element.variableName();
00136 }
00137 
00138 inline const ora::MappingElement& 
00139 ora::MappingTree::topElement() const {
00140   return m_element;
00141 }
00142 
00143 inline ora::MappingElement& 
00144 ora::MappingTree::topElement(){
00145   return m_element;
00146 }
00147 
00148 #endif