test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PVectorStreamer.cc
Go to the documentation of this file.
2 #include "PVectorStreamer.h"
3 #include "ArrayCommonImpl.h"
4 #include "IArrayHandler.h"
5 
7  MappingElement& mapping,
8  ContainerSchema& contSchema ):
9  m_writer( objectType, mapping, contSchema ){
10 }
11 
13 }
14 
17  RelationalBuffer& operationBuffer ){
18  return m_writer.build( offset, data, operationBuffer );
19 }
20 
21 void ora::PVectorWriter::setRecordId( const std::vector<int>& identity ){
22  m_writer.setRecordId( identity );
23 }
24 
26  const void* inputData )
27 {
28  m_writer.write( oid, inputData );
29 }
30 
32  MappingElement& mapping,
33  ContainerSchema& contSchema ):
34  m_buffer(0),
35  m_writer( objectType, mapping, contSchema ){
36 }
37 
39 }
40 
42  IRelationalData& relationalData,
43  RelationalBuffer& operationBuffer){
44  m_buffer = &operationBuffer;
45  return m_writer.build( offset, relationalData, operationBuffer );
46 }
47 
48 void ora::PVectorUpdater::setRecordId( const std::vector<int>& identity ){
49  m_writer.setRecordId( identity );
50 }
51 
53  const void* data ){
54  if(!m_writer.dataElement()){
55  throwException("The streamer has not been built.",
56  "PVectorUpdater::update");
57  }
58 
59  void* arrayData = m_writer.dataElement()->address( data );
60  IArrayHandler& arrayHandler = *m_writer.arrayHandler();
61 
62  size_t arraySize = arrayHandler.size(arrayData);
63  size_t* persistentSize = arrayHandler.persistentSize(arrayData);
64  if(*persistentSize>arraySize){
65  deleteArrayElements( m_writer.mapping(), oid, arraySize, *m_buffer );
66  }
67  else if(*persistentSize<arraySize) {
68  m_writer.write( oid, data );
69  }
70  *persistentSize = arraySize;
71 }
72 
74  MappingElement& mapping,
75  ContainerSchema& contSchema ):
76  m_reader( objectType, mapping, contSchema ){
77 }
78 
80 }
81 
83  IRelationalData& relationalData ){
84  return m_reader.build( offset, relationalData );
85 }
86 
88  m_reader.select( oid );
89 }
90 
91 void ora::PVectorReader::setRecordId( const std::vector<int>& identity ){
92  m_reader.setRecordId( identity );
93 }
94 
95 
96 void ora::PVectorReader::read( void* destinationData ) {
97  m_reader.read( destinationData );
98 }
99 
101  m_reader.clear();
102 }
103 
105  MappingElement& mapping,
106  ContainerSchema& contSchema ):
107  m_objectType( objectType ),
108  m_mapping( mapping ),
109  m_schema( contSchema ){
110 }
111 
113 }
114 
116  return new PVectorWriter( m_objectType, m_mapping, m_schema );
117 }
118 
120  return new PVectorUpdater( m_objectType, m_mapping, m_schema );
121 }
122 
124  return new PVectorReader( m_objectType, m_mapping, m_schema );
125 }
bool build(DataElement &offset, IRelationalData &relationalData)
virtual size_t * persistentSize(const void *address)
Returns the size of the container. Only differs in the PVector.
Definition: IArrayHandler.h:53
void write(int oid, const void *data)
Writes a data element.
void setRecordId(const std::vector< int > &identity)
void update(int oid, const void *data)
Updates a data element.
IRelationalUpdater * newUpdater()
PVectorUpdater(const edm::TypeWithDict &objectType, MappingElement &mapping, ContainerSchema &contSchema)
Constructor.
PVectorReader(const edm::TypeWithDict &objectType, MappingElement &mapping, ContainerSchema &contSchema)
Constructor.
virtual size_t size(const void *address)=0
Returns the size of the container.
void deleteArrayElements(MappingElement &mapping, int oid, int fromIndex, RelationalBuffer &buffer)
PVectorStreamer(const edm::TypeWithDict &objectType, MappingElement &mapping, ContainerSchema &contSchema)
void read(void *address)
Reads a data element.
PVectorWriter(const edm::TypeWithDict &objectType, MappingElement &mapping, ContainerSchema &contSchema)
Constructor.
IRelationalReader * newReader()
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool build(DataElement &offset, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
bool build(DataElement &offset, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
void setRecordId(const std::vector< int > &identity)
IRelationalWriter * newWriter()
void setRecordId(const std::vector< int > &identity)
void select(int oid)
tuple inputData
Definition: idDealer.py:72