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 Reflex::Type &dataType, MappingElement &dataMapping)
 
IRelationalUpdaternewUpdater (const Reflex::Type &dataType, MappingElement &dataMapping)
 
IRelationalWriternewWriter (const Reflex::Type &dataType, MappingElement &dataMapping)
 
 RelationalStreamerFactory (ContainerSchema &contSchema)
 
 ~RelationalStreamerFactory ()
 

Private Member Functions

IRelationalStreamernewStreamer (const Reflex::Type &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 Reflex::Type &  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:22
IRelationalStreamer * newStreamer(const Reflex::Type &dataType, MappingElement &dataMapping)
ora::IRelationalStreamer * ora::RelationalStreamerFactory::newStreamer ( const Reflex::Type &  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, 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(), 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:22
bool isTypeOraPointer(const Reflex::Type &typ)
Definition: ClassUtils.cc:250
IRelationalStreamer * newStreamer(const Reflex::Type &dataType, MappingElement &dataMapping)
bool isTypePVector(const Reflex::Type &typ)
Definition: ClassUtils.cc:284
bool isTypeOraReference(const Reflex::Type &typ)
Definition: ClassUtils.cc:263
bool isTypeUniqueReference(const Reflex::Type &typ)
Definition: ClassUtils.cc:271
bool isTypeContainer(const Reflex::Type &typ)
Definition: ClassUtils.cc:147
bool isTypePrimitive(const Reflex::Type &typ)
Definition: ClassUtils.cc:143
bool isTypeNamedReference(const Reflex::Type &typ)
Definition: ClassUtils.cc:267
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
bool isTypeOraVector(const Reflex::Type &typ)
Definition: ClassUtils.cc:310
bool isTypeQueryableVector(const Reflex::Type &typ)
Definition: ClassUtils.cc:297
ora::IRelationalUpdater * ora::RelationalStreamerFactory::newUpdater ( const Reflex::Type &  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:22
IRelationalStreamer * newStreamer(const Reflex::Type &dataType, MappingElement &dataMapping)
ora::IRelationalWriter * ora::RelationalStreamerFactory::newWriter ( const Reflex::Type &  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:22
IRelationalStreamer * newStreamer(const Reflex::Type &dataType, MappingElement &dataMapping)

Member Data Documentation

ContainerSchema& ora::RelationalStreamerFactory::m_containerSchema
private

Definition at line 36 of file RelationalStreamerFactory.h.