CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::PVectorHandler Class Reference

#include <PVectorHandler.h>

Inheritance diagram for ora::PVectorHandler:
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.
void finalize (void *address)
 execute the ending procedure for 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 persistentSize (const void *address)
 Returns the persistent size of the container.
 PVectorHandler (const Reflex::Type &dictionary)
 Constructor.
size_t size (const void *address)
 Returns the size of the container.
size_t startElementIndex (const void *address)
 Returns the index of the first element.
virtual ~PVectorHandler ()
 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.
size_t m_persistentSizeAttributeOffset
Reflex::Type m_type
 The dictionary information.
size_t m_vecAttributeOffset

Detailed Description

Definition at line 53 of file PVectorHandler.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 48 of file PVectorHandler.cc.

References ora::ClassUtils::containerValueType(), m_collProxy, m_iteratorReturnType, m_persistentSizeAttributeOffset, m_type, m_vecAttributeOffset, PFRecoTauDiscriminationAgainstElectronMVA_cfi::method, ora::ClassUtils::resolvedType(), and ora::throwException().

                                                               :
  m_type( dictionary ),
  m_iteratorReturnType(),
  m_isAssociative( false ),
  m_collEnv(),
  m_collProxy(),
  m_persistentSizeAttributeOffset(0),
  m_vecAttributeOffset(0)
{
  Reflex::Member privateVectorAttribute = m_type.DataMemberByName("m_vec");
  if(privateVectorAttribute){
    m_vecAttributeOffset = privateVectorAttribute.Offset();
    Reflex::Member method = privateVectorAttribute.TypeOf().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)+"\"",
                      "PVectorHandler::PVectorHandler");
    }
  }

  Reflex::Member persistentSizeAttribute = m_type.DataMemberByName("m_persistentSize");
  if( persistentSizeAttribute ){
    m_persistentSizeAttributeOffset = persistentSizeAttribute.Offset();
  }

  // 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::PVectorHandler::~PVectorHandler ( ) [virtual]

Destructor.

Definition at line 82 of file PVectorHandler.cc.

                                  {
}

Member Function Documentation

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

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

Implements ora::IArrayHandler.

Definition at line 120 of file PVectorHandler.cc.

References AlCaHLTBitMon_QueryRunRegistry::data.

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

Clear the content of the container.

Implements ora::IArrayHandler.

Definition at line 133 of file PVectorHandler.cc.

                                             {
  m_collEnv.fObject = static_cast<char*>(const_cast<void*>(address))+m_vecAttributeOffset;
  m_collProxy->clear_func(&m_collEnv);
}
void ora::PVectorHandler::finalize ( void *  address) [virtual]

execute the ending procedure for the container

Reimplemented from ora::IArrayHandler.

Definition at line 143 of file PVectorHandler.cc.

References findQualityFiles::size.

                                               {
  size_t transSize = size( address );
  void* persistentSizeAttributeAddress = static_cast<char*>(address)+m_persistentSizeAttributeOffset;
  *static_cast<size_t*>(persistentSizeAttributeAddress) = transSize;
}
bool ora::PVectorHandler::isAssociative ( ) const [inline, virtual]

Returns the associativeness of the container.

Reimplemented from ora::IArrayHandler.

Definition at line 81 of file PVectorHandler.h.

References m_isAssociative.

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

Returns an initialized iterator.

Implements ora::IArrayHandler.

Definition at line 109 of file PVectorHandler.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) + "\"",
                    "PVectorHandler" );
  }
  m_collEnv.fObject = static_cast<char*>(const_cast<void*>(address))+m_vecAttributeOffset;
  return new PVectorIteratorHandler( m_collEnv,*m_collProxy,m_iteratorReturnType,startElementIndex(address) );
}
Reflex::Type & ora::PVectorHandler::iteratorReturnType ( ) [virtual]

Returns the iterator return type.

Implements ora::IArrayHandler.

Definition at line 139 of file PVectorHandler.cc.

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

Returns the persistent size of the container.

Reimplemented from ora::IArrayHandler.

Definition at line 102 of file PVectorHandler.cc.

                                                             {
  void* persistentSizeAddress = static_cast<char*>(const_cast<void*>(address))+m_persistentSizeAttributeOffset;
  size_t persistentSize = *static_cast<size_t*>(persistentSizeAddress);
  return persistentSize;
}
size_t ora::PVectorHandler::size ( const void *  address) [virtual]

Returns the size of the container.

Implements ora::IArrayHandler.

Definition at line 86 of file PVectorHandler.cc.

                                            {
  m_collEnv.fObject = static_cast<char*>(const_cast<void*>(address))+m_vecAttributeOffset;
  size_t transientSize = *(static_cast<size_t*>(m_collProxy->size_func(&m_collEnv)));
  return transientSize;
}
size_t ora::PVectorHandler::startElementIndex ( const void *  address) [virtual]

Returns the index of the first element.

Reimplemented from ora::IArrayHandler.

Definition at line 93 of file PVectorHandler.cc.

                                                         {
  void* persistentSizeAddress = static_cast<char*>(const_cast<void*>(address))+m_persistentSizeAttributeOffset;
  size_t persistentSize = *static_cast<size_t*>(persistentSizeAddress);
  size_t transientSize = *(static_cast<size_t*>(m_collProxy->size_func(&m_collEnv)));
  size_t startElement = 0;
  if(persistentSize < transientSize) startElement = persistentSize;
  return startElement;
}

Member Data Documentation

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

Structure containing parameters of the collection instance.

Definition at line 102 of file PVectorHandler.h.

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

Proxy of the generic collection.

Definition at line 105 of file PVectorHandler.h.

Referenced by PVectorHandler().

Flag indicating whether the container is associative.

Definition at line 99 of file PVectorHandler.h.

Referenced by isAssociative().

The iterator return type.

Definition at line 96 of file PVectorHandler.h.

Referenced by PVectorHandler().

Definition at line 107 of file PVectorHandler.h.

Referenced by PVectorHandler().

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

The dictionary information.

Definition at line 93 of file PVectorHandler.h.

Referenced by PVectorHandler().

Definition at line 109 of file PVectorHandler.h.

Referenced by PVectorHandler().