CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ora::RelationalStreamerFactory Class Reference

#include <RelationalStreamerFactory.h>

List of all members.

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.

                                                                                    :
  m_containerSchema( contSchema ){
}
ora::RelationalStreamerFactory::~RelationalStreamerFactory ( )

Definition at line 24 of file RelationalStreamerFactory.cc.

                                                        {
}

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::DependentClassReader::build(), ora::STLContainerReader::build(), ora::CArrayReader::build(), and ora::ReadBuffer::ReadBuffer().

                                                                                           {
  std::auto_ptr<IRelationalStreamer> streamer( newStreamer( type, mapping ) );
  return streamer->newReader();
}
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().

                                                                                                {
  IRelationalStreamer* newStreamer = 0;
  if ( mapping.elementType() == MappingElement::Primitive ) { // Primitives
    if( ! ClassUtils::isTypePrimitive( type ) ){
      throwException( "Mapped variable \"" + mapping.variableName() +
                      "\", declared as Primitive, is associated to non-primitive type \""+type.Name()+"\"",
                      "RelationalStreamerFactory::newStreamer" );
    }
    newStreamer = new PrimitiveStreamer( type, mapping );
  } else if ( mapping.elementType() == MappingElement::Blob ){
    newStreamer = new BlobStreamer( type, mapping, m_containerSchema );
  } else if ( mapping.elementType() == MappingElement::Object ){
    newStreamer = new ObjectStreamer( type, mapping, m_containerSchema );
  } else if ( mapping.elementType() == MappingElement::Array ){
    if ( !ClassUtils::isTypeContainer( type ) ) {
      throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
                      mapping.variableType() +
                      "\", declared as Array, is associated to the non-container type \""+
                      type.Name()+"\".",
                      "RelationalStreamerFactory::newStreamer" );
    }
    newStreamer = new STLContainerStreamer( type, mapping, m_containerSchema );
  } else if ( mapping.elementType() == MappingElement::CArray ) { 
    if ( ! type.IsArray() ) {
      throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
                      mapping.variableType() +
                      "\", declared as C-Array, is associated to the non-array type \""+
                      type.Name()+"\".",
                      "RelationalStreamerFactory::newStreamer" );
    }
    newStreamer = new CArrayStreamer( type, mapping, m_containerSchema );
  } else if ( mapping.elementType() == MappingElement::InlineCArray ) { 
    if ( ! type.IsArray() ) {
      throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
                      mapping.variableType() +
                      "\", declared as Inline C-Array, is associated to the non-array type \""+
                      type.Name()+"\".",
                      "RelationalStreamerFactory::newStreamer" );
    }
    newStreamer = new InlineCArrayStreamer( type, mapping, m_containerSchema );
  } else if ( mapping.elementType() == MappingElement::OraArray ) {
    if ( ! ClassUtils::isTypeOraVector( type ) ) {
      throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
                      mapping.variableType() +
                      "\", declared as OraArray, is associated to the non-array type \""+
                      type.Name()+"\".",
                      "RelationalStreamerFactory::newStreamer" );
    }
    if( ClassUtils::isTypePVector( type ) )
      newStreamer = new PVectorStreamer( type, mapping, m_containerSchema );
    else if ( ClassUtils::isTypeQueryableVector( type ))
      newStreamer = new QueryableVectorStreamer( type, mapping, m_containerSchema );
  } else if ( mapping.elementType() == MappingElement::OraPointer ) { 
    if ( ! ClassUtils::isTypeOraPointer( type )) {
      throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
                      mapping.variableType() +
                      "\", declared as a OraPointer, is associated to the type \""+
                      type.Name()+"\".",
                      "RelationalStreamerFactory::newStreamer" );
    }
    newStreamer = new OraPtrStreamer( type, mapping, m_containerSchema );
  } else if ( mapping.elementType() == MappingElement::OraReference ) {
    if ( ! ClassUtils::isTypeOraReference( type )) {
      throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
                      mapping.variableType() +
                      "\", declared as a OraReference, is associated to the type \""+
                      type.Name()+"\".",
                      "RelationalStreamerFactory::newStreamer" );
    }
    newStreamer = new OraReferenceStreamer( type, mapping, m_containerSchema );
  } else if ( mapping.elementType() == MappingElement::NamedReference ) {
    if ( ! ClassUtils::isTypeNamedReference( type )) {
      throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
                      mapping.variableType() +
                      "\", declared as a NamedReference, is associated to the type \""+
                      type.Name()+"\".",
                      "RelationalStreamerFactory::newStreamer" );
    }
    newStreamer = new NamedRefStreamer( type, mapping, m_containerSchema );
  } else if ( mapping.elementType() == MappingElement::UniqueReference ) {
    if ( ! ClassUtils::isTypeUniqueReference( type )) {
      throwException( "Mapped variable \"" + mapping.variableName() +" of type "+
                      mapping.variableType() +
                      "\", declared as a UniqueReference, is associated to the type \""+
                      type.Name()+"\".",
                      "RelationalStreamerFactory::newStreamer" );
    }
    newStreamer = new UniqueRefStreamer( type, mapping, m_containerSchema );
  } else {
    throwException( "Cannot find a streamer suitable for mapped variable \"" + mapping.variableName() +" of type "+
                    mapping.variableType() +
                    "\".",
                    "RelationalStreamerFactory::newStreamer" );
  }

  return newStreamer;
}
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::UpdateBuffer().

                                                                                             {
  std::auto_ptr<IRelationalStreamer> streamer( newStreamer( type, mapping ) );
  return streamer->newUpdater();
}
ora::IRelationalWriter * ora::RelationalStreamerFactory::newWriter ( const Reflex::Type &  dataType,
MappingElement dataMapping 
)

Definition at line 128 of file RelationalStreamerFactory.cc.

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

                                                                                           {
  std::auto_ptr<IRelationalStreamer> streamer( newStreamer( type, mapping ) );
  return streamer->newWriter();
}

Member Data Documentation

Definition at line 36 of file RelationalStreamerFactory.h.