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

50  :
51  m_type( dictionary ),
53  m_collProxy(),
56 {
57  edm::MemberWithDict privateVectorAttribute = m_type.dataMemberByName("m_vec");
58  if(privateVectorAttribute){
59  m_vecAttributeOffset = privateVectorAttribute.offset();
60  TClass* cl = privateVectorAttribute.typeOf().getClass();
61  m_collProxy = cl->GetCollectionProxy();
62  if( !m_collProxy ){
63  throwException( "Cannot create \"TVirtualCollectionProxy\" for type \""+m_type.cppName()+"\"",
64  "PVectorHandler::PVectorHandler");
65  }
66  }
67 
68  edm::MemberWithDict persistentSizeAttribute = m_type.dataMemberByName("m_persistentSize");
69  if( persistentSizeAttribute ){
70  m_persistentSizeAttributeOffset = persistentSizeAttribute.offset();
71  }
72 
73  // find the iterator return type as the member type_value of the containers
76 }
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 78 of file PVectorHandler.cc.

78  {
79 }

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

118  {
119 
120  void* addr = static_cast<char*>(const_cast<void*>(address))+m_vecAttributeOffset;
121  m_collProxy->Insert(data, addr, 1);
122 }
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

Clear the content of the container.

Implements ora::IArrayHandler.

Definition at line 125 of file PVectorHandler.cc.

Referenced by Vispa.Views.WidgetView.WidgetView::closeEvent(), Vispa.Share.FindAlgorithm.FindAlgorithm::findUsingFindDialog(), and Vispa.Views.WidgetView.WidgetView::setDataObjects().

125  {
126  void* addr = static_cast<char*>(const_cast<void*>(address))+m_vecAttributeOffset;
127  TVirtualCollectionProxy::TPushPop helper(m_collProxy, const_cast<void*>(addr));
128  m_collProxy->Clear();
129 }
TVirtualCollectionProxy * m_collProxy
Proxy of the generic collection.
void ora::PVectorHandler::finalize ( void *  address)
virtual

execute the ending procedure for the container

Reimplemented from ora::IArrayHandler.

Definition at line 136 of file PVectorHandler.cc.

References findQualityFiles::size.

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

References ora::throwException().

106  {
107  if ( ! m_iteratorReturnType ) {
108  throwException( "Missing the dictionary information for the value_type member of the container \"" +
109  m_type.cppName() + "\"",
110  "PVectorHandler" );
111  }
112  void *addr = static_cast<char*>(const_cast<void*>(address))+m_vecAttributeOffset;
113 
114  return new PVectorIteratorHandler( addr,*m_collProxy,m_iteratorReturnType,startElementIndex(address) );
115 }
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 132 of file PVectorHandler.cc.

132  {
133  return m_iteratorReturnType;
134 }
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 100 of file PVectorHandler.cc.

100  {
101  void* persistentSizeAddress = static_cast<char*>(const_cast<void*>(address))+m_persistentSizeAttributeOffset;
102  return static_cast<size_t*>(persistentSizeAddress);
103 }
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 82 of file PVectorHandler.cc.

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

88  {
89  const void* persistentSizeAddress = static_cast<const char *>(address) + m_persistentSizeAttributeOffset;
90  size_t persistentSize = *static_cast<const size_t*>(persistentSizeAddress);
91 
92  TVirtualCollectionProxy::TPushPop helper(m_collProxy, static_cast<char*>(const_cast<void*>(address))+m_vecAttributeOffset );
93  size_t transientSize = m_collProxy->Size();
94 
95  size_t startElement = 0;
96  if(persistentSize < transientSize) startElement = persistentSize;
97  return startElement;
98 }
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().