CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::SpecialSTLContainerHandler Class Reference

#include <STLContainerHandler.h>

Inheritance diagram for ora::SpecialSTLContainerHandler:
ora::IArrayHandler

List of all members.

Public Member Functions

void appendNewElement (void *address, void *data)
 Appends a new element and returns its address of the object reference.
void clear (const void *address)
 Clear the content of the container.
IArrayIteratorHandleriterate (const void *address)
 Returns an initialized iterator.
Reflex::Type & iteratorReturnType ()
 Returns the iterator return type.
size_t size (const void *address)
 Returns the size of the container.
 SpecialSTLContainerHandler (const Reflex::Type &dictionary)
 Constructor.
 ~SpecialSTLContainerHandler ()
 Destructor.

Private Attributes

std::auto_ptr< IArrayHandlerm_containerHandler
 The handler of the unserlying container.
int m_containerOffset
 The offset of the underlying container.

Detailed Description

Definition at line 94 of file STLContainerHandler.h.


Constructor & Destructor Documentation

ora::SpecialSTLContainerHandler::SpecialSTLContainerHandler ( const Reflex::Type &  dictionary) [explicit]

Constructor.

Definition at line 111 of file STLContainerHandler.cc.

References i, ora::ClassUtils::isTypeContainer(), m_containerHandler, m_containerOffset, and ora::throwException().

                                                                                       :
  m_containerHandler(),
  m_containerOffset( 0 )
{
  // update dictionary to include base classes members
  dictionary.UpdateMembers(); 
  for ( unsigned int i=0;i<dictionary.DataMemberSize();i++){

    Reflex::Member field = dictionary.DataMemberAt(i);    
    Reflex::Type fieldType = field.TypeOf();
    if ( ! fieldType ) {
      throwException( "The dictionary of the underlying container of \"" +
                      dictionary.Name(Reflex::SCOPED|Reflex::FINAL) + "\" is not available",
                      "SpecialSTLContainerHandler" );
    }
    if ( ClassUtils::isTypeContainer(fieldType) ) {
      m_containerHandler.reset( new STLContainerHandler( fieldType ) );
      m_containerOffset = field.Offset();
      break;
    }
  }
  if ( !m_containerHandler.get() ) {
    throwException( "Could not retrieve the underlying container of \"" +
                    dictionary.Name(Reflex::SCOPED|Reflex::FINAL) + "\" is not available",
                    "SpecialSTLContainerHandler" );
  }
}
ora::SpecialSTLContainerHandler::~SpecialSTLContainerHandler ( )

Destructor.

Definition at line 140 of file STLContainerHandler.cc.

{
}

Member Function Documentation

void ora::SpecialSTLContainerHandler::appendNewElement ( void *  address,
void *  data 
) [virtual]

Appends a new element and returns its address of the object reference.

Implements ora::IArrayHandler.

Definition at line 160 of file STLContainerHandler.cc.

{
  m_containerHandler->appendNewElement( static_cast< char* >( address ) + m_containerOffset, data );
}
void ora::SpecialSTLContainerHandler::clear ( const void *  address) [virtual]

Clear the content of the container.

Implements ora::IArrayHandler.

Definition at line 166 of file STLContainerHandler.cc.

{
  m_containerHandler->clear( static_cast< const char* >( address ) + m_containerOffset );
}
ora::IArrayIteratorHandler * ora::SpecialSTLContainerHandler::iterate ( const void *  address) [virtual]

Returns an initialized iterator.

Implements ora::IArrayHandler.

Definition at line 153 of file STLContainerHandler.cc.

{
  return m_containerHandler->iterate( static_cast< const char* >( address ) + m_containerOffset );
}
Reflex::Type & ora::SpecialSTLContainerHandler::iteratorReturnType ( ) [virtual]

Returns the iterator return type.

Implements ora::IArrayHandler.

Definition at line 172 of file STLContainerHandler.cc.

{
  return m_containerHandler->iteratorReturnType();
}
size_t ora::SpecialSTLContainerHandler::size ( const void *  address) [virtual]

Returns the size of the container.

Implements ora::IArrayHandler.

Definition at line 146 of file STLContainerHandler.cc.

{
  return m_containerHandler->size( static_cast< const char* >( address ) + m_containerOffset );
}

Member Data Documentation

The handler of the unserlying container.

Definition at line 120 of file STLContainerHandler.h.

Referenced by SpecialSTLContainerHandler().

The offset of the underlying container.

Definition at line 123 of file STLContainerHandler.h.

Referenced by SpecialSTLContainerHandler().