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...
 
edm::TypeWithDictiteratorReturnType ()
 Returns the iterator return type. More...
 
size_t * persistentSize (const void *address)
 Returns the persistent size of the container. More...
 
 PVectorHandler (const edm::TypeWithDict &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

TVirtualCollectionProxy * m_collProxy
 Proxy of the generic collection. More...
 
edm::TypeWithDict m_iteratorReturnType
 The iterator return type. More...
 
size_t m_persistentSizeAttributeOffset
 
edm::TypeWithDict m_type
 The dictionary information. More...
 
size_t m_vecAttributeOffset
 

Detailed Description

Definition at line 55 of file PVectorHandler.h.

Constructor & Destructor Documentation

ora::PVectorHandler::PVectorHandler ( const edm::TypeWithDict dictionary)
explicit

Constructor.

Definition at line 51 of file PVectorHandler.cc.

References GetRecoTauVFromDQM_MC_cff::cl, ora::ClassUtils::containerValueType(), edm::TypeWithDict::cppName(), edm::TypeWithDict::dataMemberByName(), edm::TypeWithDict::getClass(), m_collProxy, m_iteratorReturnType, m_persistentSizeAttributeOffset, m_type, m_vecAttributeOffset, edm::MemberWithDict::offset(), ora::ClassUtils::resolvedType(), ora::throwException(), and edm::MemberWithDict::typeOf().

51  :
52  m_type( dictionary ),
54  m_collProxy(),
57 {
58  edm::MemberWithDict privateVectorAttribute = m_type.dataMemberByName("m_vec");
59  if(privateVectorAttribute){
60  m_vecAttributeOffset = privateVectorAttribute.offset();
61  TClass* cl = privateVectorAttribute.typeOf().getClass();
62  m_collProxy = cl->GetCollectionProxy();
63  if( !m_collProxy ){
64  throwException( "Cannot create \"TVirtualCollectionProxy\" for type \""+m_type.cppName()+"\"",
65  "PVectorHandler::PVectorHandler");
66  }
67  }
68 
69  edm::MemberWithDict persistentSizeAttribute = m_type.dataMemberByName("m_persistentSize");
70  if( persistentSizeAttribute ){
71  m_persistentSizeAttributeOffset = persistentSizeAttribute.offset();
72  }
73 
74  // find the iterator return type as the member type_value of the containers
77 }
size_t m_persistentSizeAttributeOffset
edm::TypeWithDict m_iteratorReturnType
The iterator return type.
edm::TypeWithDict resolvedType(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:486
edm::TypeWithDict m_type
The dictionary information.
size_t offset() const
MemberWithDict dataMemberByName(std::string const &) const
TClass * getClass() const
std::string cppName() const
TypeWithDict typeOf() const
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
edm::TypeWithDict containerValueType(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:410
TVirtualCollectionProxy * m_collProxy
Proxy of the generic collection.
ora::PVectorHandler::~PVectorHandler ( )
virtual

Destructor.

Definition at line 79 of file PVectorHandler.cc.

79  {
80 }

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.

119  {
120 
121  void* addr = static_cast<char*>(const_cast<void*>(address))+m_vecAttributeOffset;
122  m_collProxy->Insert(data, addr, 1);
123 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
TVirtualCollectionProxy * m_collProxy
Proxy of the generic collection.
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 137 of file PVectorHandler.cc.

References findQualityFiles::size.

137  {
138  size_t transSize = size( address );
139  void* persistentSizeAttributeAddress = static_cast<char*>(address)+m_persistentSizeAttributeOffset;
140  *static_cast<size_t*>(persistentSizeAttributeAddress) = transSize;
141 }
size_t m_persistentSizeAttributeOffset
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 83 of file PVectorHandler.h.

83  {
84  return false;
85  }
ora::IArrayIteratorHandler * ora::PVectorHandler::iterate ( const void *  address)
virtual

Returns an initialized iterator.

Implements ora::IArrayHandler.

Definition at line 107 of file PVectorHandler.cc.

References ora::throwException().

107  {
108  if ( ! m_iteratorReturnType ) {
109  throwException( "Missing the dictionary information for the value_type member of the container \"" +
110  m_type.cppName() + "\"",
111  "PVectorHandler" );
112  }
113  void *addr = static_cast<char*>(const_cast<void*>(address))+m_vecAttributeOffset;
114 
115  return new PVectorIteratorHandler( addr,*m_collProxy,m_iteratorReturnType,startElementIndex(address) );
116 }
edm::TypeWithDict m_iteratorReturnType
The iterator return type.
edm::TypeWithDict m_type
The dictionary information.
std::string cppName() const
size_t startElementIndex(const void *address)
Returns the index of the first element.
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
TVirtualCollectionProxy * m_collProxy
Proxy of the generic collection.
edm::TypeWithDict & ora::PVectorHandler::iteratorReturnType ( )
virtual

Returns the iterator return type.

Implements ora::IArrayHandler.

Definition at line 133 of file PVectorHandler.cc.

133  {
134  return m_iteratorReturnType;
135 }
edm::TypeWithDict 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 101 of file PVectorHandler.cc.

101  {
102  void* persistentSizeAddress = static_cast<char*>(const_cast<void*>(address))+m_persistentSizeAttributeOffset;
103  return static_cast<size_t*>(persistentSizeAddress);
104 }
size_t m_persistentSizeAttributeOffset
size_t ora::PVectorHandler::size ( const void *  address)
virtual

Returns the size of the container.

Implements ora::IArrayHandler.

Definition at line 83 of file PVectorHandler.cc.

83  {
84  TVirtualCollectionProxy::TPushPop helper(m_collProxy, static_cast<char*>(const_cast<void*>(address))+m_vecAttributeOffset );
85  return m_collProxy->Size();
86 }
TVirtualCollectionProxy * 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 89 of file PVectorHandler.cc.

89  {
90  const void* persistentSizeAddress = static_cast<const char *>(address) + m_persistentSizeAttributeOffset;
91  size_t persistentSize = *static_cast<const size_t*>(persistentSizeAddress);
92 
93  TVirtualCollectionProxy::TPushPop helper(m_collProxy, static_cast<char*>(const_cast<void*>(address))+m_vecAttributeOffset );
94  size_t transientSize = m_collProxy->Size();
95 
96  size_t startElement = 0;
97  if(persistentSize < transientSize) startElement = persistentSize;
98  return startElement;
99 }
size_t m_persistentSizeAttributeOffset
size_t * persistentSize(const void *address)
Returns the persistent size of the container.
TVirtualCollectionProxy * m_collProxy
Proxy of the generic collection.

Member Data Documentation

TVirtualCollectionProxy* ora::PVectorHandler::m_collProxy
private

Proxy of the generic collection.

Definition at line 101 of file PVectorHandler.h.

Referenced by PVectorHandler().

edm::TypeWithDict ora::PVectorHandler::m_iteratorReturnType
private

The iterator return type.

Definition at line 98 of file PVectorHandler.h.

Referenced by PVectorHandler().

size_t ora::PVectorHandler::m_persistentSizeAttributeOffset
private

Definition at line 103 of file PVectorHandler.h.

Referenced by PVectorHandler().

edm::TypeWithDict ora::PVectorHandler::m_type
private

The dictionary information.

Definition at line 95 of file PVectorHandler.h.

Referenced by PVectorHandler().

size_t ora::PVectorHandler::m_vecAttributeOffset
private

Definition at line 105 of file PVectorHandler.h.

Referenced by PVectorHandler().