The Gaudi Framework  v30r3 (a5ef0a68)
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  static _Item* create( INTuple* tup, const std::string& name, const std::type_info& info, TYP min, TYP max,
149  TYP def );
151  template <class T>
152  _Item<TYP>& operator=( const _Item<T>& copy )
153  {
154  *this->m_buffer = copy.get();
155  return *this;
156  }
158  void set( const TYP& item ) { *this->m_buffer = item; }
160  virtual TYP get() const { return *this->m_buffer; }
161  };
162  // ==========================================================================
165  template <class TYP>
166  class GAUDI_API _Array : virtual public _Data<TYP>
167  {
168  public:
170  static _Array* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
171  long len, TYP min, TYP max, TYP def );
173  template <class T>
175  {
176  long len = this->length();
177  if ( len == copy.length() ) {
178  const T* source = (const T*)copy.buffer();
179  std::copy_n( source, len, this->m_buffer );
180  return *this;
181  }
182  throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
183  return *this;
184  }
186  const TYP& data( long i ) const { return this->m_buffer[i]; }
188  TYP& data( long i ) { return this->m_buffer[i]; }
189 
190  TYP* begin() { return this->m_buffer; }
191  TYP* end() { return this->m_buffer + this->length(); }
192  };
193  // ==========================================================================
196  template <class TYP>
197  class GAUDI_API _Matrix : virtual public _Data<TYP>
198  {
199  protected:
201  long m_rows;
202 
203  public:
205  static _Matrix* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
206  long ncol, long nrow, TYP min, TYP max, TYP def );
208  template <class T>
210  {
211  long len = this->length();
212  if ( len == copy.length() ) {
213  const T* source = (const T*)copy.buffer();
214  std::copy_n( source, len, this->m_buffer );
215  return *this;
216  }
217  throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
218  return *this;
219  }
221  TYP* column( long i ) { return this->m_buffer + i * m_rows; }
223  const TYP* column( long i ) const { return this->m_buffer + i * m_rows; }
224  };
225  // ==========================================================================
228  template <class TYP>
229  class _Accessor
230  {
231  friend class Tuple;
232 
233  private:
234  _Accessor<TYP>& operator=( const _Accessor<TYP>& ) { return *this; }
235 
236  protected:
238  mutable TYP* m_ptr = nullptr;
239 
240  public:
242  _Accessor() = default;
244  virtual ~_Accessor() = default;
246  bool operator!() const { return m_ptr != 0; }
248  operator const void*() const { return m_ptr; }
250  TYP* operator->() { return m_ptr; }
252  const TYP* operator->() const { return m_ptr; }
254  const Range<TYP>& range() const { return m_ptr->range(); }
255  };
256  // ==========================================================================
259  template <class TYP>
260  class Item : virtual public _Accessor<_Item<TYP>>
261  {
262  typedef Item<TYP> _My;
263 
264  public:
266  Item() = default;
268  operator const TYP() const { return this->m_ptr->get(); }
270  TYP operator*() { return this->m_ptr->get(); }
272  const TYP operator*() const { return this->m_ptr->get(); }
273  // Arithmetic operators defined on NTuple column entries
274  Item& operator++() { return *this += TYP( 1 ); }
275  Item& operator++( int ) { return *this += TYP( 1 ); }
276  Item& operator--() { return *this -= TYP( 1 ); }
277  Item& operator--( int ) { return *this -= TYP( 1 ); }
279  Item& operator=( const TYP data )
280  {
281  this->m_ptr->set( data );
282  return *this;
283  }
285  template <class T>
286  Item& operator=( const Item<T>& data )
287  {
288  this->m_ptr->set( data->get() );
289  return *this;
290  }
291  Item<TYP>& operator+=( const TYP data )
292  {
293  this->m_ptr->set( this->m_ptr->get() + data );
294  return *this;
295  }
296  Item<TYP>& operator-=( const TYP data )
297  {
298  this->m_ptr->set( this->m_ptr->get() - data );
299  return *this;
300  }
301  Item<TYP>& operator*=( const TYP data )
302  {
303  this->m_ptr->set( this->m_ptr->get() * data );
304  return *this;
305  }
306  Item<TYP>& operator/=( const TYP data )
307  {
308  this->m_ptr->set( this->m_ptr->get() / data );
309  return *this;
310  }
311  };
312  // ==========================================================================
315  template <>
316  class Item<bool> : virtual public _Accessor<_Item<bool>>
317  {
318  typedef Item<bool> _My;
319 
320  public:
322  Item() = default;
324  operator bool() const { return this->m_ptr->get(); }
326  Item& operator=( const bool data )
327  {
328  this->m_ptr->set( data );
329  return *this;
330  }
332  template <class T>
333  Item& operator=( const Item<T>& data )
334  {
335  this->m_ptr->set( data->get() );
336  return *this;
337  }
338  };
339  // ==========================================================================
342  template <class TYP>
343  class Array : virtual public _Accessor<_Array<TYP>>
344  {
345  public:
347  Array() = default;
349  template <class T>
350  Array& operator=( const Array<T>& copy )
351  {
352  *( this->m_ptr ) = *( copy.operator->() );
353  return *this;
354  }
356  template <class T>
357  TYP& operator[]( const T i )
358  {
359  return this->m_ptr->data( i );
360  }
362  template <class T>
363  const TYP& operator[]( const T i ) const
364  {
365  return this->m_ptr->data( i );
366  }
367 
368  TYP* begin() { return this->m_ptr->begin(); }
369  TYP* end() { return this->m_ptr->end(); }
370  };
371  // =========================================================================
374  template <class TYP>
375  class Matrix : virtual public _Accessor<_Matrix<TYP>>
376  {
377  public:
379  Matrix() = default;
381  template <class T>
382  Matrix& operator=( const Matrix<T>& copy )
383  {
384  *( this->m_ptr ) = *( copy.operator->() );
385  return *this;
386  }
388  template <class T>
389  TYP* operator[]( const T i )
390  {
391  return this->m_ptr->column( i );
392  }
394  template <class T>
395  const TYP* operator[]( const T i ) const
396  {
397  return this->m_ptr->column( i );
398  }
399  };
400  // =========================================================================
407  class Tuple : public DataObject, virtual public INTuple
408  {
409 
410  protected:
412  template <class TYPE>
413  StatusCode i_item( const std::string& name, _Item<TYPE>*& result ) const
414  {
415  try {
416  result = dynamic_cast<_Item<TYPE>*>( i_find( name ) );
417  } catch ( ... ) {
418  result = nullptr;
419  }
420  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
421  }
423  template <class TYPE>
424  StatusCode i_item( const std::string& name, _Item<TYPE*>*& result ) const
425  {
426  try {
427  _Item<void*>* p = dynamic_cast<_Item<void*>*>( i_find( name ) );
428  result = (_Item<TYPE*>*)p;
429  } catch ( ... ) {
430  result = nullptr;
431  }
432  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
433  }
436  {
437  try {
438  result = dynamic_cast<_Item<IOpaqueAddress*>*>( i_find( name ) );
439  } catch ( ... ) {
440  result = nullptr;
441  }
442  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
443  }
445  template <class TYPE>
446  StatusCode i_item( const std::string& name, _Array<TYPE>*& result ) const
447  {
448  try {
449  if ( clID() == CLID_ColumnWiseTuple ) {
450  result = dynamic_cast<_Array<TYPE>*>( i_find( name ) );
451  }
452  } catch ( ... ) {
453  result = nullptr;
454  }
455  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
456  }
458  template <class TYPE>
459  StatusCode i_item( const std::string& name, _Matrix<TYPE>*& result ) const
460  {
461  try {
462  if ( clID() == CLID_ColumnWiseTuple ) {
463  result = dynamic_cast<_Matrix<TYPE>*>( i_find( name ) );
464  }
465  } catch ( ... ) {
466  result = nullptr;
467  }
468  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
469  }
471  template <class TYPE>
472  StatusCode i_addItem( const std::string& name, long, const std::string&, TYPE low, TYPE high, _Item<TYPE>*& result )
473  {
474  if ( !i_find( name ) ) {
475  TYPE nil;
476  nil = 0;
477  return add( result = _Item<TYPE>::create( this, name, typeid( TYPE ), low, high, nil ) );
478  }
479  return StatusCode::FAILURE;
480  }
482  template <class TYPE>
483  StatusCode i_addItem( const std::string& name, long dim, const std::string& index, TYPE low, TYPE high,
484  _Array<TYPE>*& result )
485  {
486  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
487  return add( result = _Array<TYPE>::create( this, name, typeid( TYPE ), index, dim, low, high, TYPE( 0 ) ) );
488  }
489  return StatusCode::FAILURE;
490  }
492  template <class TYPE>
493  StatusCode i_addItem( const std::string& name, long dim1, long dim2, const std::string& index, TYPE low, TYPE high,
494  _Matrix<TYPE>*& result )
495  {
496  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
497  return add( result =
498  _Matrix<TYPE>::create( this, name, typeid( TYPE ), index, dim1, dim2, low, high, TYPE( 0 ) ) );
499  }
500  return StatusCode::FAILURE;
501  }
502  template <class TYPE>
503  StatusCode i_addObject( const std::string& name, _Item<TYPE*>*& result, const std::type_info& /* typ */ )
504  {
505  if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
506  return add( result = (_Item<TYPE*>*)_Item<void*>::create( this, name, typeid( TYPE ), 0, 0, 0 ) );
507  }
508  return StatusCode::FAILURE;
509  }
510 
511  public:
513  template <class TYPE>
515  {
516  return i_item( name, result.m_ptr );
517  }
519  template <class TYPE>
520  StatusCode item( const std::string& name, const Item<TYPE>& result ) const
521  {
522  return i_item( name, result.m_ptr );
523  }
525  template <class TYPE>
527  {
528  return i_item( name, result.m_ptr );
529  }
531  template <class TYPE>
532  StatusCode item( const std::string& name, const Array<TYPE>& result ) const
533  {
534  return i_item( name, result.m_ptr );
535  }
537  template <class TYPE>
539  {
540  return i_item( name, result.m_ptr );
541  }
542 
544  template <class TYPE>
545  StatusCode item( const std::string& name, const Matrix<TYPE>& result ) const
546  {
547  return i_item( name, result.m_ptr );
548  }
549 
563  template <class TYPE>
565  {
566  typedef Range<TYPE> _R;
567  return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
568  }
569 
578  template <class TYPE>
580  {
581  return i_addObject( name, itm.m_ptr, typeid( TYPE ) );
582  }
583 
593  {
594  typedef Range<IOpaqueAddress*> _R;
595  return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
596  }
597 
615  template <class TYPE, class RANGE>
616  StatusCode addItem( const std::string& name, Item<TYPE>& itm, const RANGE low, const RANGE high )
617  {
618  return i_addItem( name, 1, "", TYPE( low ), TYPE( high ), itm.m_ptr );
619  }
620 
634  template <class TYPE>
636  {
637  return i_addItem( name, dim, "", Range<TYPE>::min(), Range<TYPE>::max(), array.m_ptr );
638  }
639 
659  template <class TYPE, class RANGE>
660  StatusCode addItem( const std::string& name, long dim, Array<TYPE>& array, const RANGE low, const RANGE high )
661  {
662  return i_addItem( name, dim, "", TYPE( low ), TYPE( high ), array.m_ptr );
663  }
664 
695  template <class TYPE, class INDEX, class RANGE>
696  StatusCode addItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array, const RANGE low,
697  const RANGE high )
698  {
699  return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
700  }
701 
727  template <class TYPE, class INDEX, class RANGE>
729  const RANGE high )
730  {
731  return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
732  }
733 
758  template <class TYPE, class INDEX>
760  {
761  return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
762  array.m_ptr );
763  }
764 
784  template <class TYPE, class INDEX>
786  {
787  return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
788  array.m_ptr );
789  }
790 
808  template <class TYPE>
809  StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& matrix )
810  {
811  return i_addItem( name, cols, rows, "", Range<TYPE>::min(), Range<TYPE>::max(), matrix.m_ptr );
812  }
813 
836  template <class TYPE, class RANGE>
837  StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& result, const RANGE low,
838  const RANGE high )
839  {
840  return i_addItem( name, cols, rows, "", TYPE( low ), TYPE( high ), result.m_ptr );
841  }
842 
868  template <class TYPE, class INDEX>
870  {
871  return i_addItem( name, index->range().distance(), rows, index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
872  matrix.m_ptr );
873  }
874 
895  template <class TYPE, class INDEX>
897  {
898  return i_addItem( name, col_index->range().distance(), rows, col_index->name(), Range<TYPE>::min(),
899  Range<TYPE>::max(), matrix.m_ptr );
900  }
901 
934  template <class TYPE, class INDEX, class RANGE>
935  StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows, const RANGE low,
936  const RANGE high )
937  {
938  return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
939  }
940 
968  template <class TYPE, class INDEX, class RANGE>
970  const RANGE low, const RANGE high )
971  {
972  return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
973  }
974  };
975 
980  static const CLID& classID() { return CLID_NTupleDirectory; }
982  const CLID& clID() const override { return classID(); }
983  };
984 
987  class File : public Directory
988  {
989  protected:
995  long m_type = 0;
997  bool m_isOpen = false;
998 
999  public:
1000  File() = default;
1003  : m_name( std::move( name ) ), m_logName( std::move( logName ) ), m_type( type )
1004  {
1005  }
1006 
1008  static const CLID& classID() { return CLID_NTupleFile; }
1010  const CLID& clID() const override { return classID(); }
1012  void setType( const long typ ) { m_type = typ; }
1014  long type() const { return m_type; }
1016  const std::string& name() const { return m_name; }
1018  void setName( std::string nam ) { m_name = std::move( nam ); }
1020  const std::string& logicalName() const { return m_logName; }
1022  void setLogicalName( std::string l ) { m_logName = std::move( l ); }
1024  void setOpen( bool flag ) { m_isOpen = flag; }
1026  bool isOpen() const { return m_isOpen; }
1027  };
1028  // =========================================================================
1029  // inhibit certain types by defining specialized templates which do not
1030  // allow for construction.
1031  template <>
1033  {
1034  Array() = delete;
1035 
1036  public:
1037  virtual ~Array() = default;
1038  virtual void dummy() = 0;
1039  };
1040  template <>
1042  {
1043  Matrix() = delete;
1044 
1045  public:
1046  virtual ~Matrix() = default;
1047  virtual void dummy() = 0;
1048  };
1049 // =========================================================================
1050 #ifndef ALLOW_ALL_TYPES
1051 #else
1052  typedef Item<bool> BoolItem;
1053  typedef Item<char> CharItem;
1054  typedef Item<unsigned char> UCharItem;
1055  typedef Item<short> ShortItem;
1056  typedef Item<unsigned short> UShortItem;
1057  typedef Item<long> LongItem;
1058  typedef Item<long long> LongLongItem;
1059  typedef Item<unsigned long> ULongItem;
1060  typedef Item<unsigned long long> ULongLongItem;
1061  typedef Item<int> IntItem;
1062  typedef Item<unsigned int> UIntItem;
1063  typedef Item<float> FloatItem;
1064  typedef Item<double> DoubleItem;
1065  typedef Array<bool> BoolArray;
1066  typedef Array<char> CharArray;
1067  typedef Array<unsigned char> UCharArray;
1068  typedef Array<short> ShortArray;
1069  typedef Array<unsigned short> UShortArray;
1070  typedef Array<long> LongArray;
1071  typedef Array<unsigned long> ULongArray;
1072  typedef Array<int> IntArray;
1073  typedef Array<unsigned int> UIntArray;
1074  typedef Array<float> FloatArray;
1075  typedef Array<double> DoubleArray;
1076  typedef Matrix<bool> BoolMatrix;
1077  typedef Matrix<char> CharMatrix;
1078  typedef Matrix<unsigned char> UCharMatrix;
1079  typedef Matrix<short> ShortMatrix;
1080  typedef Matrix<unsigned short> UShortMatrix;
1081  typedef Matrix<long> LongMatrix;
1082  typedef Matrix<unsigned long> ULongMatrix;
1083  typedef Matrix<int> IntMatrix;
1084  typedef Matrix<unsigned int> UIntMatrix;
1085  typedef Matrix<float> FloatMatrix;
1086  typedef Matrix<double> DoubleMatrix;
1087 #endif
1088 
1089  template <class T>
1090  inline std::ostream& operator<<( std::ostream& s, const Item<T>& obj )
1091  {
1092  return s << T( obj );
1093  }
1094 } // end of namespace NTuple
1095 
1096 // Useful:
1100 
1101 #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:935
const std::string & name() const
Retrun physical file name.
Definition: NTuple.h:1016
bool lower() const
Lower boundary of range.
Definition: NTuple.h:101
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Item< bool > _My
Definition: NTuple.h:318
Item< TYP > & operator/=(const TYP data)
Definition: NTuple.h:306
Item< TYP > & operator+=(const TYP data)
Definition: NTuple.h:291
void setOpen(bool flag)
Set "open" flag.
Definition: NTuple.h:1024
File(long type, std::string name, std::string logName)
Standard constructor.
Definition: NTuple.h:1002
Item & operator--(int)
Definition: NTuple.h:277
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:759
std::string m_logName
Logical file name.
Definition: NTuple.h:993
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:696
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:969
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:413
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:493
Item & operator++(int)
Definition: NTuple.h:275
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:357
SmartDataPtr< NTuple::File > NTupleFilePtr
Definition: NTuple.h:1099
_Array< TYP > & operator=(const _Array< T > &copy)
Assignment operator.
Definition: NTuple.h:174
TYP * begin()
Definition: NTuple.h:190
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:520
static TYP min()
Minimal number of data.
Definition: NTuple.h:85
TYP * operator->()
Dereference operator.
Definition: NTuple.h:250
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:545
const TYP operator*() const
Dereference operator for pointers(CONST)
Definition: NTuple.h:272
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:809
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:532
Item & operator--()
Definition: NTuple.h:276
TYP * column(long i)
Access to data by reference.
Definition: NTuple.h:221
T copy_n(T...args)
_Matrix< TYP > & operator=(const _Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:209
SmartDataPtr< NTuple::Tuple > NTuplePtr
Definition: NTuple.h:1097
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:728
std::vector< Row > Matrix
Definition: Vector.h:21
const Range< TYP > & range() const
Access the range.
Definition: NTuple.h:254
NTuple name space.
Definition: INTupleSvc.h:9
virtual TYP get() const
Access to data by reference (CONST)
Definition: NTuple.h:160
long type() const
Return access type.
Definition: NTuple.h:1014
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:869
static const CLID & classID()
class ID of the object
Definition: NTuple.h:1008
STL class.
NTuple interface class definition.
Definition: INTuple.h:82
Matrix & operator=(const Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:382
const TYP * operator[](const T i) const
Array operator.
Definition: NTuple.h:395
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:896
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:785
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:459
Item< TYP > & operator-=(const TYP data)
Definition: NTuple.h:296
NTuple interface class definition.
Definition: INTuple.h:27
static const CLID & classID()
class ID of the object
Definition: NTuple.h:980
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:51
_Item< TYP > & operator=(const _Item< T > &copy)
Assignment operator.
Definition: NTuple.h:152
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:616
void setName(std::string nam)
Set access type.
Definition: NTuple.h:1018
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:837
void setLogicalName(std::string l)
Definition: NTuple.h:1022
static TYP max()
Maximal number of data.
Definition: NTuple.h:87
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:333
bool upper() const
Upper boundary of range.
Definition: NTuple.h:103
std::string m_name
Physical file name.
Definition: NTuple.h:991
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:503
Specialization acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:316
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:635
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:1026
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:592
Range(const Range< TYP > &copy)
Copy constructor.
Definition: NTuple.h:68
T move(T...args)
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
const TYP & operator[](const T i) const
Array operator.
Definition: NTuple.h:363
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:407
bool operator!() const
Check if column is present.
Definition: NTuple.h:246
void setType(const long typ)
Set access type.
Definition: NTuple.h:1012
dictionary l
Definition: gaudirun.py:440
virtual const void * buffer() const =0
Access data buffer (CONST)
TYP * end()
Definition: NTuple.h:369
TYP distance() const
Distance between lower and upper range.
Definition: NTuple.h:83
_Item< TYP > * m_ptr
Pointer to instance.
Definition: NTuple.h:238
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:579
const TYP * column(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:223
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:483
Item< TYP > _My
Definition: NTuple.h:262
Item & operator=(const bool data)
Assignment operator.
Definition: NTuple.h:326
StatusCode item(const std::string &name, Array< TYPE > &result)
Locate a Array of data to the N tuple type safe.
Definition: NTuple.h:526
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:286
TYP * begin()
Definition: NTuple.h:368
const TYP & data(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:186
TYP * operator[](const T i)
Array operator.
Definition: NTuple.h:389
Item & operator=(const TYP data)
Assignment operator.
Definition: NTuple.h:279
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:564
long m_rows
Number of rows per column.
Definition: NTuple.h:201
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:1098
Item< TYP > & operator*=(const TYP data)
Definition: NTuple.h:301
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:978
Array & operator=(const Array< T > &copy)
Assignment operator.
Definition: NTuple.h:350
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:982
const TYP * operator->() const
Dereference operator (CONST)
Definition: NTuple.h:252
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:514
Opaque address interface definition.
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:1010
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:424
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:660
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:435
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:104
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:234
bool distance() const
Distance between lower and upper range.
Definition: NTuple.h:105
TYP * end()
Definition: NTuple.h:191
Item & operator++()
Definition: NTuple.h:274
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:538
const std::string & logicalName() const
Definition: NTuple.h:1020
TYP operator*()
Dereference operator for pointers.
Definition: NTuple.h:270
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:446
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:472
TYP & data(long i)
Access to data by reference (CONST)
Definition: NTuple.h:188
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:987
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