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 Member Functions | Private Attributes
ora::RelationalStreamerFactory Class Reference

#include <RelationalStreamerFactory.h>

Public Member Functions

IRelationalReadernewReader (const edm::TypeWithDict &dataType, MappingElement &dataMapping)
 
IRelationalUpdaternewUpdater (const edm::TypeWithDict &dataType, MappingElement &dataMapping)
 
IRelationalWriternewWriter (const edm::TypeWithDict &dataType, MappingElement &dataMapping)
 
 RelationalStreamerFactory (ContainerSchema &contSchema)
 
 ~RelationalStreamerFactory ()
 

Private Member Functions

IRelationalStreamernewStreamer (const edm::TypeWithDict &dataType, MappingElement &dataMapping)
 

Private Attributes

ContainerSchemam_containerSchema
 

Detailed Description

Definition at line 17 of file RelationalStreamerFactory.h.

Constructor & Destructor Documentation

ora::RelationalStreamerFactory::RelationalStreamerFactory ( ContainerSchema contSchema)

Definition at line 20 of file RelationalStreamerFactory.cc.

20  :
21  m_containerSchema( contSchema ){
22 }
ora::RelationalStreamerFactory::~RelationalStreamerFactory ( )

Definition at line 24 of file RelationalStreamerFactory.cc.

24  {
25 }

Member Function Documentation

ora::IRelationalReader * ora::RelationalStreamerFactory::newReader ( const edm::TypeWithDict dataType,
MappingElement dataMapping 
)

Definition at line 140 of file RelationalStreamerFactory.cc.

Referenced by ora::OraPtrReadBuffer::build(), ora::QVQueryMaker::build(), ora::CArrayReader::build(), ora::DependentClassReader::build(), ora::STLContainerReader::build(), and ora::ReadBuffer::ReadBuffer().

141  {
142  std::auto_ptr<IRelationalStreamer> streamer( newStreamer( type, mapping ) );
143  return streamer->newReader();
144 }
type
Definition: HCALResponse.h:21
IRelationalStreamer * newStreamer(const edm::TypeWithDict &dataType, MappingElement &dataMapping)
ora::IRelationalStreamer * ora::RelationalStreamerFactory::newStreamer ( const edm::TypeWithDict dataType,
MappingElement dataMapping 
)
private

Definition at line 27 of file RelationalStreamerFactory.cc.

References ora::MappingElement::Array, ora::MappingElement::Blob, ora::MappingElement::CArray, ora::MappingElement::elementType(), ora::MappingElement::InlineCArray, edm::TypeWithDict::isArray(), ora::ClassUtils::isTypeContainer(), ora::ClassUtils::isTypeNamedReference(), ora::ClassUtils::isTypeOraPointer(), ora::ClassUtils::isTypeOraReference(), ora::ClassUtils::isTypeOraVector(), ora::ClassUtils::isTypePrimitive(), ora::ClassUtils::isTypePVector(), ora::ClassUtils::isTypeQueryableVector(), ora::ClassUtils::isTypeUniqueReference(), edm::TypeWithDict::name(), ora::MappingElement::NamedReference, ora::MappingElement::Object, ora::MappingElement::OraArray, ora::MappingElement::OraPointer, ora::MappingElement::OraReference, ora::MappingElement::Primitive, ora::throwException(), ora::MappingElement::UniqueReference, ora::MappingElement::variableName(), and ora::MappingElement::variableType().

28  {
29  IRelationalStreamer* newStreamer = 0;
30  if ( mapping.elementType() == MappingElement::Primitive ) { // Primitives
32  throwException( "Mapped variable \"" + mapping.variableName() +
33  "\", declared as Primitive, is associated to non-primitive type \""+type.name()+"\"",
34  "RelationalStreamerFactory::newStreamer" );
35  }
36  newStreamer = new PrimitiveStreamer( type, mapping );
37  } else if ( mapping.elementType() == MappingElement::Blob ){
38  newStreamer = new BlobStreamer( type, mapping, m_containerSchema );
39  } else if ( mapping.elementType() == MappingElement::Object ){
40  newStreamer = new ObjectStreamer( type, mapping, m_containerSchema );
41  } else if ( mapping.elementType() == MappingElement::Array ){
43  throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
44  mapping.variableType() +
45  "\", declared as Array, is associated to the non-container type \""+
46  type.name()+"\".",
47  "RelationalStreamerFactory::newStreamer" );
48  }
49  newStreamer = new STLContainerStreamer( type, mapping, m_containerSchema );
50  } else if ( mapping.elementType() == MappingElement::CArray ) {
51  if ( ! type.isArray() ) {
52  throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
53  mapping.variableType() +
54  "\", declared as C-Array, is associated to the non-array type \""+
55  type.name()+"\".",
56  "RelationalStreamerFactory::newStreamer" );
57  }
58  newStreamer = new CArrayStreamer( type, mapping, m_containerSchema );
59  } else if ( mapping.elementType() == MappingElement::InlineCArray ) {
60  if ( ! type.isArray() ) {
61  throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
62  mapping.variableType() +
63  "\", declared as Inline C-Array, is associated to the non-array type \""+
64  type.name()+"\".",
65  "RelationalStreamerFactory::newStreamer" );
66  }
67  newStreamer = new InlineCArrayStreamer( type, mapping, m_containerSchema );
68  } else if ( mapping.elementType() == MappingElement::OraArray ) {
69  if ( ! ClassUtils::isTypeOraVector( type ) ) {
70  throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
71  mapping.variableType() +
72  "\", declared as OraArray, is associated to the non-array type \""+
73  type.name()+"\".",
74  "RelationalStreamerFactory::newStreamer" );
75  }
77  newStreamer = new PVectorStreamer( type, mapping, m_containerSchema );
79  newStreamer = new QueryableVectorStreamer( type, mapping, m_containerSchema );
80  } else if ( mapping.elementType() == MappingElement::OraPointer ) {
82  throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
83  mapping.variableType() +
84  "\", declared as a OraPointer, is associated to the type \""+
85  type.name()+"\".",
86  "RelationalStreamerFactory::newStreamer" );
87  }
88  newStreamer = new OraPtrStreamer( type, mapping, m_containerSchema );
89  } else if ( mapping.elementType() == MappingElement::OraReference ) {
91  throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
92  mapping.variableType() +
93  "\", declared as a OraReference, is associated to the type \""+
94  type.name()+"\".",
95  "RelationalStreamerFactory::newStreamer" );
96  }
97  newStreamer = new OraReferenceStreamer( type, mapping, m_containerSchema );
98  } else if ( mapping.elementType() == MappingElement::NamedReference ) {
100  throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
101  mapping.variableType() +
102  "\", declared as a NamedReference, is associated to the type \""+
103  type.name()+"\".",
104  "RelationalStreamerFactory::newStreamer" );
105  }
106  newStreamer = new NamedRefStreamer( type, mapping, m_containerSchema );
107  } else if ( mapping.elementType() == MappingElement::UniqueReference ) {
109  throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
110  mapping.variableType() +
111  "\", declared as a UniqueReference, is associated to the type \""+
112  type.name()+"\".",
113  "RelationalStreamerFactory::newStreamer" );
114  }
115  newStreamer = new UniqueRefStreamer( type, mapping, m_containerSchema );
116  } else {
117  throwException( "Cannot find a streamer suitable for mapped variable \"" + mapping.variableName() +" of type "+
118  mapping.variableType() +
119  "\".",
120  "RelationalStreamerFactory::newStreamer" );
121  }
122 
123  return newStreamer;
124 }
type
Definition: HCALResponse.h:21
bool isTypeNamedReference(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:339
bool isTypePrimitive(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:221
bool isTypeOraPointer(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:323
bool isTypePVector(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:355
bool isTypeUniqueReference(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:343
bool isTypeOraVector(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:379
bool isTypeOraReference(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:335
bool isTypeQueryableVector(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:367
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
bool isTypeContainer(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:225
IRelationalStreamer * newStreamer(const edm::TypeWithDict &dataType, MappingElement &dataMapping)
ora::IRelationalUpdater * ora::RelationalStreamerFactory::newUpdater ( const edm::TypeWithDict dataType,
MappingElement dataMapping 
)

Definition at line 134 of file RelationalStreamerFactory.cc.

Referenced by ora::OraPtrUpdater::build(), and ora::UpdateBuffer::flush().

135  {
136  std::auto_ptr<IRelationalStreamer> streamer( newStreamer( type, mapping ) );
137  return streamer->newUpdater();
138 }
type
Definition: HCALResponse.h:21
IRelationalStreamer * newStreamer(const edm::TypeWithDict &dataType, MappingElement &dataMapping)
ora::IRelationalWriter * ora::RelationalStreamerFactory::newWriter ( const edm::TypeWithDict dataType,
MappingElement dataMapping 
)

Definition at line 128 of file RelationalStreamerFactory.cc.

Referenced by ora::DependentClassWriter::build(), ora::CArrayWriter::build(), ora::OraPtrWriter::build(), ora::STLContainerWriter::build(), and ora::WriteBuffer::flush().

129  {
130  std::auto_ptr<IRelationalStreamer> streamer( newStreamer( type, mapping ) );
131  return streamer->newWriter();
132 }
type
Definition: HCALResponse.h:21
IRelationalStreamer * newStreamer(const edm::TypeWithDict &dataType, MappingElement &dataMapping)

Member Data Documentation

ContainerSchema& ora::RelationalStreamerFactory::m_containerSchema
private

Definition at line 36 of file RelationalStreamerFactory.h.