CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::STLContainerHandler Class Reference

#include <STLContainerHandler.h>

Inheritance diagram for ora::STLContainerHandler:
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.
bool isAssociative () const
 Returns the associativeness 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.
 STLContainerHandler (const Reflex::Type &dictionary)
 Constructor.
 ~STLContainerHandler ()
 Destructor.

Private Attributes

Reflex::Environ< long > m_collEnv
 Structure containing parameters of the collection instance.
std::auto_ptr
< Reflex::CollFuncTable > 
m_collProxy
 Proxy of the generic collection.
bool m_isAssociative
 Flag indicating whether the container is associative.
Reflex::Type m_iteratorReturnType
 The iterator return type.
Reflex::Type m_type
 The dictionary information.

Detailed Description

Definition at line 48 of file STLContainerHandler.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 41 of file STLContainerHandler.cc.

References ora::ClassUtils::containerValueType(), ora::ClassUtils::isTypeKeyedContainer(), m_collProxy, m_isAssociative, m_iteratorReturnType, m_type, ora::ClassUtils::resolvedType(), and ora::throwException().

                                                                         :
  m_type( dictionary ),
  m_iteratorReturnType(),
  m_isAssociative( false ),
  m_collEnv(),
  m_collProxy(){
  m_isAssociative = ClassUtils::isTypeKeyedContainer( m_type );

  Reflex::Member method = m_type.MemberByName("createCollFuncTable");
  if(method){
    Reflex::CollFuncTable* collProxyPtr;
    method.Invoke( collProxyPtr );
    m_collProxy.reset( collProxyPtr );
  }
  if( !m_collProxy.get() ){
    throwException( "Cannot find \"createCollFuncTable\" function for type \""+m_type.Name(Reflex::SCOPED)+"\"",
                    "STLContainerHandler::STLContainerHandler");
  }

  // find the iterator return type as the member type_value of the containers
  Reflex::Type valueType = ClassUtils::containerValueType( m_type );
  m_iteratorReturnType = ClassUtils::resolvedType( valueType );
  
}
ora::STLContainerHandler::~STLContainerHandler ( )

Destructor.

Definition at line 66 of file STLContainerHandler.cc.

                                            {
}

Member Function Documentation

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

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

Implements ora::IArrayHandler.

Definition at line 89 of file STLContainerHandler.cc.

References AlCaHLTBitMon_QueryRunRegistry::data.

                                                                   {
#if ROOT_VERSION_CODE < ROOT_VERSION(5,28,0)
  m_collEnv.fObject = address;
  m_collEnv.fSize = 1;
  m_collEnv.fStart = data;
  m_collProxy->feed_func(&m_collEnv);
#else
  m_collProxy->feed_func(data,address,1);
#endif
}
void ora::STLContainerHandler::clear ( const void *  address) [virtual]

Clear the content of the container.

Implements ora::IArrayHandler.

Definition at line 101 of file STLContainerHandler.cc.

                                                  {
  m_collEnv.fObject = const_cast<void*>(address);
  m_collProxy->clear_func(&m_collEnv);
}
bool ora::STLContainerHandler::isAssociative ( ) const [inline, virtual]

Returns the associativeness of the container.

Reimplemented from ora::IArrayHandler.

Definition at line 73 of file STLContainerHandler.h.

References m_isAssociative.

{ return m_isAssociative; }
ora::IArrayIteratorHandler * ora::STLContainerHandler::iterate ( const void *  address) [virtual]

Returns an initialized iterator.

Implements ora::IArrayHandler.

Definition at line 77 of file STLContainerHandler.cc.

References ora::throwException().

                                                    {
  if ( ! m_iteratorReturnType ) {
    throwException( "Missing the dictionary information for the value_type member of the container \"" +
                    m_type.Name(Reflex::SCOPED|Reflex::FINAL) + "\"",
                    "STLContainerHandler::iterate" );
  }
  m_collEnv.fObject = const_cast<void*>(address);
  return new STLContainerIteratorHandler( m_collEnv,*m_collProxy,m_iteratorReturnType );
}
Reflex::Type & ora::STLContainerHandler::iteratorReturnType ( ) [virtual]

Returns the iterator return type.

Implements ora::IArrayHandler.

Definition at line 107 of file STLContainerHandler.cc.

                                          {
  return m_iteratorReturnType;
}
size_t ora::STLContainerHandler::size ( const void *  address) [virtual]

Returns the size of the container.

Implements ora::IArrayHandler.

Definition at line 70 of file STLContainerHandler.cc.

                                                 {
  m_collEnv.fObject = const_cast<void*>(address);
  return *(static_cast<size_t*>(m_collProxy->size_func(&m_collEnv)));
}

Member Data Documentation

Reflex::Environ<long> ora::STLContainerHandler::m_collEnv [private]

Structure containing parameters of the collection instance.

Definition at line 86 of file STLContainerHandler.h.

std::auto_ptr<Reflex::CollFuncTable> ora::STLContainerHandler::m_collProxy [private]

Proxy of the generic collection.

Definition at line 89 of file STLContainerHandler.h.

Referenced by STLContainerHandler().

Flag indicating whether the container is associative.

Definition at line 83 of file STLContainerHandler.h.

Referenced by isAssociative(), and STLContainerHandler().

The iterator return type.

Definition at line 80 of file STLContainerHandler.h.

Referenced by STLContainerHandler().

Reflex::Type ora::STLContainerHandler::m_type [private]

The dictionary information.

Definition at line 77 of file STLContainerHandler.h.

Referenced by STLContainerHandler().