DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members

Class describing an opaque conditions data block. More...

#include <OpaqueData.h>

Inheritance diagram for dd4hep::OpaqueDataBlock:
dd4hep::OpaqueData

Public Types

enum  _DataTypes {
  PLAIN_DATA = 1<<0, ALLOC_DATA = 1<<1, STACK_DATA = 1<<2, BOUND_DATA = 1<<3,
  EXTERN_DATA = 1<<4
}
 

Public Member Functions

 OpaqueDataBlock ()
 Standard initializing constructor. More...
 
template<typename OBJECT >
 OpaqueDataBlock (OBJECT &&data)
 Initializing constructor binding data to buffer with move. More...
 
 OpaqueDataBlock (const OpaqueDataBlock &copy)
 Copy constructor (Required by ROOT dictionaries) More...
 
 ~OpaqueDataBlock ()
 Standard Destructor. More...
 
OpaqueDataBlockoperator= (const OpaqueDataBlock &copy)
 Assignment operator (Required by ROOT dictionaries) More...
 
void * ptr () const
 Write access to the data buffer. Is only valid after call to bind<T>() More...
 
void * bind (const BasicGrammar *grammar)
 Bind data value. More...
 
void * bind (void *ptr, size_t len, const BasicGrammar *grammar)
 Bind data value in place. More...
 
void bindExtern (void *ptr, const BasicGrammar *grammar)
 Bind external data value to the pointer. More...
 
template<typename T , typename... Args>
T & construct (Args... args)
 Construct conditions object and bind the data. More...
 
template<typename T >
T & bind ()
 Bind data value. More...
 
template<typename T >
T & bind (void *ptr, size_t len)
 Bind data value. More...
 
template<typename T >
T & bind (const std::string &value)
 Bind data value. More...
 
template<typename T >
T & bind (void *ptr, size_t len, const std::string &value)
 Bind data value. More...
 
template<typename T >
T & bind (T &&data)
 Bind data value. More...
 
template<typename T >
void bindExtern (T *ptr)
 Bind external data value to the pointer. More...
 
- Public Member Functions inherited from dd4hep::OpaqueData
bool fromString (const std::string &rep)
 No ROOT persistency. More...
 
std::string str () const
 Create string representation of the data block. More...
 
const std::type_info & typeInfo () const
 Access type id of the condition. More...
 
const std::string & dataType () const
 Access type name of the condition data block. More...
 
const void * ptr () const
 Access to the data buffer (read only!). Is only valid after call to bind<T>() More...
 
bool is_bound () const
 Check if object is already bound.... More...
 
template<typename T >
T & get ()
 Generic getter. Specify the exact type, not a polymorph type. More...
 
template<typename T >
const T & get () const
 Generic getter (const version). Specify the exact type, not a polymorph type. More...
 
template<typename T >
T & as ()
 Generic getter. Resolves polymorph types. It is mandatory that the datatype is polymorph! More...
 
template<typename T >
const T & as () const
 Generic getter (const version). Resolves polymorph types. It is mandatory that the datatype is polymorph! More...
 

Public Attributes

unsigned int type
 Data buffer type: Must be a bitmap of enum _DataTypes! More...
 
- Public Attributes inherited from dd4hep::OpaqueData
const BasicGrammargrammar = 0
 Data type. More...
 

Static Public Attributes

constexpr static const size_t BUFFER_SIZE = 40
 Buffer size of the in-place data buffer. More...
 

Protected Attributes

unsigned char data [BUFFER_SIZE]
 Data buffer: plain data are allocated directly on this buffer. More...
 
- Protected Attributes inherited from dd4hep::OpaqueData
void * pointer = 0
 No ROOT persistency. More...
 

Additional Inherited Members

- Protected Member Functions inherited from dd4hep::OpaqueData
 OpaqueData ()=default
 Standard initializing constructor. More...
 
virtual ~OpaqueData ()=default
 Standard Destructor. More...
 
 OpaqueData (const OpaqueData &copy)=default
 Copy constructor. More...
 
OpaqueDataoperator= (const OpaqueData &copy)=default
 Assignment operator. More...
 

Detailed Description

Class describing an opaque conditions data block.

This class is used to handle the actual data IO. Hence, we have write access to the data in abstract form.

Author
M.Frank
Version
1.0

Definition at line 92 of file OpaqueData.h.

Member Enumeration Documentation

◆ _DataTypes

Enumerator
PLAIN_DATA 
ALLOC_DATA 
STACK_DATA 
BOUND_DATA 
EXTERN_DATA 

Definition at line 111 of file OpaqueData.h.

Constructor & Destructor Documentation

◆ OpaqueDataBlock() [1/3]

OpaqueDataBlock::OpaqueDataBlock ( )

Standard initializing constructor.

Definition at line 58 of file OpaqueData.cpp.

◆ OpaqueDataBlock() [2/3]

template<typename OBJECT >
dd4hep::OpaqueDataBlock::OpaqueDataBlock ( OBJECT &&  data)

Initializing constructor binding data to buffer with move.

Definition at line 187 of file OpaqueData.h.

◆ OpaqueDataBlock() [3/3]

OpaqueDataBlock::OpaqueDataBlock ( const OpaqueDataBlock copy)

Copy constructor (Required by ROOT dictionaries)

Copy constructor.

Definition at line 63 of file OpaqueData.cpp.

◆ ~OpaqueDataBlock()

OpaqueDataBlock::~OpaqueDataBlock ( )

Standard Destructor.

Definition at line 79 of file OpaqueData.cpp.

Member Function Documentation

◆ bind() [1/7]

template<typename T >
T & dd4hep::OpaqueDataBlock::bind
inline

Bind data value.

Definition at line 199 of file OpaqueData.h.

◆ bind() [2/7]

void * OpaqueDataBlock::bind ( const BasicGrammar grammar)

Bind data value.

Definition at line 124 of file OpaqueData.cpp.

◆ bind() [3/7]

template<typename T >
T & dd4hep::OpaqueDataBlock::bind ( const std::string &  value)
inline

Bind data value.

Bind grammar and assign value.

Definition at line 217 of file OpaqueData.h.

◆ bind() [4/7]

template<typename T >
T & dd4hep::OpaqueDataBlock::bind ( T &&  data)
inline

Bind data value.

Definition at line 205 of file OpaqueData.h.

◆ bind() [5/7]

template<typename T >
T & dd4hep::OpaqueDataBlock::bind ( void *  ptr,
size_t  len 
)
inline

Bind data value.

Definition at line 211 of file OpaqueData.h.

◆ bind() [6/7]

void * OpaqueDataBlock::bind ( void *  ptr,
size_t  len,
const BasicGrammar grammar 
)

Bind data value in place.

Set data value.

Definition at line 158 of file OpaqueData.cpp.

◆ bind() [7/7]

template<typename T >
T & dd4hep::OpaqueDataBlock::bind ( void *  ptr,
size_t  len,
const std::string &  value 
)
inline

Bind data value.

Bind grammar and assign value.

Definition at line 227 of file OpaqueData.h.

◆ bindExtern() [1/2]

template<typename T >
void dd4hep::OpaqueDataBlock::bindExtern ( T *  ptr)
inline

Bind external data value to the pointer.

Definition at line 236 of file OpaqueData.h.

◆ bindExtern() [2/2]

void OpaqueDataBlock::bindExtern ( void *  ptr,
const BasicGrammar grammar 
)

Bind external data value to the pointer.

Definition at line 146 of file OpaqueData.cpp.

◆ construct()

template<typename T , typename... Args>
T & dd4hep::OpaqueDataBlock::construct ( Args...  args)
inline

Construct conditions object and bind the data.

Definition at line 193 of file OpaqueData.h.

◆ operator=()

OpaqueDataBlock & OpaqueDataBlock::operator= ( const OpaqueDataBlock copy)

Assignment operator (Required by ROOT dictionaries)

Copy constructor.

Definition at line 90 of file OpaqueData.cpp.

◆ ptr()

void* dd4hep::OpaqueDataBlock::ptr ( ) const
inline

Write access to the data buffer. Is only valid after call to bind<T>()

Definition at line 133 of file OpaqueData.h.

Member Data Documentation

◆ BUFFER_SIZE

constexpr static const size_t dd4hep::OpaqueDataBlock::BUFFER_SIZE = 40
staticconstexpr

Buffer size of the in-place data buffer.

Definition at line 96 of file OpaqueData.h.

◆ data

unsigned char dd4hep::OpaqueDataBlock::data[BUFFER_SIZE]
protected

Data buffer: plain data are allocated directly on this buffer.

This internal data buffer is sufficient to store any STL vector, list, map, etc. and hence should be sufficient to probably store normal relatively primitive basic objects.

It appears that on clang the size of std::any is 32 bytes (16 bytes on g++_, whereas the size of std::vector is 24. Lets take 40 bytes and check it in the Conditions_any_basic example...

Definition at line 108 of file OpaqueData.h.

◆ type

unsigned int dd4hep::OpaqueDataBlock::type

Data buffer type: Must be a bitmap of enum _DataTypes!

Definition at line 119 of file OpaqueData.h.


The documentation for this class was generated from the following files: