23 m_streamerFactory( contSchema ),
24 m_objectType( objectType ),
38 if(objType.
name().substr(0,5) ==
"std::") {
42 for (
auto const &
b : bases) {
45 buildBaseDataMembers( dataElement, relationalData, baseType, operationBuffer );
47 for (
auto const & member : members) {
54 if ( ! dataMemberType ) {
55 throwException(
"Missing dictionary information for data member \"" +
56 dataMember.
name() +
"\" of class \"" +
58 "ObjectStreamerBase::buildBaseDataMembers" );
68 if ( iDataMemberMapping != m_mapping.end() ) {
72 "\" does not match with the expected type in the mapping \""+dataMemberMapping.
variableType()+
"\".",
73 "ObjectStreamerBase::buildBaseDataMembers" );
75 processDataMember( dataMemberElement, relationalData, dataMemberType, dataMemberMapping, operationBuffer );
79 "\" not found in the mapping element of variable \""+m_mapping.variableName()+
"\".",
80 "ObjectStreamerBase::buildBaseDataMembers" );
91 buildBaseDataMembers( dataElement, relationalData, m_objectType, operationBuffer );
94 for (
auto const & member : members) {
99 if( declaringType != m_objectType ){
108 if ( ! dataMemberType ) {
109 throwException(
"Missing dictionary information for data member \"" +
110 dataMember.
name() +
"\" of class \"" +
111 m_objectType.cppName() +
"\"",
112 "ObjectStreamerBase::buildDataMembers" );
122 if ( idataMemberMapping != m_mapping.end() ) {
126 "\" does not match with the expected type in the mapping \""+dataMemberMapping.
variableType()+
"\".",
127 "ObjectStreamerBase::buildDataMembers" );
129 processDataMember( dataMemberElement, relationalData, dataMemberType, dataMemberMapping, operationBuffer );
133 "\" not found in the mapping element of variable \""+m_mapping.variableName()+
"\".",
134 "ObjectStreamerBase::buildDataMembers" );
149 for( std::vector< IRelationalWriter* >::iterator iW = m_writers.begin();
150 iW != m_writers.end(); ++iW ){
159 return buildDataMembers( dataElement, relationalData, &operationBuffer );
163 for( std::vector< IRelationalWriter* >::iterator iW = m_writers.begin();
164 iW != m_writers.end(); ++iW ){
165 (*iW)->setRecordId( identity );
172 for( std::vector< IRelationalWriter* >::iterator iW = m_writers.begin();
173 iW != m_writers.end(); ++iW ){
174 (*iW)->write( oid, data );
183 IRelationalWriter* dataMemberWriter = m_streamerFactory.newWriter( dataMemberType, dataMemberMapping );
184 m_writers.push_back( dataMemberWriter );
185 dataMemberWriter->
build( dataMemberElement, relationalData, *operationBuffer );
197 for( std::vector< IRelationalUpdater* >::iterator iU = m_updaters.begin();
198 iU != m_updaters.end(); ++iU ){
207 return buildDataMembers( dataElement, relationalData, &operationBuffer );
211 for( std::vector< IRelationalUpdater* >::iterator iU = m_updaters.begin();
212 iU != m_updaters.end(); ++iU){
213 (*iU)->setRecordId( identity );
220 for( std::vector< IRelationalUpdater* >::iterator iU = m_updaters.begin();
221 iU != m_updaters.end(); ++iU ){
222 (*iU)->update( oid, data );
231 IRelationalUpdater* dataMemberUpdater = m_streamerFactory.newUpdater( dataMemberType, dataMemberMapping );
232 m_updaters.push_back( dataMemberUpdater );
233 dataMemberUpdater->
build( dataMemberElement, relationalData, *operationBuffer );
244 for( std::vector< IRelationalReader* >::iterator iStr = m_readers.begin();
245 iStr != m_readers.end(); ++iStr ){
253 return buildDataMembers( dataElement, relationalData, 0 );
257 for( std::vector< IRelationalReader* >::iterator iDepReader = m_readers.begin();
258 iDepReader != m_readers.end(); ++iDepReader ){
259 (*iDepReader)->select( oid );
264 for( std::vector< IRelationalReader* >::iterator iDepReader = m_readers.begin();
265 iDepReader != m_readers.end(); ++iDepReader ){
266 (*iDepReader)->setRecordId( identity );
272 for( std::vector< IRelationalReader* >::iterator iDepReader = m_readers.begin();
273 iDepReader != m_readers.end(); ++iDepReader ){
274 (*iDepReader)->read( data );
279 for( std::vector< IRelationalReader* >::iterator iDepReader = m_readers.begin();
280 iDepReader != m_readers.end(); ++iDepReader ){
281 (*iDepReader)->clear();
290 IRelationalReader* dataMemberReader = m_streamerFactory.newReader( dataMemberType, dataMemberMapping );
291 m_readers.push_back( dataMemberReader );
292 dataMemberReader->
build( dataMemberElement, relationalData );
299 m_objectType( objectType ),
300 m_mapping( mapping ),
301 m_schema( contSchema ){
308 return new ObjectWriter( m_objectType, m_mapping, m_schema );
312 return new ObjectUpdater( m_objectType, m_mapping, m_schema );
316 return new ObjectReader( m_objectType, m_mapping, m_schema );
ObjectWriter(const edm::TypeWithDict &objectType, MappingElement &mapping, ContainerSchema &contSchema)
void setRecordId(const std::vector< int > &identity)
bool build(DataElement &offset, IRelationalData &relationalData)
edm::TypeWithDict resolvedType(const edm::TypeWithDict &typ)
bool isLoosePersistencyDataMember(const edm::MemberWithDict &dataMember)
static std::string scopedVariableName(const std::string &variableName, const std::string &scope)
variable name manipulation
void update(int oid, const void *data)
Updates a data element.
static std::string persistencyPropertyNameInDictionary()
virtual bool build(DataElement &offset, IRelationalData &relationalData, RelationalBuffer &operationBuffer)=0
IRelationalWriter * newWriter()
void processDataMember(DataElement &dataElement, IRelationalData &relationalData, edm::TypeWithDict &dataMemberType, MappingElement &dataMemberMapping, RelationalBuffer *operationBuffer)
ObjectReader(const edm::TypeWithDict &objectType, MappingElement &mapping, ContainerSchema &contSchema)
IRelationalUpdater * newUpdater()
void setRecordId(const std::vector< int > &identity)
void read(void *destination)
Reads a data element.
TypeWithDict toType() const
ObjectStreamer(const edm::TypeWithDict &objectType, MappingElement &mapping, ContainerSchema &contSchema)
virtual ~ObjectStreamerBase()
TypeWithDict declaringType() const
void setRecordId(const std::vector< int > &identity)
bool build(DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
ObjectUpdater(const edm::TypeWithDict &objectType, MappingElement &mapping, ContainerSchema &contSchema)
std::string cppName() const
ObjectStreamerBase(const edm::TypeWithDict &objectType, MappingElement &mapping, ContainerSchema &contSchema)
virtual bool build(DataElement &offset, IRelationalData &relationalData)=0
bool buildDataMembers(DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer *operationBuffer)
void processDataMember(DataElement &dataElement, IRelationalData &relationalData, edm::TypeWithDict &dataMemberType, MappingElement &dataMemberMapping, RelationalBuffer *operationBuffer)
TypeWithDict typeOf() const
bool checkMappedType(const edm::TypeWithDict &type, const std::string &mappedTypeName)
static bool isLooseOnReading(const std::string &persistencyProperty)
TypeWithDict typeOf() const
std::map< std::string, MappingElement >::iterator iterator
Iterator definition.
DataElement & addChild(size_t declaringScopeOffset, size_toffset)
void processDataMember(DataElement &dataElement, IRelationalData &relationalData, edm::TypeWithDict &dataMemberType, MappingElement &dataMemberMapping, RelationalBuffer *operationBuffer)
static bool isLooseOnWriting(const std::string &persistencyProperty)
void buildBaseDataMembers(DataElement &dataElement, IRelationalData &relationalData, const edm::TypeWithDict &objType, RelationalBuffer *operationBuffer)
const std::string & variableType() const
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
virtual bool build(DataElement &offset, IRelationalData &relationalData, RelationalBuffer &operationBuffer)=0
IRelationalReader * newReader()
bool build(DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
std::string getDataMemberProperty(const std::string &propertyName, const edm::MemberWithDict &dataMember)
void write(int oid, const void *data)
Writes a data element.