CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::DataElement Class Reference

#include <DataElement.h>

List of all members.

Public Member Functions

DataElementaddChild (size_t declaringScopeOffset, Reflex::OffsetFunction offsetFunction)
void * address (const void *topLevelAddress) const
void clear ()
 DataElement ()
 DataElement (size_t declaringScopeOffset, Reflex::OffsetFunction offsetFunction)
size_t declaringScopeOffset () const
size_t offset (const void *topLevelAddress) const
virtual ~DataElement ()

Private Attributes

std::vector< DataElement * > m_children
size_t m_declaringScopeOffset
Reflex::OffsetFunction m_offsetFunction
const DataElementm_parent

Detailed Description

Definition at line 10 of file DataElement.h.


Constructor & Destructor Documentation

ora::DataElement::DataElement ( )

Definition at line 3 of file DataElement.cc.

ora::DataElement::DataElement ( size_t  declaringScopeOffset,
Reflex::OffsetFunction  offsetFunction 
)

Definition at line 10 of file DataElement.cc.

ora::DataElement::~DataElement ( ) [virtual]

Definition at line 18 of file DataElement.cc.

                            {
  for(std::vector<DataElement*>::const_iterator iEl = m_children.begin();
      iEl != m_children.end(); ++iEl ){
    delete *iEl;
  }
}

Member Function Documentation

ora::DataElement & ora::DataElement::addChild ( size_t  declaringScopeOffset,
Reflex::OffsetFunction  offsetFunction 
)
void * ora::DataElement::address ( const void *  topLevelAddress) const

Definition at line 48 of file DataElement.cc.

References evf::evtn::offset().

Referenced by ora::OraPtrReader::read(), and ora::UniqueRefReader::read().

                                                                 {
  void* elementAddress = static_cast< char* >( const_cast<void*>(topLevelAddress)) + offset( topLevelAddress );
  return elementAddress;
}
void ora::DataElement::clear ( void  )

Definition at line 58 of file DataElement.cc.

Referenced by ora::QueryableVectorReader::build(), ora::OraPtrWriter::build(), ora::OraPtrReader::build(), and ora::OraPtrUpdater::build().

                          {
  for(std::vector<DataElement*>::const_iterator iEl = m_children.begin();
      iEl != m_children.end(); ++iEl ){
    delete *iEl;
  }
  m_children.clear();
}
size_t ora::DataElement::declaringScopeOffset ( ) const

Definition at line 53 of file DataElement.cc.

size_t ora::DataElement::offset ( const void *  topLevelAddress) const

Definition at line 34 of file DataElement.cc.

References evf::evtn::offset().

                                                                 {
  const void* address = topLevelAddress;
  size_t offset = m_declaringScopeOffset;
  if(m_parent){
    size_t parentOffset = m_parent->offset( topLevelAddress );
    offset += parentOffset;
    address = static_cast<char*>(const_cast<void*>(topLevelAddress))+parentOffset;
  }
  if(m_offsetFunction){
    offset += m_offsetFunction( const_cast<void*>(address));
  }
  return offset;  
}

Member Data Documentation

std::vector<DataElement*> ora::DataElement::m_children [private]

Definition at line 27 of file DataElement.h.

Definition at line 28 of file DataElement.h.

Reflex::OffsetFunction ora::DataElement::m_offsetFunction [private]

Definition at line 29 of file DataElement.h.

Definition at line 26 of file DataElement.h.

Referenced by addChild().