CMS 3D CMS Logo

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

#include <ObjectStreamer.h>

Inheritance diagram for ora::ObjectStreamerBase:
ora::ObjectReader ora::ObjectUpdater ora::ObjectWriter

Public Member Functions

void buildBaseDataMembers (DataElement &dataElement, IRelationalData &relationalData, const Reflex::Type &objType, RelationalBuffer *operationBuffer)
 
bool buildDataMembers (DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer *operationBuffer)
 
 ObjectStreamerBase (const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema)
 
virtual void processDataMember (DataElement &dataElement, IRelationalData &relationalData, Reflex::Type &dataMemberType, MappingElement &dataMemberMapping, RelationalBuffer *operationBuffer)=0
 
virtual ~ObjectStreamerBase ()
 

Protected Attributes

RelationalStreamerFactory m_streamerFactory
 

Private Attributes

MappingElementm_mapping
 
Reflex::Type m_objectType
 

Detailed Description

Definition at line 15 of file ObjectStreamer.h.

Constructor & Destructor Documentation

ora::ObjectStreamerBase::ObjectStreamerBase ( const Reflex::Type &  objectType,
MappingElement mapping,
ContainerSchema contSchema 
)

Definition at line 24 of file ObjectStreamer.cc.

26  :
27  m_streamerFactory( contSchema ),
28  m_objectType( objectType ),
29  m_mapping( mapping ){
30 }
MappingElement & m_mapping
RelationalStreamerFactory m_streamerFactory
ora::ObjectStreamerBase::~ObjectStreamerBase ( )
virtual

Definition at line 32 of file ObjectStreamer.cc.

32  {
33 }

Member Function Documentation

void ora::ObjectStreamerBase::buildBaseDataMembers ( DataElement dataElement,
IRelationalData relationalData,
const Reflex::Type &  objType,
RelationalBuffer operationBuffer 
)

Definition at line 35 of file ObjectStreamer.cc.

References ora::DataElement::addChild(), CustomConfigs::Base(), newFWLiteAna::base, ora::ClassUtils::checkMappedType(), i, ora::isLoosePersistencyDataMember(), j, ora::ClassUtils::resolvedType(), ora::MappingRules::scopedVariableName(), AlCaHLTBitMon_QueryRunRegistry::string, ora::throwException(), and ora::MappingElement::variableType().

38  {
39 
40  for ( unsigned int i=0;i<objType.BaseSize();i++){
41  Reflex::Base base = objType.BaseAt(i);
42  Reflex::Type baseType = ClassUtils::resolvedType( base.ToType() );
43  buildBaseDataMembers( dataElement, relationalData, baseType, operationBuffer );
44  for ( unsigned int j=0;j<baseType.DataMemberSize();j++){
45  Reflex::Member dataMember = baseType.DataMemberAt(j);
46  DataElement& dataMemberElement = dataElement.addChild( dataMember.Offset(), base.OffsetFP() );
47  // Ignore the transients and the statics (how to deal with non-const statics?)
48  if ( dataMember.IsTransient() || dataMember.IsStatic() ) continue;
49  // Get the member type and resolve possible typedef chains
50  Reflex::Type dataMemberType = ClassUtils::resolvedType( dataMember.TypeOf() );
51  if ( ! dataMemberType ) {
52  throwException( "Missing dictionary information for data member \"" +
53  dataMember.Name() + "\" of class \"" +
54  baseType.Name(Reflex::SCOPED|Reflex::FINAL) + "\"",
55  "ObjectStreamerBase::buildBaseDataMembers" );
56  }
57 
58  // check if the member is from a class in the inheritance tree
59  Reflex::Type declaringType = ClassUtils::resolvedType( dataMember.DeclaringType());
60  std::string scope = declaringType.Name(Reflex::SCOPED|Reflex::FINAL);
61  // Get the data member name
62  std::string dataMemberName = MappingRules::scopedVariableName( dataMember.Name(), scope );
63  // Retrieve the relevant mapping element
64  MappingElement::iterator iDataMemberMapping = m_mapping.find( dataMemberName );
65  if ( iDataMemberMapping != m_mapping.end() ) {
66  MappingElement& dataMemberMapping = iDataMemberMapping->second;
67  if( !ClassUtils::checkMappedType(dataMemberType,dataMemberMapping.variableType()) ){
68  throwException( "Data member \""+dataMemberName +"\" type \"" + dataMemberType.Name(Reflex::SCOPED|Reflex::FINAL) +
69  "\" does not match with the expected type in the mapping \""+dataMemberMapping.variableType()+"\".",
70  "ObjectStreamerBase::buildBaseDataMembers" );
71  }
72  processDataMember( dataMemberElement, relationalData, dataMemberType, dataMemberMapping, operationBuffer );
73  } else {
74  if( !isLoosePersistencyDataMember( dataMember ) ){
75  throwException( "Data member \"" + dataMemberName +
76  "\" not found in the mapping element of variable \""+m_mapping.variableName()+"\".",
77  "ObjectStreamerBase::buildBaseDataMembers" );
78  }
79  }
80  }
81  }
82 
83 }
tuple base
Main Program
Definition: newFWLiteAna.py:92
int i
Definition: DBlmapReader.cc:9
static std::string scopedVariableName(const std::string &variableName, const std::string &scope)
variable name manipulation
const std::string & variableName() const
bool isLoosePersistencyDataMember(const Reflex::Member &dataMember)
MappingElement & m_mapping
bool checkMappedType(const Reflex::Type &type, const std::string &mappedTypeName)
Definition: ClassUtils.cc:54
virtual void processDataMember(DataElement &dataElement, IRelationalData &relationalData, Reflex::Type &dataMemberType, MappingElement &dataMemberMapping, RelationalBuffer *operationBuffer)=0
int j
Definition: DBlmapReader.cc:9
void buildBaseDataMembers(DataElement &dataElement, IRelationalData &relationalData, const Reflex::Type &objType, RelationalBuffer *operationBuffer)
iterator find(const std::string &key)
Retrieves a sub-element.
std::map< std::string, MappingElement >::iterator iterator
Iterator definition.
Reflex::Type resolvedType(const Reflex::Type &typ)
Definition: ClassUtils.cc:404
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
iterator end()
Returns an iterator in the end of the sequence.
bool ora::ObjectStreamerBase::buildDataMembers ( DataElement dataElement,
IRelationalData relationalData,
RelationalBuffer operationBuffer 
)

Definition at line 85 of file ObjectStreamer.cc.

References ora::DataElement::addChild(), ora::ClassUtils::checkMappedType(), i, ora::isLoosePersistencyDataMember(), ora::ClassUtils::resolvedType(), ora::MappingRules::scopedVariableName(), AlCaHLTBitMon_QueryRunRegistry::string, ora::throwException(), and ora::MappingElement::variableType().

87  {
88  buildBaseDataMembers( dataElement, relationalData, m_objectType, operationBuffer );
89  // Loop over the data members of the class.
90  for ( unsigned int i=0;i<m_objectType.DataMemberSize();i++){
91 
92  Reflex::Member dataMember = m_objectType.DataMemberAt(i);
93  DataElement& dataMemberElement = dataElement.addChild( dataMember.Offset(), 0 );
94 
95  Reflex::Type declaringType = ClassUtils::resolvedType( dataMember.DeclaringType());
96  if( declaringType != m_objectType ){
97  continue;
98  }
99 
100  // Ignore the transients and the statics (how to deal with non-const statics?)
101  if ( dataMember.IsTransient() || dataMember.IsStatic() ) continue;
102 
103  // Get the member type and resolve possible typedef chains
104  Reflex::Type dataMemberType = ClassUtils::resolvedType( dataMember.TypeOf() );
105  if ( ! dataMemberType ) {
106  throwException( "Missing dictionary information for data member \"" +
107  dataMember.Name() + "\" of class \"" +
108  m_objectType.Name(Reflex::SCOPED|Reflex::FINAL) + "\"",
109  "ObjectStreamerBase::buildDataMembers" );
110  }
111 
112  // check if the member is from a class in the inheritance tree
113  std::string scope("");
114  // Get the data member name
115  std::string dataMemberName = MappingRules::scopedVariableName( dataMember.Name(), scope );
116 
117  // Retrieve the relevant mapping element
118  MappingElement::iterator idataMemberMapping = m_mapping.find( dataMemberName );
119  if ( idataMemberMapping != m_mapping.end() ) {
120  MappingElement& dataMemberMapping = idataMemberMapping->second;
121  if( !ClassUtils::checkMappedType(dataMemberType,dataMemberMapping.variableType())){
122  throwException( "Data member \""+dataMemberName +"\" type \"" + dataMemberType.Name(Reflex::SCOPED|Reflex::FINAL) +
123  "\" does not match with the expected type in the mapping \""+dataMemberMapping.variableType()+"\".",
124  "ObjectStreamerBase::buildDataMembers" );
125  }
126  processDataMember( dataMemberElement, relationalData, dataMemberType, dataMemberMapping, operationBuffer );
127  } else {
128  if(!isLoosePersistencyDataMember( dataMember ) ){
129  throwException( "Data member \"" + dataMemberName +
130  "\" not found in the mapping element of variable \""+m_mapping.variableName()+"\".",
131  "ObjectStreamerBase::buildDataMembers" );
132  }
133  }
134  }
135  return true;
136 }
int i
Definition: DBlmapReader.cc:9
static std::string scopedVariableName(const std::string &variableName, const std::string &scope)
variable name manipulation
const std::string & variableName() const
bool isLoosePersistencyDataMember(const Reflex::Member &dataMember)
MappingElement & m_mapping
bool checkMappedType(const Reflex::Type &type, const std::string &mappedTypeName)
Definition: ClassUtils.cc:54
virtual void processDataMember(DataElement &dataElement, IRelationalData &relationalData, Reflex::Type &dataMemberType, MappingElement &dataMemberMapping, RelationalBuffer *operationBuffer)=0
void buildBaseDataMembers(DataElement &dataElement, IRelationalData &relationalData, const Reflex::Type &objType, RelationalBuffer *operationBuffer)
iterator find(const std::string &key)
Retrieves a sub-element.
std::map< std::string, MappingElement >::iterator iterator
Iterator definition.
Reflex::Type resolvedType(const Reflex::Type &typ)
Definition: ClassUtils.cc:404
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
iterator end()
Returns an iterator in the end of the sequence.
virtual void ora::ObjectStreamerBase::processDataMember ( DataElement dataElement,
IRelationalData relationalData,
Reflex::Type &  dataMemberType,
MappingElement dataMemberMapping,
RelationalBuffer operationBuffer 
)
pure virtual

Member Data Documentation

MappingElement& ora::ObjectStreamerBase::m_mapping
private

Definition at line 26 of file ObjectStreamer.h.

Reflex::Type ora::ObjectStreamerBase::m_objectType
private

Definition at line 25 of file ObjectStreamer.h.

RelationalStreamerFactory ora::ObjectStreamerBase::m_streamerFactory
protected

Definition at line 23 of file ObjectStreamer.h.