The Gaudi Framework  v29r0 (ff2e7097)
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 {
35  // local forward declarations
36  template <class TYP>
37  class Range;
38  template <class TYP>
39  class _Data;
40  template <class TYP>
41  class _Item;
42  template <class TYP>
43  class _Array;
44  template <class TYP>
45  class _Matrix;
46  template <class TYP>
47  class _Accessor;
48  template <class TYP>
49  class Item;
50  template <class TYP>
51  class Array;
52  template <class TYP>
53  class Matrix;
54  // ==========================================================================
56  template <class TYP>
57  class Range
58  {
60  /*const*/ TYP m_lower;
62  /*const*/ TYP m_upper;
63 
64  public:
66  Range( TYP low, TYP upper ) : m_lower( std::move( low ) ), m_upper( std::move( upper ) ) {}
68  Range( const Range<TYP>& copy ) : m_lower( copy.m_lower ), m_upper( copy.m_upper ) {}
70  Range& operator=( const Range<TYP>& copy )
71  {
72  m_lower = copy.m_lower;
73  m_upper = copy.m_upper;
74  return *this;
75  }
77  virtual ~Range() = default;
79  TYP lower() const { return m_lower; }
81  TYP upper() const { return m_upper; }
83  TYP distance() const { return m_upper - m_lower; }
85  static TYP min() { return std::numeric_limits<TYP>::min(); }
87  static TYP max() { return std::numeric_limits<TYP>::max(); }
88  };
89  // ==========================================================================
90  template <>
91  class Range<bool>
92  {
93  public:
95  Range( const bool /* low */, const bool /* upper */ ) {}
97  Range( const Range<bool>& /* copy */ ) {}
99  virtual ~Range() = default;
101  bool lower() const { return false; }
103  bool upper() const { return true; }
105  bool distance() const { return true; }
107  static bool min() { return false; }
109  static bool max() { return true; }
110  };
111  // ==========================================================================
112  template <>
114  {
115  return (IOpaqueAddress*)0x0;
116  }
117  template <>
119  {
120  return (IOpaqueAddress*)0xffffffff;
121  }
122  // ==========================================================================
125  template <class TYP>
126  class GAUDI_API _Data : virtual public INTupleItem
127  {
128  protected:
130  TYP* m_buffer = nullptr;
131 
132  public:
136  virtual void setDefault( const TYP d ) = 0;
138  virtual const ItemRange& range() const = 0;
139  };
140  // ==========================================================================
143  template <class TYP>
144  class GAUDI_API _Item : virtual public _Data<TYP>
145  {
146  public:
148  ~_Item() override = default;
150  static _Item* create( INTuple* tup, const std::string& name, const std::type_info& info, TYP min, TYP max,
151  TYP def );
153  template <class T>
154  _Item<TYP>& operator=( const _Item<T>& copy )
155  {
156  *this->m_buffer = copy.get();
157  return *this;
158  }
160  void set( const TYP& item ) { *this->m_buffer = item; }
162  virtual TYP get() const { return *this->m_buffer; }
163  };
164  // ==========================================================================
167  template <class TYP>
168  class GAUDI_API _Array : virtual public _Data<TYP>
169  {
170  public:
172  static _Array* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
173  long len, TYP min, TYP max, TYP def );
175  template <class T>
177  {
178  long len = this->length();
179  if ( len == copy.length() ) {
180  const T* source = (const T*)copy.buffer();
181  std::copy_n( source, len, this->m_buffer );
182  return *this;
183  }
184  throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
185  return *this;
186  }
188  const TYP& data( long i ) const { return this->m_buffer[i]; }
190  TYP& data( long i ) { return this->m_buffer[i]; }
191 
192  TYP* begin() { return this->m_buffer; }
193  TYP* end() { return this->m_buffer + this->length(); }
194  };
195  // ==========================================================================
198  template <class TYP>
199  class GAUDI_API _Matrix : virtual public _Data<TYP>
200  {
201  protected:
203  long m_rows;
204 
205  public:
207  static _Matrix* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
208  long ncol, long nrow, TYP min, TYP max, TYP def );
210  template <class T>
212  {
213  long len = this->length();
214  if ( len == copy.length() ) {
215  const T* source = (const T*)copy.buffer();
216  std::copy_n( source, len, this->m_buffer );
217  return *this;
218  }
219  throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
220  return *this;
221  }
223  TYP* column( long i ) { return this->m_buffer + i * m_rows; }
225  const TYP* column( long i ) const { return this->m_buffer + i * m_rows; }
226  };
227  // ==========================================================================
230  template <class TYP>
231  class _Accessor
232  {
233  friend class Tuple;
234 
235  private:
236  _Accessor<TYP>& operator=( const _Accessor<TYP>& ) { return *this; }
237 
238  protected:
240  mutable TYP* m_ptr = nullptr;
241 
242  public:
244  _Accessor() = default;
246  virtual ~_Accessor() = default;
248  bool operator!() const { return m_ptr != 0; }
250  operator const void*() const { return m_ptr; }
252  TYP* operator->() { return m_ptr; }
254  const TYP* operator->() const { return m_ptr; }
256  const Range<TYP>& range() const { return m_ptr->range(); }
257  };
258  // ==========================================================================
261  template <class TYP>
262  class Item : virtual public _Accessor<_Item<TYP>>
263  {
264  typedef Item<TYP> _My;
265 
266  public:
268  Item() = default;
270  operator const TYP() const { return this->m_ptr->get(); }
272  TYP operator*() { return this->m_ptr->get(); }
274  const TYP operator*() const { return this->m_ptr->get(); }
275  // Arithmetic operators defined on NTuple column entries
276  Item& operator++() { return *this += TYP( 1 ); }
277  Item& operator++( int ) { return *this += TYP( 1 ); }
278  Item& operator--() { return *this -= TYP( 1 ); }
279  Item& operator--( int ) { return *this -= TYP( 1 ); }
281  Item& operator=( const TYP data )
282  {
283  this->m_ptr->set( data );
284  return *this;
285  }
287  template <class T>
288  Item& operator=( const Item<T>& data )
289  {
290  this->m_ptr->set( data->get() );
291  return *this;
292  }
293  Item<TYP>& operator+=( const TYP data )
294  {
295  this->m_ptr->set( this->m_ptr->get() + data );
296  return *this;
297  }
298  Item<TYP>& operator-=( const TYP data )
299  {
300  this->m_ptr->set( this->m_ptr->get() - data );
301  return *this;
302  }
303  Item<TYP>& operator*=( const TYP data )
304  {
305  this->m_ptr->set( this->m_ptr->get() * data );
306  return *this;
307  }
308  Item<TYP>& operator/=( const TYP data )
309  {
310  this->m_ptr->set( this->m_ptr->get() / data );
311  return *this;
312  }
313  };
314  // ==========================================================================
317  template <>
318  class Item<bool> : virtual public _Accessor<_Item<bool>>
319  {
320  typedef Item<bool> _My;
321 
322  public:
324  Item() = default;
326  operator bool() const { return this->m_ptr->get(); }
328  Item& operator=( const bool data )
329  {
330  this->m_ptr->set( data );
331  return *this;
332  }
334  template <class T>
335  Item& operator=( const Item<T>& data )
336  {
337  this->m_ptr->set( data->get() );
338  return *this;
339  }
340  };
341  // ==========================================================================
344  template <class TYP>
345  class Array : virtual public _Accessor<_Array<TYP>>
346  {
347  public:
349  Array() = default;
351  template <class T>
352  Array& operator=( const Array<T>& copy )
353  {
354  *( this->m_ptr ) = *( copy.operator->() );
355  return *this;
356  }
358  template <class T>
359  TYP& operator[]( const T i )
360  {
361  return this->m_ptr->data( i );
362  }
364  template <class T>
365  const TYP& operator[]( const T i ) const
366  {
367  return this->m_ptr->data( i );
368  }
369 
370  TYP* begin() { return this->m_ptr->begin(); }
371  TYP* end() { return this->m_ptr->end(); }
372 
373  ~Array() override = default;
374  };
375  // =========================================================================
378  template <class TYP>
379  class Matrix : virtual public _Accessor<_Matrix<TYP>>
380  {
381  public:
383  Matrix() = default;
385  template <class T>
386  Matrix& operator=( const Matrix<T>& copy )
387  {
388  *( this->m_ptr ) = *( copy.operator->() );
389  return *this;
390  }
392  template <class T>
393  TYP* operator[]( const T i )
394  {
395  return this->m_ptr->column( i );
396  }
398  template <class T>
399  const TYP* operator[]( const T i ) const
400  {
401  return this->m_ptr->column( i );
402  }
403  ~Matrix() override = default;
404  };
405  // =========================================================================
412  class Tuple : public DataObject, virtual public INTuple
413  {
414 
415  protected:
417  template <class TYPE>
418  StatusCode i_item( const std::string& name, _Item<TYPE>*& result ) const
419  {
420  try {
421  result = dynamic_cast<_Item<TYPE>*>( i_find( name ) );
422  } catch ( ... ) {
423  result = nullptr;
424  }
425  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
426  }
428  template <class TYPE>
429  StatusCode i_item( const std::string& name, _Item<TYPE*>*& result ) const
430  {
431  try {
432  _Item<void*>* p = dynamic_cast<_Item<void*>*>( i_find( name ) );
433  result = (_Item<TYPE*>*)p;
434  } catch ( ... ) {
435  result = nullptr;
436  }
437  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
438  }
441  {
442  try {
443  result = dynamic_cast<_Item<IOpaqueAddress*>*>( i_find( name ) );
444  } catch ( ... ) {
445  result = nullptr;
446  }
447  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
448  }
450  template <class TYPE>
451  StatusCode i_item( const std::string& name, _Array<TYPE>*& result ) const
452  {
453  try {
454  if ( clID() == CLID_ColumnWiseTuple ) {
455  result = dynamic_cast<_Array<TYPE>*>( i_find( name ) );
456  }
457  } catch ( ... ) {
458  result = nullptr;
459  }
460  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
461  }
463  template <class TYPE>
464  StatusCode i_item( const std::string& name, _Matrix<TYPE>*& result ) const
465  {
466  try {
467  if ( clID() == CLID_ColumnWiseTuple ) {
468  result = dynamic_cast<_Matrix<TYPE>*>( i_find( name ) );
469  }
470  } catch ( ... ) {
471  result = nullptr;
472  }
473  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
474  }
476  template <class TYPE>
477  StatusCode i_addItem( const std::string& name, long, const std::string&, TYPE low, TYPE high, _Item<TYPE>*& result )
478  {
479  if ( !i_find( name ) ) {
480  TYPE nil;
481  nil = 0;
482  return add( result = _Item<TYPE>::create( this, name, typeid( TYPE ), low, high, nil ) );
483  }
484  return StatusCode::FAILURE;
485  }
487  template <class TYPE>
488  StatusCode i_addItem( const std::string& name, long dim, const std::string& index, TYPE low, TYPE high,
489  _Array<TYPE>*& result )
490  {
491  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
492  return add( result = _Array<TYPE>::create( this, name, typeid( TYPE ), index, dim, low, high, TYPE( 0 ) ) );
493  }
494  return StatusCode::FAILURE;
495  }
497  template <class TYPE>
498  StatusCode i_addItem( const std::string& name, long dim1, long dim2, const std::string& index, TYPE low, TYPE high,
499  _Matrix<TYPE>*& result )
500  {
501  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
502  return add( result =
503  _Matrix<TYPE>::create( this, name, typeid( TYPE ), index, dim1, dim2, low, high, TYPE( 0 ) ) );
504  }
505  return StatusCode::FAILURE;
506  }
507  template <class TYPE>
508  StatusCode i_addObject( const std::string& name, _Item<TYPE*>*& result, const std::type_info& /* typ */ )
509  {
510  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
511  return add( result = (_Item<TYPE*>*)_Item<void*>::create( this, name, typeid( TYPE ), 0, 0, 0 ) );
512  }
513  return StatusCode::FAILURE;
514  }
515 
516  public:
518  ~Tuple() override = default;
519 
521  template <class TYPE>
523  {
524  return i_item( name, result.m_ptr );
525  }
527  template <class TYPE>
528  StatusCode item( const std::string& name, const Item<TYPE>& result ) const
529  {
530  return i_item( name, result.m_ptr );
531  }
533  template <class TYPE>
535  {
536  return i_item( name, result.m_ptr );
537  }
539  template <class TYPE>
540  StatusCode item( const std::string& name, const Array<TYPE>& result ) const
541  {
542  return i_item( name, result.m_ptr );
543  }
545  template <class TYPE>
547  {
548  return i_item( name, result.m_ptr );
549  }
550 
552  template <class TYPE>
553  StatusCode item( const std::string& name, const Matrix<TYPE>& result ) const
554  {
555  return i_item( name, result.m_ptr );
556  }
557 
571  template <class TYPE>
573  {
574  typedef Range<TYPE> _R;
575  return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
576  }
577 
586  template <class TYPE>
588  {
589  return i_addObject( name, itm.m_ptr, typeid( TYPE ) );
590  }
591 
601  {
602  typedef Range<IOpaqueAddress*> _R;
603  return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
604  }
605 
623  template <class TYPE, class RANGE>
624  StatusCode addItem( const std::string& name, Item<TYPE>& itm, const RANGE low, const RANGE high )
625  {
626  return i_addItem( name, 1, "", TYPE( low ), TYPE( high ), itm.m_ptr );
627  }
628 
642  template <class TYPE>
644  {
645  return i_addItem( name, dim, "", Range<TYPE>::min(), Range<TYPE>::max(), array.m_ptr );
646  }
647 
667  template <class TYPE, class RANGE>
668  StatusCode addItem( const std::string& name, long dim, Array<TYPE>& array, const RANGE low, const RANGE high )
669  {
670  return i_addItem( name, dim, "", TYPE( low ), TYPE( high ), array.m_ptr );
671  }
672 
703  template <class TYPE, class INDEX, class RANGE>
704  StatusCode addItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array, const RANGE low,
705  const RANGE high )
706  {
707  return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
708  }
709 
735  template <class TYPE, class INDEX, class RANGE>
737  const RANGE high )
738  {
739  return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
740  }
741 
766  template <class TYPE, class INDEX>
768  {
769  return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
770  array.m_ptr );
771  }
772 
792  template <class TYPE, class INDEX>
794  {
795  return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
796  array.m_ptr );
797  }
798 
816  template <class TYPE>
817  StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& matrix )
818  {
819  return i_addItem( name, cols, rows, "", Range<TYPE>::min(), Range<TYPE>::max(), matrix.m_ptr );
820  }
821 
844  template <class TYPE, class RANGE>
845  StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& result, const RANGE low,
846  const RANGE high )
847  {
848  return i_addItem( name, cols, rows, "", TYPE( low ), TYPE( high ), result.m_ptr );
849  }
850 
876  template <class TYPE, class INDEX>
878  {
879  return i_addItem( name, index->range().distance(), rows, index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
880  matrix.m_ptr );
881  }
882 
903  template <class TYPE, class INDEX>
905  {
906  return i_addItem( name, col_index->range().distance(), rows, col_index->name(), Range<TYPE>::min(),
907  Range<TYPE>::max(), matrix.m_ptr );
908  }
909 
942  template <class TYPE, class INDEX, class RANGE>
943  StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows, const RANGE low,
944  const RANGE high )
945  {
946  return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
947  }
948 
976  template <class TYPE, class INDEX, class RANGE>
978  const RANGE low, const RANGE high )
979  {
980  return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
981  }
982  };
983 
986  class Directory : public DataObject
987  {
988  public:
992  ~Directory() override = default;
993 
995  static const CLID& classID() { return CLID_NTupleDirectory; }
997  const CLID& clID() const override { return classID(); }
998  };
999 
1002  class File : public Directory
1003  {
1004  protected:
1010  long m_type = 0;
1012  bool m_isOpen = false;
1013 
1014  public:
1015  File() = default;
1018  : m_name( std::move( name ) ), m_logName( std::move( logName ) ), m_type( type )
1019  {
1020  }
1022  ~File() override = default;
1023 
1025  static const CLID& classID() { return CLID_NTupleFile; }
1027  const CLID& clID() const override { return classID(); }
1029  void setType( const long typ ) { m_type = typ; }
1031  long type() const { return m_type; }
1033  const std::string& name() const { return m_name; }
1035  void setName( std::string nam ) { m_name = std::move( nam ); }
1037  const std::string& logicalName() const { return m_logName; }
1039  void setLogicalName( std::string l ) { m_logName = std::move( l ); }
1041  void setOpen( bool flag ) { m_isOpen = flag; }
1043  bool isOpen() const { return m_isOpen; }
1044  };
1045  // =========================================================================
1046  // inhibit certain types by defining specialized templates which do not
1047  // allow for construction.
1048  template <>
1050  {
1051  Array() = delete;
1052 
1053  public:
1054  virtual ~Array() = default;
1055  virtual void dummy() = 0;
1056  };
1057  template <>
1059  {
1060  Matrix() = delete;
1061 
1062  public:
1063  virtual ~Matrix() = default;
1064  virtual void dummy() = 0;
1065  };
1066 // =========================================================================
1067 #ifndef ALLOW_ALL_TYPES
1068 #else
1069  typedef Item<bool> BoolItem;
1070  typedef Item<char> CharItem;
1071  typedef Item<unsigned char> UCharItem;
1072  typedef Item<short> ShortItem;
1073  typedef Item<unsigned short> UShortItem;
1074  typedef Item<long> LongItem;
1075  typedef Item<long long> LongLongItem;
1076  typedef Item<unsigned long> ULongItem;
1077  typedef Item<unsigned long long> ULongLongItem;
1078  typedef Item<int> IntItem;
1079  typedef Item<unsigned int> UIntItem;
1080  typedef Item<float> FloatItem;
1081  typedef Item<double> DoubleItem;
1082  typedef Array<bool> BoolArray;
1083  typedef Array<char> CharArray;
1084  typedef Array<unsigned char> UCharArray;
1085  typedef Array<short> ShortArray;
1086  typedef Array<unsigned short> UShortArray;
1087  typedef Array<long> LongArray;
1088  typedef Array<unsigned long> ULongArray;
1089  typedef Array<int> IntArray;
1090  typedef Array<unsigned int> UIntArray;
1091  typedef Array<float> FloatArray;
1092  typedef Array<double> DoubleArray;
1093  typedef Matrix<bool> BoolMatrix;
1094  typedef Matrix<char> CharMatrix;
1095  typedef Matrix<unsigned char> UCharMatrix;
1096  typedef Matrix<short> ShortMatrix;
1097  typedef Matrix<unsigned short> UShortMatrix;
1098  typedef Matrix<long> LongMatrix;
1099  typedef Matrix<unsigned long> ULongMatrix;
1100  typedef Matrix<int> IntMatrix;
1101  typedef Matrix<unsigned int> UIntMatrix;
1102  typedef Matrix<float> FloatMatrix;
1103  typedef Matrix<double> DoubleMatrix;
1104 #endif
1105 
1106  template <class T>
1107  inline std::ostream& operator<<( std::ostream& s, const Item<T>& obj )
1108  {
1109  return s << T( obj );
1110  }
1111 } // end of namespace NTuple
1112 
1113 // Useful:
1117 
1118 #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:943
const std::string & name() const
Retrun physical file name.
Definition: NTuple.h:1033
bool lower() const
Lower boundary of range.
Definition: NTuple.h:101
Item< bool > _My
Definition: NTuple.h:320
Item< TYP > & operator/=(const TYP data)
Definition: NTuple.h:308
Item< TYP > & operator+=(const TYP data)
Definition: NTuple.h:293
void setOpen(bool flag)
Set "open" flag.
Definition: NTuple.h:1041
File(long type, std::string name, std::string logName)
Standard constructor.
Definition: NTuple.h:1017
Item & operator--(int)
Definition: NTuple.h:279
TYP m_lower
Lower boundary of range.
Definition: NTuple.h:60
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:767
std::string m_logName
Logical file name.
Definition: NTuple.h:1008
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:704
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:977
Abstract class describing a matrix column in a N tuple.
Definition: NTuple.h:45
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:53
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:418
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:498
Item & operator++(int)
Definition: NTuple.h:277
Abstract class describing a column in a N tuple.
Definition: NTuple.h:41
Range< TYP > ItemRange
Set type definition to make life more easy easy.
Definition: NTuple.h:134
TYP & operator[](const T i)
Array operator.
Definition: NTuple.h:359
SmartDataPtr< NTuple::File > NTupleFilePtr
Definition: NTuple.h:1116
_Array< TYP > & operator=(const _Array< T > &copy)
Assignment operator.
Definition: NTuple.h:176
TYP * begin()
Definition: NTuple.h:192
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:528
static TYP min()
Minimal number of data.
Definition: NTuple.h:85
TYP * operator->()
Dereference operator.
Definition: NTuple.h:252
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:553
const TYP operator*() const
Dereference operator for pointers(CONST)
Definition: NTuple.h:274
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:817
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:540
Item & operator--()
Definition: NTuple.h:278
TYP * column(long i)
Access to data by reference.
Definition: NTuple.h:223
T copy_n(T...args)
_Matrix< TYP > & operator=(const _Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:211
SmartDataPtr< NTuple::Tuple > NTuplePtr
Definition: NTuple.h:1114
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:736
const Range< TYP > & range() const
Access the range.
Definition: NTuple.h:256
NTuple name space.
Definition: INTupleSvc.h:9
virtual TYP get() const
Access to data by reference (CONST)
Definition: NTuple.h:162
long type() const
Return access type.
Definition: NTuple.h:1031
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:877
static const CLID & classID()
class ID of the object
Definition: NTuple.h:1025
STL class.
NTuple interface class definition.
Definition: INTuple.h:82
Matrix & operator=(const Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:386
const TYP * operator[](const T i) const
Array operator.
Definition: NTuple.h:399
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:904
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:793
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:464
Item< TYP > & operator-=(const TYP data)
Definition: NTuple.h:298
NTuple interface class definition.
Definition: INTuple.h:27
Class acting as a smart pointer holding a N tuple entry.
Definition: NTuple.h:47
virtual long length() const =0
Access the buffer length.
static bool max()
Maximal number of data.
Definition: NTuple.h:109
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
_Item< TYP > & operator=(const _Item< T > &copy)
Assignment operator.
Definition: NTuple.h:154
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:624
void setName(std::string nam)
Set access type.
Definition: NTuple.h:1035
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:845
void setLogicalName(std::string l)
Definition: NTuple.h:1039
static TYP max()
Maximal number of data.
Definition: NTuple.h:87
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:335
bool upper() const
Upper boundary of range.
Definition: NTuple.h:103
std::string m_name
Physical file name.
Definition: NTuple.h:1006
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:508
Specialization acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:318
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:643
TYP upper() const
Upper boundary of range.
Definition: NTuple.h:81
Abstract class describing basic data in an Ntuple.
Definition: NTuple.h:39
bool isOpen() const
Access "open" flag.
Definition: NTuple.h:1043
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:600
Range(const Range< TYP > &copy)
Copy constructor.
Definition: NTuple.h:68
T move(T...args)
const TYP & operator[](const T i) const
Array operator.
Definition: NTuple.h:365
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:412
bool operator!() const
Check if column is present.
Definition: NTuple.h:248
void setType(const long typ)
Set access type.
Definition: NTuple.h:1029
dictionary l
Definition: gaudirun.py:440
virtual const void * buffer() const =0
Access data buffer (CONST)
std::vector< Row > Matrix
Definition: Vector.h:21
TYP * end()
Definition: NTuple.h:371
TYP distance() const
Distance between lower and upper range.
Definition: NTuple.h:83
_Item< TYP > * m_ptr
Pointer to instance.
Definition: NTuple.h:240
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:587
const TYP * column(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:225
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:488
Item< TYP > _My
Definition: NTuple.h:264
Item & operator=(const bool data)
Assignment operator.
Definition: NTuple.h:328
StatusCode item(const std::string &name, Array< TYPE > &result)
Locate a Array of data to the N tuple type safe.
Definition: NTuple.h:534
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:288
TYP * begin()
Definition: NTuple.h:370
const TYP & data(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:188
TYP * operator[](const T i)
Array operator.
Definition: NTuple.h:393
Item & operator=(const TYP data)
Assignment operator.
Definition: NTuple.h:281
string s
Definition: gaudirun.py:253
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:572
long m_rows
Number of rows per column.
Definition: NTuple.h:203
TYP m_upper
Upper boundary of range.
Definition: NTuple.h:62
Class defining a range.
Definition: NTuple.h:37
Range(const Range< bool > &)
Copy constructor.
Definition: NTuple.h:97
SmartDataPtr< NTuple::Directory > NTupleDirPtr
Definition: NTuple.h:1115
Item< TYP > & operator*=(const TYP data)
Definition: NTuple.h:303
Array & operator=(const Array< T > &copy)
Assignment operator.
Definition: NTuple.h:352
const TYP * operator->() const
Dereference operator (CONST)
Definition: NTuple.h:254
Range(const bool, const bool)
Standard constructor.
Definition: NTuple.h:95
StatusCode item(const std::string &name, Item< TYPE > &result)
Locate a scalar Item of data to the N tuple type safe.
Definition: NTuple.h:522
Directory()
Standard constructor.
Definition: NTuple.h:990
Opaque address interface definition.
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:1027
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:429
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:668
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:49
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:440
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:51
static bool min()
Minimal number of data.
Definition: NTuple.h:107
#define GAUDI_API
Definition: Kernel.h:110
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:986
_Accessor< TYP > & operator=(const _Accessor< TYP > &)
Definition: NTuple.h:236
bool distance() const
Distance between lower and upper range.
Definition: NTuple.h:105
TYP * end()
Definition: NTuple.h:193
Item & operator++()
Definition: NTuple.h:276
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:546
const std::string & logicalName() const
Definition: NTuple.h:1037
TYP operator*()
Dereference operator for pointers.
Definition: NTuple.h:272
TYP lower() const
Lower boundary of range.
Definition: NTuple.h:79
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:451
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:477
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:997
TYP & data(long i)
Access to data by reference (CONST)
Definition: NTuple.h:190
Range & operator=(const Range< TYP > &copy)
Adjust ranges.
Definition: NTuple.h:70
Small class representing an N tuple file in the transient store.
Definition: NTuple.h:1002
static const CLID & classID()
class ID of the object
Definition: NTuple.h:995
Range(TYP low, TYP upper)
Standard constructor.
Definition: NTuple.h:66
Abstract class describing a column-array in a N tuple.
Definition: NTuple.h:43