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::ObjectMapping Class Reference

#include <RelationalMapping.h>

Inheritance diagram for ora::ObjectMapping:
ora::IRelationalMapping

Public Member Functions

 ObjectMapping (const Reflex::Type &attributeType, TableRegister &tableRegister)
 
void process (MappingElement &parentElement, const std::string &attributeName, const std::string &attributeNameForSchema, const std::string &scopeNameForSchema)
 
 ~ObjectMapping ()
 
- Public Member Functions inherited from ora::IRelationalMapping
virtual ~IRelationalMapping ()
 

Private Attributes

TableRegisterm_tableRegister
 
Reflex::Type m_type
 

Detailed Description

Definition at line 157 of file RelationalMapping.h.

Constructor & Destructor Documentation

ora::ObjectMapping::ObjectMapping ( const Reflex::Type &  attributeType,
TableRegister tableRegister 
)

Definition at line 526 of file RelationalMapping.cc.

526  :
527  m_type(attributeType), m_tableRegister( tableRegister ){
528 }
TableRegister & m_tableRegister
ora::ObjectMapping::~ObjectMapping ( )

Definition at line 530 of file RelationalMapping.cc.

530  {
531 }

Member Function Documentation

void ora::ObjectMapping::process ( MappingElement parentElement,
const std::string &  attributeName,
const std::string &  attributeNameForSchema,
const std::string &  scopeNameForSchema 
)
virtual

Implements ora::IRelationalMapping.

Definition at line 585 of file RelationalMapping.cc.

References ora::MappingElement::appendSubElement(), className(), ora::MappingElement::columnNames(), i, ora::isLoosePersistencyOnWriting(), ora::MappingRules::isMappedToBlob(), ora::MappingRules::mappingPropertyNameInDictionary(), ora::RelationalMappingFactory::newProcessor(), ora::MappingElement::objectMappingElementType(), ora::processBaseClasses(), ora::ClassUtils::resolvedType(), ora::MappingElement::setColumnNames(), AlCaHLTBitMon_QueryRunRegistry::string, ora::MappingElement::tableName(), and ora::throwException().

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::dumpPython(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::open(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::outputEventContent(), ConfigBuilder.ConfigBuilder::prepare_FASTSIM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), ConfigBuilder.ConfigBuilder::scheduleSequence(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::setProcess(), and Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::setProperty().

588  {
589  std::string className = m_type.Name(Reflex::SCOPED);
591  ora::MappingElement& me = parentElement.appendSubElement( elementType, attributeName, className, parentElement.tableName() );
592  me.setColumnNames( parentElement.columnNames() );
593 
594  // resolve possible typedef chains
596  // process base class data members
597  processBaseClasses( me, m_type, scopeNameForSchema, m_tableRegister );
598  RelationalMappingFactory mappingFactory( m_tableRegister );
599  std::string scope = attributeName;
600  std::string objectScopeNameForSchema = scopeNameForSchema;
601  if( !objectScopeNameForSchema.empty() ) objectScopeNameForSchema +="_";
602  objectScopeNameForSchema += attributeNameForSchema;
603 
604  // loop over the data members
605  for ( size_t i=0; i< objectType.DataMemberSize(); i++){
606 
607  Reflex::Member objectMember = m_type.DataMemberAt(i);
608  // Skip the transient and the static ones
609  if ( objectMember.IsTransient() || objectMember.IsStatic() || isLoosePersistencyOnWriting( objectMember )) continue;
610 
611  // Retrieve the field type
612  Reflex::Type type = ClassUtils::resolvedType( objectMember.TypeOf() );
613  // Check for the existence of the dictionary information
614  if ( !type ){
615  throwException( "Type for data member \""+objectMember.Name()+"\" of class \""+className+
616  "\" has not been found in the dictionary.",
617  "ObjectMapping::process");
618  }
619 
620  // check if the member is from a class in the inheritance tree
621  Reflex::Type declaringType = ClassUtils::resolvedType( objectMember.DeclaringType());
622  if( declaringType != objectType ){
623  continue;
624  }
625  // Retrieve the field name
626  std::string objectMemberName = objectMember.Name();
627  std::string objectNameForSchema = objectMember.Name();
628 
629  std::string mappingType("");
630  Reflex::PropertyList memberProps = objectMember.Properties();
631  if( memberProps.HasProperty(ora::MappingRules::mappingPropertyNameInDictionary())){
632  mappingType = memberProps.PropertyAsString(ora::MappingRules::mappingPropertyNameInDictionary());
633  }
634  bool blobStreaming = ora::MappingRules::isMappedToBlob( mappingType );
635 
636  std::auto_ptr<IRelationalMapping> processor( mappingFactory.newProcessor( type, blobStreaming ) );
637  processor->process( me, objectMemberName, objectNameForSchema, objectScopeNameForSchema );
638  }
639 
640 }
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
bool isLoosePersistencyOnWriting(const Reflex::Member &dataMember)
MappingElement & appendSubElement(const std::string &elementType, const std::string &variableName, const std::string &variableType, const std::string &tableName)
static std::string mappingPropertyNameInDictionary()
class related parameters
Definition: MappingRules.cc:35
static std::string objectMappingElementType()
Returns the name of the object mapping element type.
static bool isMappedToBlob(const std::string &mappingProperty)
Definition: MappingRules.cc:42
Reflex::Type resolvedType(const Reflex::Type &typ)
Definition: ClassUtils.cc:404
TableRegister & m_tableRegister
void processBaseClasses(MappingElement &mappingElement, const Reflex::Type &objType, const std::string &scopeNameForSchema, TableRegister &tableRegister)
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
std::string className(const T &t)
Definition: ClassName.h:30
void setColumnNames(const std::vector< std::string > &columns)

Member Data Documentation

TableRegister& ora::ObjectMapping::m_tableRegister
private

Definition at line 167 of file RelationalMapping.h.

Reflex::Type ora::ObjectMapping::m_type
private

Definition at line 166 of file RelationalMapping.h.