The Gaudi Framework  master (37c0b60a)
NTuple::_DataImp< TYP > Class Template Reference

Concrete class discribing basic data items in an N tuple. More...

#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/NTupleItems.h>

Collaboration diagram for NTuple::_DataImp< TYP >:

Public Types

typedef Range< TYP > ItemRange
 Set type definition to make life more easy easy. More...
 

Public Member Functions

 _DataImp (INTuple *tup, std::string name, const std::type_info &info, std::string index, long len, TYP low, TYP high, TYP def)
 Standard Constructor. More...
 
 ~_DataImp () override
 Standard destructor. More...
 
std::string typeName () const override
 Get proper type name. More...
 
void reset () override
 Reset to default. More...
 
long filled () const override
 Number of items filled. More...
 
INTupleItemindexItem () override
 Pointer to index column (if present, 0 else) More...
 
const INTupleItemindexItem () const override
 Pointer to index column (if present, 0 else) (CONST) More...
 
const std::type_infotypeID () const override
 Compiler type ID. More...
 
long size () const override
 Size of entire object. More...
 
void release () override
 Destruct object. More...
 
bool hasIndex () const override
 Is the tuple have an index column? More...
 
const std::stringindex () const override
 Access the index _Column. More...
 
const std::stringname () const override
 Access _Column name. More...
 
long type () const override
 TYP information of the item. More...
 
void setType (long t) override
 Set the properties of the _Column. More...
 
void setDefault (const TYP val) override
 Set default value. More...
 
const ItemRangerange () const override
 Access the range if specified. More...
 
long length () const override
 Access the buffer length. More...
 
const void * buffer () const override
 Access data buffer (CONST) More...
 
virtual void * buffer ()
 Access data buffer. More...
 
long ndim () const override
 Dimension. More...
 
long dim (long i) const override
 Access individual dimensions. More...
 
INTupletuple () override
 Access to hosting ntuple. More...
 

Protected Types

typedef const std::stringCSTR
 
typedef const std::type_infoCTYPE
 

Protected Attributes

long m_length
 Entire buffer length. More...
 
INTuplem_tuple
 Pointer to N tuple. More...
 
std::string m_name
 _Column name More...
 
std::string m_index
 Check that values are within a certain range while filling. More...
 
INTupleItemm_indexItem = nullptr
 Pointer to index item. More...
 
DataTypeInfo::Type m_type
 _Column type More...
 
TYP m_def
 Buffer with default value. More...
 
Range< TYP > m_range
 Check that values are within a certain range while filling. More...
 
const std::type_infom_info
 Item type information. More...
 

Private Member Functions

 _DataImp (const _DataImp &)=delete
 Inhibit Copy Constructor. More...
 

Detailed Description

template<class TYP>
class NTuple::_DataImp< TYP >

Concrete class discribing basic data items in an N tuple.

Definition at line 46 of file NTupleItems.h.

Member Typedef Documentation

◆ CSTR

template<class TYP >
typedef const std::string& NTuple::_DataImp< TYP >::CSTR
protected

Definition at line 62 of file NTupleItems.h.

◆ CTYPE

template<class TYP >
typedef const std::type_info& NTuple::_DataImp< TYP >::CTYPE
protected

Definition at line 63 of file NTupleItems.h.

◆ ItemRange

template<class TYP >
typedef Range<TYP> NTuple::_DataImp< TYP >::ItemRange

Set type definition to make life more easy easy.

Definition at line 85 of file NTupleItems.h.

Constructor & Destructor Documentation

◆ _DataImp() [1/2]

template<class TYP >
NTuple::_DataImp< TYP >::_DataImp ( const _DataImp< TYP > &  )
privatedelete

Inhibit Copy Constructor.

◆ _DataImp() [2/2]

template<class TYP >
NTuple::_DataImp< TYP >::_DataImp ( INTuple tup,
std::string  name,
const std::type_info info,
std::string  index,
long  len,
TYP  low,
TYP  high,
TYP  def 
)
inline

Standard Constructor.

Definition at line 87 of file NTupleItems.h.

89  : m_length( len )
90  , m_tuple( tup )
91  , m_name( std::move( name ) )
92  , m_index( std::move( index ) )
93  , m_def( std::move( def ) )
94  , m_range( std::move( low ), std::move( high ) )
95  , m_info( info ) {
96  m_type = typeid( TYP ) == typeid( void* ) ? DataTypeInfo::POINTER : DataTypeInfo::ID( info );
97  this->m_buffer = new TYP[m_length];
98  reset();
99  }

◆ ~_DataImp()

template<class TYP >
NTuple::_DataImp< TYP >::~_DataImp ( )
inlineoverride

Standard destructor.

Definition at line 101 of file NTupleItems.h.

101 { delete[] this->m_buffer; }

Member Function Documentation

◆ buffer() [1/2]

template<class TYP >
virtual void* NTuple::_DataImp< TYP >::buffer ( )
inlinevirtual

Access data buffer.

Definition at line 156 of file NTupleItems.h.

156 { return this->m_buffer; }

◆ buffer() [2/2]

template<class TYP >
const void* NTuple::_DataImp< TYP >::buffer ( ) const
inlineoverride

Access data buffer (CONST)

Definition at line 154 of file NTupleItems.h.

154 { return this->m_buffer; }

◆ dim()

template<class TYP >
long NTuple::_DataImp< TYP >::dim ( long  i) const
inlineoverride

Access individual dimensions.

Definition at line 160 of file NTupleItems.h.

160 { return ( i == 0 ) ? 1 : 0; }

◆ filled()

template<class TYP >
long NTuple::_DataImp< TYP >::filled ( ) const
inlineoverride

Number of items filled.

Definition at line 107 of file NTupleItems.h.

107  {
108  long len = 1;
109  long nd = ndim();
110  if ( m_length > 1 ) {
111  for ( int l = 0; l < nd - 1; l++ ) { len *= dim( l ); }
112  if ( indexItem() ) {
113  long* ll = (long*)m_indexItem->buffer();
114  len *= *ll;
115  } else if ( nd > 0 ) {
116  len *= dim( nd - 1 );
117  }
118  }
119  return len;
120  }

◆ hasIndex()

template<class TYP >
bool NTuple::_DataImp< TYP >::hasIndex ( ) const
inlineoverride

Is the tuple have an index column?

Definition at line 138 of file NTupleItems.h.

138 { return m_index.length() > 0; }

◆ index()

template<class TYP >
const std::string& NTuple::_DataImp< TYP >::index ( ) const
inlineoverride

Access the index _Column.

Definition at line 140 of file NTupleItems.h.

140 { return m_index; }

◆ indexItem() [1/2]

template<class TYP >
const INTupleItem* NTuple::_DataImp< TYP >::indexItem ( ) const
inlineoverride

Pointer to index column (if present, 0 else) (CONST)

Definition at line 127 of file NTupleItems.h.

127  {
129  return m_indexItem;
130  }

◆ indexItem() [2/2]

template<class TYP >
INTupleItem* NTuple::_DataImp< TYP >::indexItem ( )
inlineoverride

Pointer to index column (if present, 0 else)

Definition at line 122 of file NTupleItems.h.

122  {
124  return m_indexItem;
125  }

◆ length()

template<class TYP >
long NTuple::_DataImp< TYP >::length ( ) const
inlineoverride

Access the buffer length.

Definition at line 152 of file NTupleItems.h.

152 { return m_length; }

◆ name()

template<class TYP >
const std::string& NTuple::_DataImp< TYP >::name ( ) const
inlineoverride

Access _Column name.

Definition at line 142 of file NTupleItems.h.

142 { return m_name; }

◆ ndim()

template<class TYP >
long NTuple::_DataImp< TYP >::ndim ( ) const
inlineoverride

Dimension.

Definition at line 158 of file NTupleItems.h.

158 { return 0; }

◆ range()

template<class TYP >
const ItemRange& NTuple::_DataImp< TYP >::range ( ) const
inlineoverride

Access the range if specified.

Definition at line 150 of file NTupleItems.h.

150 { return m_range; }

◆ release()

template<class TYP >
void NTuple::_DataImp< TYP >::release ( )
inlineoverride

Destruct object.

Definition at line 136 of file NTupleItems.h.

136 { delete this; }

◆ reset()

template<class TYP >
void NTuple::_DataImp< TYP >::reset ( )
inlineoverride

Reset to default.

Definition at line 105 of file NTupleItems.h.

105 { std::fill_n( this->m_buffer, m_length, m_def ); }

◆ setDefault()

template<class TYP >
void NTuple::_DataImp< TYP >::setDefault ( const TYP  val)
inlineoverride

Set default value.

Definition at line 148 of file NTupleItems.h.

148 { m_def = val; }

◆ setType()

template<class TYP >
void NTuple::_DataImp< TYP >::setType ( long  t)
inlineoverride

Set the properties of the _Column.

Definition at line 146 of file NTupleItems.h.

146 { m_type = DataTypeInfo::Type( t ); }

◆ size()

template<class TYP >
long NTuple::_DataImp< TYP >::size ( ) const
inlineoverride

Size of entire object.

Definition at line 134 of file NTupleItems.h.

134 { return m_length * sizeof( TYP ); }

◆ tuple()

template<class TYP >
INTuple* NTuple::_DataImp< TYP >::tuple ( )
inlineoverride

Access to hosting ntuple.

Definition at line 162 of file NTupleItems.h.

162 { return m_tuple; }

◆ type()

template<class TYP >
long NTuple::_DataImp< TYP >::type ( ) const
inlineoverride

TYP information of the item.

Definition at line 144 of file NTupleItems.h.

144 { return m_type; }

◆ typeID()

template<class TYP >
const std::type_info& NTuple::_DataImp< TYP >::typeID ( ) const
inlineoverride

Compiler type ID.

Definition at line 132 of file NTupleItems.h.

132 { return m_info; }

◆ typeName()

template<class TYP >
std::string NTuple::_DataImp< TYP >::typeName ( ) const
inlineoverride

Get proper type name.

Definition at line 103 of file NTupleItems.h.

103 { return System::typeinfoName( this->typeID() ); }

Member Data Documentation

◆ m_def

template<class TYP >
TYP NTuple::_DataImp< TYP >::m_def
protected

Buffer with default value.

Definition at line 77 of file NTupleItems.h.

◆ m_index

template<class TYP >
std::string NTuple::_DataImp< TYP >::m_index
protected

Check that values are within a certain range while filling.

Definition at line 71 of file NTupleItems.h.

◆ m_indexItem

template<class TYP >
INTupleItem* NTuple::_DataImp< TYP >::m_indexItem = nullptr
mutableprotected

Pointer to index item.

Definition at line 73 of file NTupleItems.h.

◆ m_info

template<class TYP >
const std::type_info& NTuple::_DataImp< TYP >::m_info
protected

Item type information.

Definition at line 81 of file NTupleItems.h.

◆ m_length

template<class TYP >
long NTuple::_DataImp< TYP >::m_length
protected

Entire buffer length.

Definition at line 65 of file NTupleItems.h.

◆ m_name

template<class TYP >
std::string NTuple::_DataImp< TYP >::m_name
protected

_Column name

Definition at line 69 of file NTupleItems.h.

◆ m_range

template<class TYP >
Range<TYP> NTuple::_DataImp< TYP >::m_range
protected

Check that values are within a certain range while filling.

Definition at line 79 of file NTupleItems.h.

◆ m_tuple

template<class TYP >
INTuple* NTuple::_DataImp< TYP >::m_tuple
protected

Pointer to N tuple.

Definition at line 67 of file NTupleItems.h.

◆ m_type

template<class TYP >
DataTypeInfo::Type NTuple::_DataImp< TYP >::m_type
protected

_Column type

Definition at line 75 of file NTupleItems.h.


The documentation for this class was generated from the following file:
DataTypeInfo::ID
static Type ID(const bool)
Access to type information: bool.
Definition: DataTypeInfo.h:58
std::move
T move(T... args)
NTuple::_DataImp::m_index
std::string m_index
Check that values are within a certain range while filling.
Definition: NTupleItems.h:71
std::string::length
T length(T... args)
NTuple::_DataImp::m_length
long m_length
Entire buffer length.
Definition: NTupleItems.h:65
DataTypeInfo::POINTER
@ POINTER
Definition: DataTypeInfo.h:50
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:315
INTuple::find
virtual const INTupleItem * find(const std::string &name) const =0
Find an item row of the Ntuple (CONST)
NTuple::_DataImp::index
const std::string & index() const override
Access the index _Column.
Definition: NTupleItems.h:140
DataTypeInfo::Type
Type
Definition: DataTypeInfo.h:33
bug_34121.t
t
Definition: bug_34121.py:31
INTupleItem::buffer
virtual const void * buffer() const =0
Access data buffer (CONST)
NTuple::_DataImp::m_type
DataTypeInfo::Type m_type
_Column type
Definition: NTupleItems.h:75
NTuple::_DataImp::name
const std::string & name() const override
Access _Column name.
Definition: NTupleItems.h:142
NTuple::_DataImp::m_tuple
INTuple * m_tuple
Pointer to N tuple.
Definition: NTupleItems.h:67
NTuple::_DataImp::m_info
const std::type_info & m_info
Item type information.
Definition: NTupleItems.h:81
gaudirun.l
dictionary l
Definition: gaudirun.py:583
NTuple::_DataImp::m_range
Range< TYP > m_range
Check that values are within a certain range while filling.
Definition: NTupleItems.h:79
NTuple::_DataImp::m_indexItem
INTupleItem * m_indexItem
Pointer to index item.
Definition: NTupleItems.h:73
NTuple::_DataImp::indexItem
INTupleItem * indexItem() override
Pointer to index column (if present, 0 else)
Definition: NTupleItems.h:122
NTuple::_DataImp::dim
long dim(long i) const override
Access individual dimensions.
Definition: NTupleItems.h:160
NTuple::_DataImp::m_name
std::string m_name
_Column name
Definition: NTupleItems.h:69
std::fill_n
T fill_n(T... args)
NTuple::_DataImp::typeID
const std::type_info & typeID() const override
Compiler type ID.
Definition: NTupleItems.h:132
NTuple::_DataImp::m_def
TYP m_def
Buffer with default value.
Definition: NTupleItems.h:77
NTuple::_DataImp::ndim
long ndim() const override
Dimension.
Definition: NTupleItems.h:158
NTuple::_DataImp::reset
void reset() override
Reset to default.
Definition: NTupleItems.h:105