Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
NTuple.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_NTUPLE_H
2 #define GAUDIKERNEL_NTUPLE_H
3 // ============================================================================
4 // STL include files
5 // ============================================================================
6 #include <algorithm>
7 #include <cfloat>
8 #include <limits>
9 #include <stdexcept>
10 #include <string>
11 // ============================================================================
12 // Framework include files
13 // ============================================================================
14 #include "GaudiKernel/DataObject.h"
16 #include "GaudiKernel/INTuple.h"
19 // ============================================================================
20 // Forward declarations
21 // ============================================================================
22 class NTupleFile;
23 class NTupleDirectory;
24 // ============================================================================
33 namespace NTuple {
34  // local forward declarations
35  template <class TYP>
36  class Range;
37  template <class TYP>
38  class _Data;
39  template <class TYP>
40  class _Item;
41  template <class TYP>
42  class _Array;
43  template <class TYP>
44  class _Matrix;
45  template <class TYP>
46  class _Accessor;
47  template <class TYP>
48  class Item;
49  template <class TYP>
50  class Array;
51  template <class TYP>
52  class Matrix;
53  // ==========================================================================
55  template <class TYP>
56  class Range {
58  /*const*/ TYP m_lower;
60  /*const*/ TYP m_upper;
61 
62  public:
64  Range( TYP low, TYP upper ) : m_lower( std::move( low ) ), m_upper( std::move( upper ) ) {}
66  Range( const Range<TYP>& copy ) : m_lower( copy.m_lower ), m_upper( copy.m_upper ) {}
68  Range& operator=( const Range<TYP>& copy ) {
69  m_lower = copy.m_lower;
70  m_upper = copy.m_upper;
71  return *this;
72  }
74  virtual ~Range() = default;
76  TYP lower() const { return m_lower; }
78  TYP upper() const { return m_upper; }
80  TYP distance() const { return m_upper - m_lower; }
82  static TYP min() { return std::numeric_limits<TYP>::min(); }
84  static TYP max() { return std::numeric_limits<TYP>::max(); }
85  };
86  // ==========================================================================
87  template <>
88  class Range<bool> {
89  public:
91  Range( const bool /* low */, const bool /* upper */ ) {}
93  Range( const Range<bool>& /* copy */ ) {}
95  virtual ~Range() = default;
97  bool lower() const { return false; }
99  bool upper() const { return true; }
101  bool distance() const { return true; }
103  static bool min() { return false; }
105  static bool max() { return true; }
106  };
107  // ==========================================================================
108  template <>
110  return (IOpaqueAddress*)0x0;
111  }
112  template <>
114  return (IOpaqueAddress*)0xffffffff;
115  }
116  // ==========================================================================
119  template <class TYP>
120  class GAUDI_API _Data : virtual public INTupleItem {
121  protected:
123  TYP* m_buffer = nullptr;
124 
125  public:
129  virtual void setDefault( const TYP d ) = 0;
131  virtual const ItemRange& range() const = 0;
132  };
133  // ==========================================================================
136  template <class TYP>
137  class GAUDI_API _Item : virtual public _Data<TYP> {
138  public:
140  static _Item* create( INTuple* tup, const std::string& name, const std::type_info& info, TYP min, TYP max,
141  TYP def );
143  template <class T>
144  _Item<TYP>& operator=( const _Item<T>& copy ) {
145  *this->m_buffer = copy.get();
146  return *this;
147  }
149  void set( const TYP& item ) { *this->m_buffer = item; }
151  virtual TYP get() const { return *this->m_buffer; }
152  };
153  // ==========================================================================
156  template <class TYP>
157  class GAUDI_API _Array : virtual public _Data<TYP> {
158  public:
160  static _Array* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
161  long len, TYP min, TYP max, TYP def );
163  template <class T>
164  _Array<TYP>& operator=( const _Array<T>& copy ) {
165  long len = this->length();
166  if ( len == copy.length() ) {
167  const T* source = (const T*)copy.buffer();
168  std::copy_n( source, len, this->m_buffer );
169  return *this;
170  }
171  throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
172  return *this;
173  }
175  const TYP& data( long i ) const { return this->m_buffer[i]; }
177  TYP& data( long i ) { return this->m_buffer[i]; }
178 
179  TYP* begin() { return this->m_buffer; }
180  TYP* end() { return this->m_buffer + this->length(); }
181  };
182  // ==========================================================================
185  template <class TYP>
186  class GAUDI_API _Matrix : virtual public _Data<TYP> {
187  protected:
189  long m_rows;
190 
191  public:
193  static _Matrix* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
194  long ncol, long nrow, TYP min, TYP max, TYP def );
196  template <class T>
198  long len = this->length();
199  if ( len == copy.length() ) {
200  const T* source = (const T*)copy.buffer();
201  std::copy_n( source, len, this->m_buffer );
202  return *this;
203  }
204  throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
205  return *this;
206  }
208  TYP* column( long i ) { return this->m_buffer + i * m_rows; }
210  const TYP* column( long i ) const { return this->m_buffer + i * m_rows; }
211  };
212  // ==========================================================================
215  template <class TYP>
216  class _Accessor {
217  friend class Tuple;
218 
219  private:
220  _Accessor<TYP>& operator=( const _Accessor<TYP>& ) { return *this; }
221 
222  protected:
224  mutable TYP* m_ptr = nullptr;
225 
226  public:
228  _Accessor() = default;
230  virtual ~_Accessor() = default;
232  bool operator!() const { return m_ptr != 0; }
234  operator const void*() const { return m_ptr; }
236  TYP* operator->() { return m_ptr; }
238  const TYP* operator->() const { return m_ptr; }
240  const Range<TYP>& range() const { return m_ptr->range(); }
241  };
242  // ==========================================================================
245  template <class TYP>
246  class Item : virtual public _Accessor<_Item<TYP>> {
247  typedef Item<TYP> _My;
248 
249  public:
251  Item() = default;
253  operator const TYP() const { return this->m_ptr->get(); }
255  TYP operator*() { return this->m_ptr->get(); }
257  const TYP operator*() const { return this->m_ptr->get(); }
258  // Arithmetic operators defined on NTuple column entries
259  Item& operator++() { return *this += TYP( 1 ); }
260  Item& operator++( int ) { return *this += TYP( 1 ); }
261  Item& operator--() { return *this -= TYP( 1 ); }
262  Item& operator--( int ) { return *this -= TYP( 1 ); }
264  Item& operator=( const TYP data ) {
265  this->m_ptr->set( data );
266  return *this;
267  }
269  template <class T>
270  Item& operator=( const Item<T>& data ) {
271  this->m_ptr->set( data->get() );
272  return *this;
273  }
274  Item<TYP>& operator+=( const TYP data ) {
275  this->m_ptr->set( this->m_ptr->get() + data );
276  return *this;
277  }
278  Item<TYP>& operator-=( const TYP data ) {
279  this->m_ptr->set( this->m_ptr->get() - data );
280  return *this;
281  }
282  Item<TYP>& operator*=( const TYP data ) {
283  this->m_ptr->set( this->m_ptr->get() * data );
284  return *this;
285  }
286  Item<TYP>& operator/=( const TYP data ) {
287  this->m_ptr->set( this->m_ptr->get() / data );
288  return *this;
289  }
290  };
291  // ==========================================================================
294  template <>
295  class Item<bool> : virtual public _Accessor<_Item<bool>> {
296  typedef Item<bool> _My;
297 
298  public:
300  Item() = default;
302  operator bool() const { return this->m_ptr->get(); }
304  Item& operator=( const bool data ) {
305  this->m_ptr->set( data );
306  return *this;
307  }
309  template <class T>
310  Item& operator=( const Item<T>& data ) {
311  this->m_ptr->set( data->get() );
312  return *this;
313  }
314  };
315  // ==========================================================================
318  template <class TYP>
319  class Array : virtual public _Accessor<_Array<TYP>> {
320  public:
322  Array() = default;
324  template <class T>
325  Array& operator=( const Array<T>& copy ) {
326  *( this->m_ptr ) = *( copy.operator->() );
327  return *this;
328  }
330  template <class T>
331  TYP& operator[]( const T i ) {
332  return this->m_ptr->data( i );
333  }
335  template <class T>
336  const TYP& operator[]( const T i ) const {
337  return this->m_ptr->data( i );
338  }
339 
340  TYP* begin() { return this->m_ptr->begin(); }
341  TYP* end() { return this->m_ptr->end(); }
342  };
343  // =========================================================================
346  template <class TYP>
347  class Matrix : virtual public _Accessor<_Matrix<TYP>> {
348  public:
350  Matrix() = default;
352  template <class T>
353  Matrix& operator=( const Matrix<T>& copy ) {
354  *( this->m_ptr ) = *( copy.operator->() );
355  return *this;
356  }
358  template <class T>
359  TYP* operator[]( const T i ) {
360  return this->m_ptr->column( i );
361  }
363  template <class T>
364  const TYP* operator[]( const T i ) const {
365  return this->m_ptr->column( i );
366  }
367  };
368  // =========================================================================
375  class Tuple : public DataObject, virtual public INTuple {
376 
377  protected:
379  template <class TYPE>
380  StatusCode i_item( const std::string& name, _Item<TYPE>*& result ) const {
381  try {
382  result = dynamic_cast<_Item<TYPE>*>( i_find( name ) );
383  } catch ( ... ) { result = nullptr; }
384  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
385  }
387  template <class TYPE>
388  StatusCode i_item( const std::string& name, _Item<TYPE*>*& result ) const {
389  try {
390  _Item<void*>* p = dynamic_cast<_Item<void*>*>( i_find( name ) );
391  result = (_Item<TYPE*>*)p;
392  } catch ( ... ) { result = nullptr; }
393  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
394  }
397  try {
398  result = dynamic_cast<_Item<IOpaqueAddress*>*>( i_find( name ) );
399  } catch ( ... ) { result = nullptr; }
400  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
401  }
403  template <class TYPE>
404  StatusCode i_item( const std::string& name, _Array<TYPE>*& result ) const {
405  try {
406  if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Array<TYPE>*>( i_find( name ) ); }
407  } catch ( ... ) { result = nullptr; }
408  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
409  }
411  template <class TYPE>
412  StatusCode i_item( const std::string& name, _Matrix<TYPE>*& result ) const {
413  try {
414  if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Matrix<TYPE>*>( i_find( name ) ); }
415  } catch ( ... ) { result = nullptr; }
416  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
417  }
419  template <class TYPE>
420  StatusCode i_addItem( const std::string& name, long, const std::string&, TYPE low, TYPE high,
421  _Item<TYPE>*& result ) {
422  if ( !i_find( name ) ) {
423  TYPE nil;
424  nil = 0;
425  return add( result = _Item<TYPE>::create( this, name, typeid( TYPE ), low, high, nil ) );
426  }
427  return StatusCode::FAILURE;
428  }
430  template <class TYPE>
431  StatusCode i_addItem( const std::string& name, long dim, const std::string& index, TYPE low, TYPE high,
432  _Array<TYPE>*& result ) {
433  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
434  return add( result = _Array<TYPE>::create( this, name, typeid( TYPE ), index, dim, low, high, TYPE( 0 ) ) );
435  }
436  return StatusCode::FAILURE;
437  }
439  template <class TYPE>
440  StatusCode i_addItem( const std::string& name, long dim1, long dim2, const std::string& index, TYPE low, TYPE high,
441  _Matrix<TYPE>*& result ) {
442  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
443  return add( result =
444  _Matrix<TYPE>::create( this, name, typeid( TYPE ), index, dim1, dim2, low, high, TYPE( 0 ) ) );
445  }
446  return StatusCode::FAILURE;
447  }
448  template <class TYPE>
449  StatusCode i_addObject( const std::string& name, _Item<TYPE*>*& result, const std::type_info& /* typ */ ) {
450  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
451  return add( result = (_Item<TYPE*>*)_Item<void*>::create( this, name, typeid( TYPE ), 0, 0, 0 ) );
452  }
453  return StatusCode::FAILURE;
454  }
455 
456  public:
458  template <class TYPE>
460  return i_item( name, result.m_ptr );
461  }
463  template <class TYPE>
464  StatusCode item( const std::string& name, const Item<TYPE>& result ) const {
465  return i_item( name, result.m_ptr );
466  }
468  template <class TYPE>
470  return i_item( name, result.m_ptr );
471  }
473  template <class TYPE>
474  StatusCode item( const std::string& name, const Array<TYPE>& result ) const {
475  return i_item( name, result.m_ptr );
476  }
478  template <class TYPE>
480  return i_item( name, result.m_ptr );
481  }
482 
484  template <class TYPE>
485  StatusCode item( const std::string& name, const Matrix<TYPE>& result ) const {
486  return i_item( name, result.m_ptr );
487  }
488 
502  template <class TYPE>
504  typedef Range<TYPE> _R;
505  return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
506  }
507 
516  template <class TYPE>
518  return i_addObject( name, itm.m_ptr, typeid( TYPE ) );
519  }
520 
530  typedef Range<IOpaqueAddress*> _R;
531  return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
532  }
533 
551  template <class TYPE, class RANGE>
552  StatusCode addItem( const std::string& name, Item<TYPE>& itm, const RANGE low, const RANGE high ) {
553  return i_addItem( name, 1, "", TYPE( low ), TYPE( high ), itm.m_ptr );
554  }
555 
569  template <class TYPE>
571  return i_addItem( name, dim, "", Range<TYPE>::min(), Range<TYPE>::max(), array.m_ptr );
572  }
573 
593  template <class TYPE, class RANGE>
594  StatusCode addItem( const std::string& name, long dim, Array<TYPE>& array, const RANGE low, const RANGE high ) {
595  return i_addItem( name, dim, "", TYPE( low ), TYPE( high ), array.m_ptr );
596  }
597 
628  template <class TYPE, class INDEX, class RANGE>
629  StatusCode addItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array, const RANGE low,
630  const RANGE high ) {
631  return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
632  }
633 
659  template <class TYPE, class INDEX, class RANGE>
661  const RANGE high ) {
662  return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
663  }
664 
689  template <class TYPE, class INDEX>
691  return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
692  array.m_ptr );
693  }
694 
714  template <class TYPE, class INDEX>
716  return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
717  array.m_ptr );
718  }
719 
737  template <class TYPE>
738  StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& matrix ) {
739  return i_addItem( name, cols, rows, "", Range<TYPE>::min(), Range<TYPE>::max(), matrix.m_ptr );
740  }
741 
764  template <class TYPE, class RANGE>
765  StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& result, const RANGE low,
766  const RANGE high ) {
767  return i_addItem( name, cols, rows, "", TYPE( low ), TYPE( high ), result.m_ptr );
768  }
769 
795  template <class TYPE, class INDEX>
796  StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows ) {
797  return i_addItem( name, index->range().distance(), rows, index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
798  matrix.m_ptr );
799  }
800 
821  template <class TYPE, class INDEX>
822  StatusCode addIndexedItem( const std::string& name, Item<INDEX>& col_index, long rows, Matrix<TYPE>& matrix ) {
823  return i_addItem( name, col_index->range().distance(), rows, col_index->name(), Range<TYPE>::min(),
824  Range<TYPE>::max(), matrix.m_ptr );
825  }
826 
859  template <class TYPE, class INDEX, class RANGE>
860  StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows, const RANGE low,
861  const RANGE high ) {
862  return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
863  }
864 
892  template <class TYPE, class INDEX, class RANGE>
893  StatusCode addIndexedItem( const std::string& name, Item<INDEX>& index, long rows, Matrix<TYPE>& matrix,
894  const RANGE low, const RANGE high ) {
895  return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
896  }
897  };
898 
903  static const CLID& classID() { return CLID_NTupleDirectory; }
905  const CLID& clID() const override { return classID(); }
906  };
907 
910  class File : public Directory {
911  protected:
917  long m_type = 0;
919  bool m_isOpen = false;
920 
921  public:
922  File() = default;
925  : m_name( std::move( name ) ), m_logName( std::move( logName ) ), m_type( type ) {}
926 
928  static const CLID& classID() { return CLID_NTupleFile; }
930  const CLID& clID() const override { return classID(); }
932  void setType( const long typ ) { m_type = typ; }
934  long type() const { return m_type; }
936  const std::string& name() const { return m_name; }
938  void setName( std::string nam ) { m_name = std::move( nam ); }
940  const std::string& logicalName() const { return m_logName; }
942  void setLogicalName( std::string l ) { m_logName = std::move( l ); }
944  void setOpen( bool flag ) { m_isOpen = flag; }
946  bool isOpen() const { return m_isOpen; }
947  };
948  // =========================================================================
949  // inhibit certain types by defining specialized templates which do not
950  // allow for construction.
951  template <>
953  Array() = delete;
954 
955  public:
956  virtual ~Array() = default;
957  virtual void dummy() = 0;
958  };
959  template <>
961  Matrix() = delete;
962 
963  public:
964  virtual ~Matrix() = default;
965  virtual void dummy() = 0;
966  };
967 // =========================================================================
968 #ifndef ALLOW_ALL_TYPES
969 #else
970  typedef Item<bool> BoolItem;
971  typedef Item<char> CharItem;
972  typedef Item<unsigned char> UCharItem;
973  typedef Item<short> ShortItem;
974  typedef Item<unsigned short> UShortItem;
975  typedef Item<long> LongItem;
976  typedef Item<long long> LongLongItem;
977  typedef Item<unsigned long> ULongItem;
978  typedef Item<unsigned long long> ULongLongItem;
979  typedef Item<int> IntItem;
980  typedef Item<unsigned int> UIntItem;
981  typedef Item<float> FloatItem;
982  typedef Item<double> DoubleItem;
983  typedef Array<bool> BoolArray;
984  typedef Array<char> CharArray;
985  typedef Array<unsigned char> UCharArray;
986  typedef Array<short> ShortArray;
987  typedef Array<unsigned short> UShortArray;
988  typedef Array<long> LongArray;
989  typedef Array<unsigned long> ULongArray;
990  typedef Array<int> IntArray;
991  typedef Array<unsigned int> UIntArray;
992  typedef Array<float> FloatArray;
993  typedef Array<double> DoubleArray;
994  typedef Matrix<bool> BoolMatrix;
995  typedef Matrix<char> CharMatrix;
996  typedef Matrix<unsigned char> UCharMatrix;
997  typedef Matrix<short> ShortMatrix;
998  typedef Matrix<unsigned short> UShortMatrix;
999  typedef Matrix<long> LongMatrix;
1000  typedef Matrix<unsigned long> ULongMatrix;
1001  typedef Matrix<int> IntMatrix;
1002  typedef Matrix<unsigned int> UIntMatrix;
1003  typedef Matrix<float> FloatMatrix;
1004  typedef Matrix<double> DoubleMatrix;
1005 #endif
1006 
1007  template <class T>
1008  inline std::ostream& operator<<( std::ostream& s, const Item<T>& obj ) {
1009  return s << T( obj );
1010  }
1011 } // end of namespace NTuple
1012 
1013 // Useful:
1017 
1018 #endif // GAUDIKERNEL_NTUPLE_H
StatusCode addItem(const std::string &name, Item< INDEX > &index, Matrix< TYPE > &matrix, long rows, const RANGE low, const RANGE high)
Add an variable size Matrix of data to a column wise N tuple.
Definition: NTuple.h:860
const std::string & name() const
Retrun physical file name.
Definition: NTuple.h:936
bool lower() const
Lower boundary of range.
Definition: NTuple.h:97
Item< bool > _My
Definition: NTuple.h:296
Item< TYP > & operator/=(const TYP data)
Definition: NTuple.h:286
Item< TYP > & operator+=(const TYP data)
Definition: NTuple.h:274
void setOpen(bool flag)
Set "open" flag.
Definition: NTuple.h:944
File(long type, std::string name, std::string logName)
Standard constructor.
Definition: NTuple.h:924
Item & operator--(int)
Definition: NTuple.h:262
TYP m_lower
Lower boundary of range.
Definition: NTuple.h:58
StatusCode addItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array)
Add an indexed Array of data to a column wise N tuple.
Definition: NTuple.h:690
std::string m_logName
Logical file name.
Definition: NTuple.h:915
StatusCode addItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array, const RANGE low, const RANGE high)
Add an indexed Array of data to a column wise N tuple with a range.
Definition: NTuple.h:629
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &index, long rows, Matrix< TYPE > &matrix, const RANGE low, const RANGE high)
Add an variable size Matrix of data to a column wise N tuple.
Definition: NTuple.h:893
Abstract class describing a matrix column in a N tuple.
Definition: NTuple.h:44
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:52
StatusCode i_item(const std::string &name, _Item< TYPE > *&result) const
Locate a _Column of data to the N tuple type safe.
Definition: NTuple.h:380
StatusCode i_addItem(const std::string &name, long dim1, long dim2, const std::string &index, TYPE low, TYPE high, _Matrix< TYPE > *&result)
Add a _Item of data to the N tuple.
Definition: NTuple.h:440
Item & operator++(int)
Definition: NTuple.h:260
Abstract class describing a column in a N tuple.
Definition: NTuple.h:40
Range< TYP > ItemRange
Set type definition to make life more easy easy.
Definition: NTuple.h:127
TYP & operator[](const T i)
Array operator.
Definition: NTuple.h:331
SmartDataPtr< NTuple::File > NTupleFilePtr
Definition: NTuple.h:1016
EventIDBase min(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:202
_Array< TYP > & operator=(const _Array< T > &copy)
Assignment operator.
Definition: NTuple.h:164
TYP * begin()
Definition: NTuple.h:179
StatusCode item(const std::string &name, const Item< TYPE > &result) const
Locate a scalar Item of data to the N tuple type safe (CONST)
Definition: NTuple.h:464
static TYP min()
Minimal number of data.
Definition: NTuple.h:82
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
TYP * operator->()
Dereference operator.
Definition: NTuple.h:236
STL namespace.
StatusCode item(const std::string &name, const Matrix< TYPE > &result) const
Locate a Matrix of data to the N tuple type safe (CONST)
Definition: NTuple.h:485
const TYP operator*() const
Dereference operator for pointers(CONST)
Definition: NTuple.h:257
StatusCode addItem(const std::string &name, long cols, long rows, Matrix< TYPE > &matrix)
Add an fixed size Matrix of data to a column wise N tuple.
Definition: NTuple.h:738
StatusCode item(const std::string &name, const Array< TYPE > &result) const
Locate a Array of data to the N tuple type safe (CONST)
Definition: NTuple.h:474
Item & operator--()
Definition: NTuple.h:261
TYP * column(long i)
Access to data by reference.
Definition: NTuple.h:208
T copy_n(T...args)
_Matrix< TYP > & operator=(const _Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:197
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:215
SmartDataPtr< NTuple::Tuple > NTuplePtr
Definition: NTuple.h:1014
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array, const RANGE low, const RANGE high)
Add an indexed Array of data to a column wise N tuple with a range.
Definition: NTuple.h:660
const Range< TYP > & range() const
Access the range.
Definition: NTuple.h:240
NTuple name space.
Definition: INTupleSvc.h:9
virtual TYP get() const
Access to data by reference (CONST)
Definition: NTuple.h:151
long type() const
Return access type.
Definition: NTuple.h:934
StatusCode addItem(const std::string &name, Item< INDEX > &index, Matrix< TYPE > &matrix, long rows)
Add an variable size Matrix of data to a column wise N tuple.
Definition: NTuple.h:796
static const CLID & classID()
class ID of the object
Definition: NTuple.h:928
STL class.
NTuple interface class definition.
Definition: INTuple.h:81
Matrix & operator=(const Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:353
const TYP * operator[](const T i) const
Array operator.
Definition: NTuple.h:364
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &col_index, long rows, Matrix< TYPE > &matrix)
Add an variable size Matrix of data to a column wise N tuple.
Definition: NTuple.h:822
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array)
Add an indexed Array of data to a column wise N tuple.
Definition: NTuple.h:715
StatusCode i_item(const std::string &name, _Matrix< TYPE > *&result) const
Locate a _Matrix of data to the N tuple type safe.
Definition: NTuple.h:412
Item< TYP > & operator-=(const TYP data)
Definition: NTuple.h:278
NTuple interface class definition.
Definition: INTuple.h:27
static const CLID & classID()
class ID of the object
Definition: NTuple.h:903
Class acting as a smart pointer holding a N tuple entry.
Definition: NTuple.h:46
virtual long length() const =0
Access the buffer length.
static bool max()
Maximal number of data.
Definition: NTuple.h:105
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
_Item< TYP > & operator=(const _Item< T > &copy)
Assignment operator.
Definition: NTuple.h:144
virtual ~Range()=default
Destructor.
StatusCode addItem(const std::string &name, Item< TYPE > &itm, const RANGE low, const RANGE high)
Add a scalar data item a N tuple with a range.
Definition: NTuple.h:552
void setName(std::string nam)
Set access type.
Definition: NTuple.h:938
StatusCode addItem(const std::string &name, long cols, long rows, Matrix< TYPE > &result, const RANGE low, const RANGE high)
Add an fixed size Matrix of data to a column wise N tuple.
Definition: NTuple.h:765
void setLogicalName(std::string l)
Definition: NTuple.h:942
static TYP max()
Maximal number of data.
Definition: NTuple.h:84
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:310
bool upper() const
Upper boundary of range.
Definition: NTuple.h:99
std::string m_name
Physical file name.
Definition: NTuple.h:913
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
StatusCode i_addObject(const std::string &name, _Item< TYPE * > *&result, const std::type_info &)
Definition: NTuple.h:449
Specialization acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:295
StatusCode addItem(const std::string &name, long dim, Array< TYPE > &array)
Add an fixed-size Array of data to a column wise N tuple.
Definition: NTuple.h:570
TYP upper() const
Upper boundary of range.
Definition: NTuple.h:78
Abstract class describing basic data in an Ntuple.
Definition: NTuple.h:38
bool isOpen() const
Access "open" flag.
Definition: NTuple.h:946
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
StatusCode addItem(const std::string &name, Item< IOpaqueAddress * > &itm)
Add an address object item to an N tuple: specialized call.
Definition: NTuple.h:529
Range(const Range< TYP > &copy)
Copy constructor.
Definition: NTuple.h:66
T move(T...args)
const TYP & operator[](const T i) const
Array operator.
Definition: NTuple.h:336
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:375
bool operator!() const
Check if column is present.
Definition: NTuple.h:232
void setType(const long typ)
Set access type.
Definition: NTuple.h:932
dictionary l
Definition: gaudirun.py:517
virtual const void * buffer() const =0
Access data buffer (CONST)
std::vector< Row > Matrix
Definition: Vector.h:20
TYP * end()
Definition: NTuple.h:341
TYP distance() const
Distance between lower and upper range.
Definition: NTuple.h:80
_Item< TYP > * m_ptr
Pointer to instance.
Definition: NTuple.h:224
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
StatusCode addItem(const std::string &name, Item< TYPE * > &itm)
Add an simple object item to an N tuple.
Definition: NTuple.h:517
const TYP * column(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:210
StatusCode i_addItem(const std::string &name, long dim, const std::string &index, TYPE low, TYPE high, _Array< TYPE > *&result)
Add a _Item of data to the N tuple.
Definition: NTuple.h:431
Item< TYP > _My
Definition: NTuple.h:247
Item & operator=(const bool data)
Assignment operator.
Definition: NTuple.h:304
StatusCode item(const std::string &name, Array< TYPE > &result)
Locate a Array of data to the N tuple type safe.
Definition: NTuple.h:469
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:270
TYP * begin()
Definition: NTuple.h:340
const TYP & data(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:175
TYP * operator[](const T i)
Array operator.
Definition: NTuple.h:359
Item & operator=(const TYP data)
Assignment operator.
Definition: NTuple.h:264
string s
Definition: gaudirun.py:312
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataPtr.h:47
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:503
constexpr static const auto FAILURE
Definition: StatusCode.h:86
long m_rows
Number of rows per column.
Definition: NTuple.h:189
TYP m_upper
Upper boundary of range.
Definition: NTuple.h:60
Class defining a range.
Definition: NTuple.h:36
Range(const Range< bool > &)
Copy constructor.
Definition: NTuple.h:93
SmartDataPtr< NTuple::Directory > NTupleDirPtr
Definition: NTuple.h:1015
Item< TYP > & operator*=(const TYP data)
Definition: NTuple.h:282
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:901
Array & operator=(const Array< T > &copy)
Assignment operator.
Definition: NTuple.h:325
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:905
const TYP * operator->() const
Dereference operator (CONST)
Definition: NTuple.h:238
Range(const bool, const bool)
Standard constructor.
Definition: NTuple.h:91
StatusCode item(const std::string &name, Item< TYPE > &result)
Locate a scalar Item of data to the N tuple type safe.
Definition: NTuple.h:459
Opaque address interface definition.
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:930
StatusCode i_item(const std::string &name, _Item< TYPE * > *&result) const
Locate a _Column of data to the N tuple type unsafe for objects.
Definition: NTuple.h:388
StatusCode addItem(const std::string &name, long dim, Array< TYPE > &array, const RANGE low, const RANGE high)
Add an fixed-size Array of data to a column wise N tuple with a range.
Definition: NTuple.h:594
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:48
KeyedObjectManager< array > Array
Forward declaration of specialized redirection array object manager.
StatusCode i_item(const std::string &name, _Item< IOpaqueAddress * > *&result) const
Locate a _Column of data to the N tuple type safe.
Definition: NTuple.h:396
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:50
static bool min()
Minimal number of data.
Definition: NTuple.h:103
#define GAUDI_API
Definition: Kernel.h:71
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
_Accessor< TYP > & operator=(const _Accessor< TYP > &)
Definition: NTuple.h:220
bool distance() const
Distance between lower and upper range.
Definition: NTuple.h:101
TYP * end()
Definition: NTuple.h:180
Item & operator++()
Definition: NTuple.h:259
STL class.
StatusCode item(const std::string &name, Matrix< TYPE > &result)
Locate a Matrix of data to the N tuple type safe.
Definition: NTuple.h:479
const std::string & logicalName() const
Definition: NTuple.h:940
TYP operator*()
Dereference operator for pointers.
Definition: NTuple.h:255
TYP lower() const
Lower boundary of range.
Definition: NTuple.h:76
StatusCode i_item(const std::string &name, _Array< TYPE > *&result) const
Locate a _Array of data to the N tuple type safe.
Definition: NTuple.h:404
StatusCode i_addItem(const std::string &name, long, const std::string &, TYPE low, TYPE high, _Item< TYPE > *&result)
Add a _Item of data to the N tuple.
Definition: NTuple.h:420
TYP & data(long i)
Access to data by reference (CONST)
Definition: NTuple.h:177
Range & operator=(const Range< TYP > &copy)
Adjust ranges.
Definition: NTuple.h:68
Small class representing an N tuple file in the transient store.
Definition: NTuple.h:910
Range(TYP low, TYP upper)
Standard constructor.
Definition: NTuple.h:64
Abstract class describing a column-array in a N tuple.
Definition: NTuple.h:42