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 Attributes
ora::PVectorHandler Class Reference

#include <PVectorHandler.h>

Inheritance diagram for ora::PVectorHandler:
ora::IArrayHandler

Public Member Functions

void appendNewElement (void *address, void *data)
 Appends a new element and returns its address of the object reference. More...
 
void clear (const void *address)
 Clear the content of the container. More...
 
void finalize (void *address)
 execute the ending procedure for the container More...
 
bool isAssociative () const
 Returns the associativeness of the container. More...
 
IArrayIteratorHandleriterate (const void *address)
 Returns an initialized iterator. More...
 
Reflex::Type & iteratorReturnType ()
 Returns the iterator return type. More...
 
size_t * persistentSize (const void *address)
 Returns the persistent size of the container. More...
 
 PVectorHandler (const Reflex::Type &dictionary)
 Constructor. More...
 
size_t size (const void *address)
 Returns the size of the container. More...
 
size_t startElementIndex (const void *address)
 Returns the index of the first element. More...
 
virtual ~PVectorHandler ()
 Destructor. More...
 
- Public Member Functions inherited from ora::IArrayHandler
virtual ~IArrayHandler ()
 Destructor. More...
 

Private Attributes

Reflex::Environ< long > m_collEnv
 Structure containing parameters of the collection instance. More...
 
std::auto_ptr
< Reflex::CollFuncTable > 
m_collProxy
 Proxy of the generic collection. More...
 
bool m_isAssociative
 Flag indicating whether the container is associative. More...
 
Reflex::Type m_iteratorReturnType
 The iterator return type. More...
 
size_t m_persistentSizeAttributeOffset
 
Reflex::Type m_type
 The dictionary information. More...
 
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, PFRecoTauDiscriminationAgainstElectronMVA2_cfi::method, ora::ClassUtils::resolvedType(), and ora::throwException().

48  :
49  m_type( dictionary ),
51  m_isAssociative( false ),
52  m_collEnv(),
53  m_collProxy(),
56 {
57  Reflex::Member privateVectorAttribute = m_type.DataMemberByName("m_vec");
58  if(privateVectorAttribute){
59  m_vecAttributeOffset = privateVectorAttribute.Offset();
60  Reflex::Member method = privateVectorAttribute.TypeOf().MemberByName("createCollFuncTable");
61  if(method){
62  Reflex::CollFuncTable* collProxyPtr;
63  method.Invoke(collProxyPtr);
64  m_collProxy.reset( collProxyPtr );
65  }
66  if(! m_collProxy.get() ){
67  throwException( "Cannot find \"createCollFuncTable\" function for type \""+m_type.Name(Reflex::SCOPED)+"\"",
68  "PVectorHandler::PVectorHandler");
69  }
70  }
71 
72  Reflex::Member persistentSizeAttribute = m_type.DataMemberByName("m_persistentSize");
73  if( persistentSizeAttribute ){
74  m_persistentSizeAttributeOffset = persistentSizeAttribute.Offset();
75  }
76 
77  // find the iterator return type as the member type_value of the containers
80 }
size_t m_persistentSizeAttributeOffset
Reflex::Type m_type
The dictionary information.
bool m_isAssociative
Flag indicating whether the container is associative.
Reflex::Type m_iteratorReturnType
The iterator return type.
Reflex::Type containerValueType(const Reflex::Type &typ)
Definition: ClassUtils.cc:341
Reflex::Type resolvedType(const Reflex::Type &typ)
Definition: ClassUtils.cc:404
Reflex::Environ< long > m_collEnv
Structure containing parameters of the collection instance.
std::auto_ptr< Reflex::CollFuncTable > m_collProxy
Proxy of the generic collection.
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
ora::PVectorHandler::~PVectorHandler ( )
virtual

Destructor.

Definition at line 82 of file PVectorHandler.cc.

82  {
83 }

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 119 of file PVectorHandler.cc.

References data.

119  {
120  void* dest_address = static_cast<char*>(address)+m_vecAttributeOffset;
121 #if ROOT_VERSION_CODE < ROOT_VERSION(5,28,0)
122  m_collEnv.fObject = dest_address;
123  m_collEnv.fSize = 1;
124  m_collEnv.fStart = data;
125  m_collProxy->feed_func(&m_collEnv);
126 #else
127  m_collProxy->feed_func(data,dest_address,1);
128 #endif
129 }
char * address
Definition: mlp_lapack.h:14
Reflex::Environ< long > m_collEnv
Structure containing parameters of the collection instance.
std::auto_ptr< Reflex::CollFuncTable > m_collProxy
Proxy of the generic collection.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void ora::PVectorHandler::clear ( const void *  address)
virtual
void ora::PVectorHandler::finalize ( void *  address)
virtual

execute the ending procedure for the container

Reimplemented from ora::IArrayHandler.

Definition at line 142 of file PVectorHandler.cc.

References findQualityFiles::size.

142  {
143  size_t transSize = size( address );
144  void* persistentSizeAttributeAddress = static_cast<char*>(address)+m_persistentSizeAttributeOffset;
145  *static_cast<size_t*>(persistentSizeAttributeAddress) = transSize;
146 }
size_t m_persistentSizeAttributeOffset
char * address
Definition: mlp_lapack.h:14
size_t size(const void *address)
Returns the size of the container.
bool ora::PVectorHandler::isAssociative ( ) const
inlinevirtual

Returns the associativeness of the container.

Reimplemented from ora::IArrayHandler.

Definition at line 81 of file PVectorHandler.h.

References m_isAssociative.

81  {
82  return m_isAssociative;
83  }
bool m_isAssociative
Flag indicating whether the container is associative.
ora::IArrayIteratorHandler * ora::PVectorHandler::iterate ( const void *  address)
virtual

Returns an initialized iterator.

Implements ora::IArrayHandler.

Definition at line 108 of file PVectorHandler.cc.

References ora::throwException().

108  {
109  if ( ! m_iteratorReturnType ) {
110  throwException( "Missing the dictionary information for the value_type member of the container \"" +
111  m_type.Name(Reflex::SCOPED|Reflex::FINAL) + "\"",
112  "PVectorHandler" );
113  }
114  m_collEnv.fObject = static_cast<char*>(const_cast<void*>(address))+m_vecAttributeOffset;
115  return new PVectorIteratorHandler( m_collEnv,*m_collProxy,m_iteratorReturnType,startElementIndex(address) );
116 }
Reflex::Type m_type
The dictionary information.
char * address
Definition: mlp_lapack.h:14
Reflex::Type m_iteratorReturnType
The iterator return type.
size_t startElementIndex(const void *address)
Returns the index of the first element.
Reflex::Environ< long > m_collEnv
Structure containing parameters of the collection instance.
std::auto_ptr< Reflex::CollFuncTable > m_collProxy
Proxy of the generic collection.
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
Reflex::Type & ora::PVectorHandler::iteratorReturnType ( )
virtual

Returns the iterator return type.

Implements ora::IArrayHandler.

Definition at line 138 of file PVectorHandler.cc.

138  {
139  return m_iteratorReturnType;
140 }
Reflex::Type m_iteratorReturnType
The iterator return type.
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.

102  {
103  void* persistentSizeAddress = static_cast<char*>(const_cast<void*>(address))+m_persistentSizeAttributeOffset;
104  return static_cast<size_t*>(persistentSizeAddress);
105 }
size_t m_persistentSizeAttributeOffset
char * address
Definition: mlp_lapack.h:14
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.

86  {
87  m_collEnv.fObject = static_cast<char*>(const_cast<void*>(address))+m_vecAttributeOffset;
88  size_t transientSize = *(static_cast<size_t*>(m_collProxy->size_func(&m_collEnv)));
89  return transientSize;
90 }
char * address
Definition: mlp_lapack.h:14
Reflex::Environ< long > m_collEnv
Structure containing parameters of the collection instance.
std::auto_ptr< Reflex::CollFuncTable > m_collProxy
Proxy of the generic collection.
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.

93  {
94  const void* persistentSizeAddress = static_cast<const char *>(address) + m_persistentSizeAttributeOffset;
95  size_t persistentSize = *static_cast<const size_t*>(persistentSizeAddress);
96  size_t transientSize = *(static_cast<size_t*>(m_collProxy->size_func(&m_collEnv)));
97  size_t startElement = 0;
98  if(persistentSize < transientSize) startElement = persistentSize;
99  return startElement;
100 }
size_t m_persistentSizeAttributeOffset
char * address
Definition: mlp_lapack.h:14
Reflex::Environ< long > m_collEnv
Structure containing parameters of the collection instance.
std::auto_ptr< Reflex::CollFuncTable > m_collProxy
Proxy of the generic collection.
size_t * persistentSize(const void *address)
Returns the persistent size of the container.

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().

bool ora::PVectorHandler::m_isAssociative
private

Flag indicating whether the container is associative.

Definition at line 99 of file PVectorHandler.h.

Referenced by isAssociative().

Reflex::Type ora::PVectorHandler::m_iteratorReturnType
private

The iterator return type.

Definition at line 96 of file PVectorHandler.h.

Referenced by PVectorHandler().

size_t ora::PVectorHandler::m_persistentSizeAttributeOffset
private

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().

size_t ora::PVectorHandler::m_vecAttributeOffset
private

Definition at line 109 of file PVectorHandler.h.

Referenced by PVectorHandler().