#include <MappingTree.h>
Public Member Functions | |
const std::string & | className () const |
MappingTree (const std::string &version) | |
Constructor. | |
MappingTree () | |
Constructor. | |
MappingTree (const MappingTree &rhs) | |
MappingTree & | operator= (const MappingTree &rhs) |
void | override (const MappingTree &source) |
replace present data with the provided source | |
void | printXML (std::ostream &outputStream) const |
void | setDependency (const MappingTree &parentTree) |
MappingElement & | setTopElement (const std::string &className, const std::string &tableName, bool isDependent=false) |
void | setVersion (const std::string &version) |
std::vector< TableInfo > | tables () const |
const MappingElement & | topElement () const |
MappingElement & | topElement () |
const std::string & | version () const |
~MappingTree () | |
Destructor. | |
Private Attributes | |
MappingElement | m_element |
std::auto_ptr< TableInfo > | m_parentTable |
std::string | m_version |
The structure holding an object/relational mapping.
Definition at line 49 of file MappingTree.h.
ora::MappingTree::MappingTree | ( | ) |
Constructor.
Public methods:
Definition at line 7 of file MappingTree.cc.
: m_version( "" ), m_element(), m_parentTable(){ }
ora::MappingTree::MappingTree | ( | const std::string & | version | ) | [explicit] |
Constructor.
Definition at line 13 of file MappingTree.cc.
: m_version( version ), m_element(), m_parentTable(){ }
ora::MappingTree::MappingTree | ( | const MappingTree & | rhs | ) |
Definition at line 19 of file MappingTree.cc.
References m_parentTable.
: m_version( rhs.m_version ), m_element( rhs.m_element ), m_parentTable(){ if( rhs.m_parentTable.get()) m_parentTable.reset( new TableInfo( *rhs.m_parentTable ) ); }
ora::MappingTree::~MappingTree | ( | ) |
const std::string & ora::MappingTree::className | ( | ) | const [inline] |
Returns the main class
Definition at line 134 of file MappingTree.h.
Referenced by ora::MappingGenerator::createNewDependentMapping(), ora::MappingGenerator::createNewMapping(), ora::ContainerSchema::drop(), ora::ContainerSchema::evolve(), ora::MappingDatabase::getBaseMappingForContainer(), ora::MappingDatabase::getMappingForContainer(), ora::DatabaseUtilitySession::importContainerSchema(), and override().
{ return m_element.variableName(); }
ora::MappingTree & ora::MappingTree::operator= | ( | const MappingTree & | rhs | ) |
Definition at line 29 of file MappingTree.cc.
References m_element, m_parentTable, and m_version.
{ if( this != &rhs ){ m_version = rhs.m_version; m_element = rhs.m_element; m_parentTable.reset(); if( rhs.m_parentTable.get()) m_parentTable.reset( new TableInfo( *rhs.m_parentTable ) ); } return *this; }
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().
void ora::MappingTree::printXML | ( | std::ostream & | outputStream | ) | const |
Definition at line 139 of file MappingTree.cc.
Referenced by ora::DatabaseUtilitySession::dumpMapping().
{ outputStream << "<?xml version=\'1.0\' encoding=\"UTF-8\"?>" << std::endl; outputStream << "<!DOCTYPE OraDatabase SYSTEM \"InMemory\">" << std::endl; outputStream << " <OraDatabase>" << std::endl; outputStream << " <Mapping version=\""<<m_version<<"\" >"<< std::endl; m_element.printXML( outputStream, " " ); outputStream << " </Mapping >"<< std::endl; outputStream << " </OraDatabase>" << std::endl; }
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().
{ m_parentTable.reset( new TableInfo() ); m_parentTable->m_tableName = parentTree.m_element.tableName(); m_parentTable->m_idColumns = parentTree.m_element.columnNames(); }
ora::MappingElement & ora::MappingTree::setTopElement | ( | const std::string & | className, |
const std::string & | tableName, | ||
bool | isDependent = false |
||
) |
Appends the element to the structure
className | The class name of the new element |
tableName | The table name of the new element |
elementType | The type code of the new element |
Definition at line 40 of file MappingTree.cc.
References ora::MappingElement::classMappingElementType(), and ora::MappingElement::dependencyMappingElementType().
Referenced by ora::MappingGenerator::createNewDependentMapping(), ora::MappingGenerator::createNewMapping(), and ora::MappingDatabase::getMappingByVersion().
{ std::string elementType = ora::MappingElement::classMappingElementType(); if( isDependency ) elementType = ora::MappingElement::dependencyMappingElementType(); m_element = ora::MappingElement( elementType, className, className, tableName ); return m_element; }
void ora::MappingTree::setVersion | ( | const std::string & | version | ) | [inline] |
Definition at line 129 of file MappingTree.h.
References BeamSplash_cfg::version.
Referenced by ora::MappingDatabase::getMappingByVersion().
std::vector< ora::TableInfo > ora::MappingTree::tables | ( | ) | const |
Definition at line 120 of file MappingTree.cc.
References runTheMatrix::ret, and ora::scanElement().
Referenced by ora::MappingToSchema::alter(), ora::MappingToSchema::check(), and ora::MappingToSchema::create().
{ std::vector<std::string> tableHierarchy; std::map<std::string,TableInfo> tableMap; TableInfo mainTable; bool isDependency = false; if( m_parentTable.get() ){ isDependency = true; mainTable = *m_parentTable; } scanElement( m_element, mainTable, isDependency, tableHierarchy, tableMap ); std::vector<TableInfo> ret; for( std::vector<std::string>::const_iterator iT = tableHierarchy.begin(); iT != tableHierarchy.end(); ++iT ){ std::map<std::string,TableInfo>::const_iterator iM = tableMap.find( *iT ); ret.push_back( iM->second ); } return ret; }
ora::MappingElement & ora::MappingTree::topElement | ( | ) | [inline] |
Returns the main mapping element
Definition at line 144 of file MappingTree.h.
{ return m_element; }
const ora::MappingElement & ora::MappingTree::topElement | ( | ) | const [inline] |
Returns the main mapping element
Definition at line 139 of file MappingTree.h.
Referenced by ora::MappingGenerator::createNewDependentMapping(), ora::DeleteBuffer::DeleteBuffer(), ora::ContainerSchema::drop(), ora::MappingDatabase::getDependentMappingsForContainer(), ora::IteratorBuffer::IteratorBuffer(), ora::ReadBuffer::ReadBuffer(), ora::MappingDatabase::storeMapping(), ora::UpdateBuffer::UpdateBuffer(), and ora::WriteBuffer::WriteBuffer().
{ return m_element; }
const std::string & ora::MappingTree::version | ( | ) | const [inline] |
Returns the version of the mapping
Definition at line 124 of file MappingTree.h.
References m_version.
Referenced by ora::DatabaseUtilitySession::importContainerSchema(), and ora::MappingDatabase::storeMapping().
{ return m_version; }
MappingElement ora::MappingTree::m_element [private] |
The main tree
Definition at line 116 of file MappingTree.h.
Referenced by operator=(), override(), and setDependency().
std::auto_ptr<TableInfo> ora::MappingTree::m_parentTable [private] |
Definition at line 118 of file MappingTree.h.
Referenced by MappingTree(), and operator=().
std::string ora::MappingTree::m_version [private] |
The mapping version
Definition at line 111 of file MappingTree.h.
Referenced by operator=(), and version().