test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ora::MappingTree Class Reference

#include <MappingTree.h>

Public Member Functions

const std::string & className () const
 
 MappingTree ()
 Constructor. More...
 
 MappingTree (const std::string &version)
 Constructor. More...
 
 MappingTree (const MappingTree &rhs)
 
MappingTreeoperator= (const MappingTree &rhs)
 
void override (const MappingTree &source)
 replace present data with the provided source More...
 
void printXML (std::ostream &outputStream) const
 
void setDependency (const MappingTree &parentTree)
 
MappingElementsetTopElement (const std::string &className, const std::string &tableName, bool isDependent=false)
 
void setVersion (const std::string &version)
 
std::vector< TableInfotables () const
 
const MappingElementtopElement () const
 
MappingElementtopElement ()
 
const std::string & version () const
 
 ~MappingTree ()
 Destructor. More...
 

Private Attributes

MappingElement m_element
 
std::auto_ptr< TableInfom_parentTable
 
std::string m_version
 

Detailed Description

The structure holding an object/relational mapping.

Definition at line 53 of file MappingTree.h.

Constructor & Destructor Documentation

ora::MappingTree::MappingTree ( )

Constructor.

Public methods:

Definition at line 7 of file MappingTree.cc.

7  :
8  m_version( "" ),
9  m_element(),
10  m_parentTable(){
11 }
std::string m_version
Definition: MappingTree.h:115
std::auto_ptr< TableInfo > m_parentTable
Definition: MappingTree.h:122
MappingElement m_element
Definition: MappingTree.h:120
ora::MappingTree::MappingTree ( const std::string &  version)
explicit

Constructor.

Definition at line 13 of file MappingTree.cc.

13  :
14  m_version( version ),
15  m_element(),
16  m_parentTable(){
17 }
std::string m_version
Definition: MappingTree.h:115
std::auto_ptr< TableInfo > m_parentTable
Definition: MappingTree.h:122
const std::string & version() const
Definition: MappingTree.h:128
MappingElement m_element
Definition: MappingTree.h:120
ora::MappingTree::MappingTree ( const MappingTree rhs)

Definition at line 19 of file MappingTree.cc.

References m_parentTable.

19  :
20  m_version( rhs.m_version ),
21  m_element( rhs.m_element ),
22  m_parentTable(){
23  if( rhs.m_parentTable.get()) m_parentTable.reset( new TableInfo( *rhs.m_parentTable ) );
24 }
std::string m_version
Definition: MappingTree.h:115
std::auto_ptr< TableInfo > m_parentTable
Definition: MappingTree.h:122
MappingElement m_element
Definition: MappingTree.h:120
ora::MappingTree::~MappingTree ( )

Destructor.

Definition at line 26 of file MappingTree.cc.

26  {
27 }

Member Function Documentation

const std::string & ora::MappingTree::className ( ) const
inline
ora::MappingTree & ora::MappingTree::operator= ( const MappingTree rhs)

Definition at line 29 of file MappingTree.cc.

References m_element, m_parentTable, and m_version.

29  {
30  if( this != &rhs ){
31  m_version = rhs.m_version;
32  m_element = rhs.m_element;
33  m_parentTable.reset();
34  if( rhs.m_parentTable.get()) m_parentTable.reset( new TableInfo( *rhs.m_parentTable ) );
35  }
36  return *this;
37 }
std::string m_version
Definition: MappingTree.h:115
std::auto_ptr< TableInfo > m_parentTable
Definition: MappingTree.h:122
MappingElement m_element
Definition: MappingTree.h:120
void ora::MappingTree::override ( const MappingTree source)

replace present data with the provided source

Definition at line 58 of file MappingTree.cc.

References className(), className(), and m_element.

Referenced by ora::MappingGenerator::createNewDependentMapping(), and ora::MappingGenerator::createNewMapping().

59 {
60  if( className() == source.className() ) m_element.override( source.m_element );
61 }
const std::string & className() const
Definition: MappingTree.h:138
void override(const MappingElement &source)
static std::string const source
Definition: EdmProvDump.cc:43
MappingElement m_element
Definition: MappingTree.h:120
void ora::MappingTree::printXML ( std::ostream &  outputStream) const

Definition at line 142 of file MappingTree.cc.

Referenced by ora::DatabaseUtilitySession::dumpMapping().

142  {
143  outputStream << "<?xml version=\'1.0\' encoding=\"UTF-8\"?>" << std::endl;
144  outputStream << "<!DOCTYPE OraDatabase SYSTEM \"InMemory\">" << std::endl;
145  outputStream << " <OraDatabase>" << std::endl;
146  outputStream << " <Mapping version=\""<<m_version<<"\" >"<< std::endl;
147  m_element.printXML( outputStream, " " );
148  outputStream << " </Mapping >"<< std::endl;
149  outputStream << " </OraDatabase>" << std::endl;
150 }
std::string m_version
Definition: MappingTree.h:115
void printXML(std::ostream &outputStream, std::string indentation="") const
MappingElement m_element
Definition: MappingTree.h:120
void ora::MappingTree::setDependency ( const MappingTree parentTree)

Definition at line 52 of file MappingTree.cc.

References ora::MappingElement::columnNames(), m_element, and ora::MappingElement::tableName().

Referenced by ora::MappingGenerator::createNewDependentMapping().

52  {
53  m_parentTable.reset( new TableInfo() );
54  m_parentTable->m_tableName = parentTree.m_element.tableName();
55  m_parentTable->m_idColumns = parentTree.m_element.columnNames();
56 }
std::auto_ptr< TableInfo > m_parentTable
Definition: MappingTree.h:122
ora::MappingElement & ora::MappingTree::setTopElement ( const std::string &  className,
const std::string &  tableName,
bool  isDependent = false 
)

Appends the element to the structure

Parameters
classNameThe class name of the new element
tableNameThe table name of the new element
elementTypeThe type code of the new element

Definition at line 40 of file MappingTree.cc.

References ora::MappingElement::classMappingElementType(), ora::MappingElement::dependencyMappingElementType(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::MappingGenerator::createNewDependentMapping(), ora::MappingGenerator::createNewMapping(), and ora::MappingDatabase::getMappingByVersion().

42  {
44  if( isDependency ) elementType = ora::MappingElement::dependencyMappingElementType();
45  m_element = ora::MappingElement( elementType,
46  className,
47  className,
48  tableName );
49  return m_element;
50 }
const std::string & className() const
Definition: MappingTree.h:138
static std::string dependencyMappingElementType()
Returns the name of the dependent class mapping element type.
static std::string classMappingElementType()
Returns the name of the class mapping element type.
MappingElement m_element
Definition: MappingTree.h:120
void ora::MappingTree::setVersion ( const std::string &  version)
inline

Definition at line 133 of file MappingTree.h.

References BeamSplash_cfg::version.

Referenced by ora::MappingDatabase::getMappingByVersion().

133  {
134  m_version = version;
135 }
std::string m_version
Definition: MappingTree.h:115
const std::string & version() const
Definition: MappingTree.h:128
std::vector< ora::TableInfo > ora::MappingTree::tables ( ) const

Definition at line 123 of file MappingTree.cc.

References run_regression::ret, and ora::scanElement().

Referenced by ora::MappingToSchema::alter(), ora::MappingToSchema::check(), and ora::MappingToSchema::create().

123  {
124  std::vector<std::string> tableHierarchy;
125  std::map<std::string,TableInfo> tableMap;
126  TableInfo mainTable;
127  bool isDependency = false;
128  if( m_parentTable.get() ){
129  isDependency = true;
130  mainTable = *m_parentTable;
131  }
132  scanElement( m_element, mainTable, isDependency, tableHierarchy, tableMap );
133  std::vector<TableInfo> ret;
134  for( std::vector<std::string>::const_iterator iT = tableHierarchy.begin();
135  iT != tableHierarchy.end(); ++iT ){
136  std::map<std::string,TableInfo>::const_iterator iM = tableMap.find( *iT );
137  ret.push_back( iM->second );
138  }
139  return ret;
140 }
std::auto_ptr< TableInfo > m_parentTable
Definition: MappingTree.h:122
void scanElement(const MappingElement &element, const TableInfo &currentTable, bool isDependency, std::vector< std::string > &tableHierarchy, std::map< std::string, TableInfo > &tableMap)
Definition: MappingTree.cc:64
MappingElement m_element
Definition: MappingTree.h:120
const ora::MappingElement & ora::MappingTree::topElement ( ) const
inline
ora::MappingElement & ora::MappingTree::topElement ( )
inline

Returns the main mapping element

Definition at line 148 of file MappingTree.h.

148  {
149  return m_element;
150 }
MappingElement m_element
Definition: MappingTree.h:120
const std::string & ora::MappingTree::version ( ) const
inline

Returns the version of the mapping

Definition at line 128 of file MappingTree.h.

References m_version.

Referenced by ora::DatabaseUtilitySession::importContainerSchema(), and ora::MappingDatabase::storeMapping().

128  {
129  return m_version;
130 }
std::string m_version
Definition: MappingTree.h:115

Member Data Documentation

MappingElement ora::MappingTree::m_element
private

The main tree

Definition at line 120 of file MappingTree.h.

Referenced by operator=(), override(), and setDependency().

std::auto_ptr<TableInfo> ora::MappingTree::m_parentTable
private

Definition at line 122 of file MappingTree.h.

Referenced by MappingTree(), and operator=().

std::string ora::MappingTree::m_version
private

The mapping version

Definition at line 115 of file MappingTree.h.

Referenced by operator=(), and version().