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 <string>
7 #include <limits>
8 #include <cfloat>
9 #include <stdexcept>
10 #include <algorithm>
11 // ============================================================================
12 // Framework include files
13 // ============================================================================
15 #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> class Range;
37  template <class TYP> class _Data;
38  template <class TYP> class _Item;
39  template <class TYP> class _Array;
40  template <class TYP> class _Matrix;
41  template <class TYP> class _Accessor;
42  template <class TYP> class Item;
43  template <class TYP> class Array;
44  template <class TYP> class Matrix;
45  // ==========================================================================
47  template <class TYP>
48  class Range {
50  /*const*/ TYP m_lower;
52  /*const*/ TYP m_upper;
53  public:
55  Range(TYP low, TYP upper) : m_lower(std::move(low)), m_upper(std::move(upper)) {
56  }
58  Range(const Range<TYP>& copy) : m_lower(copy.m_lower),
59  m_upper(copy.m_upper) {
60  }
62  Range& operator=(const Range<TYP>& copy) {
63  m_lower = copy.m_lower;
64  m_upper = copy.m_upper;
65  return *this;
66  }
68  virtual ~Range() = default;
70  TYP lower() const { return m_lower; }
72  TYP upper() const { return m_upper; }
74  TYP distance() const { return m_upper-m_lower; }
76  static TYP min() { return std::numeric_limits<TYP>::min() ; }
78  static TYP max() { return std::numeric_limits<TYP>::max() ; }
79  };
80  // ==========================================================================
81  template <> class Range<bool>
82  {
83  public:
85  Range(const bool /* low */ , const bool /* upper */ ) {}
87  Range(const Range<bool>& /* copy */ ) {}
89  virtual ~Range() = default;
91  bool lower() const { return false; }
93  bool upper() const { return true; }
95  bool distance() const { return true; }
97  static bool min() { return false; }
99  static bool max() { return true; }
100  };
101  // ==========================================================================
102  template <>
103  inline IOpaqueAddress*
105  template <>
106  inline IOpaqueAddress*
107  Range<IOpaqueAddress* >::max() { return (IOpaqueAddress*)0xffffffff ; }
108  // ==========================================================================
111  template <class TYP> class GAUDI_API _Data : virtual public INTupleItem {
112  protected:
114  TYP* m_buffer = nullptr;
115  public:
119  virtual void setDefault(const TYP d) = 0;
121  virtual const ItemRange& range() const = 0;
122  };
123  // ==========================================================================
126  template <class TYP> class GAUDI_API _Item : virtual public _Data<TYP> {
127  public:
129  ~_Item() override = default;
131  static _Item* create(INTuple* tup,
132  const std::string& name,
133  const std::type_info& info,
134  TYP min,
135  TYP max,
136  TYP def);
138  template <class T>
139  _Item<TYP>& operator=(const _Item<T>& copy) {
140  *this->m_buffer = copy.get();
141  return *this;
142  }
144  void set(const TYP& item) { *this->m_buffer = item; }
146  virtual TYP get() const { return *this->m_buffer; }
147  };
148  // ==========================================================================
151  template <class TYP> class GAUDI_API _Array : virtual public _Data<TYP> {
152  public:
154  static _Array* create(INTuple* tup,
155  const std::string& name,
156  const std::type_info& info,
157  const std::string& index,
158  long len,
159  TYP min,
160  TYP max,
161  TYP def);
163  template <class T>
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
172  ("N-tuple matrix cannot be copied! The index range does not match!");
173  return *this;
174  }
176  const TYP& data(long i) const { return this->m_buffer[i]; }
178  TYP& data(long i) { return this->m_buffer[i]; }
179 
180  TYP* begin() { return this->m_buffer; }
181  TYP* end() { return this->m_buffer+this->length(); }
182  };
183  // ==========================================================================
186  template <class TYP> class GAUDI_API _Matrix : virtual public _Data<TYP> {
187  protected:
189  long m_rows;
190  public:
192  static _Matrix* create(INTuple* tup,
193  const std::string& name,
194  const std::type_info& info,
195  const std::string& index,
196  long ncol,
197  long nrow,
198  TYP min,
199  TYP max,
200  TYP def);
202  template <class T>
204  long len = this->length();
205  if ( len == copy.length() ) {
206  const T* source = (const T*)copy.buffer();
207  std::copy_n(source,len,this->m_buffer);
208  return *this;
209  }
210  throw std::out_of_range
211  ("N-tuple matrix cannot be copied! The index range does not match!");
212  return *this;
213  }
215  TYP* column(long i) { return this->m_buffer + i*m_rows; }
217  const TYP* column(long i) const { return this->m_buffer + i*m_rows; }
218  };
219  // ==========================================================================
222  template <class TYP> class _Accessor {
223  friend class Tuple;
224  private:
226  return *this;
227  }
228  protected:
230  mutable TYP* m_ptr = nullptr;
231  public:
233  _Accessor() = default;
235  virtual ~_Accessor() = default;
237  bool operator !() const { return m_ptr != 0; }
239  operator const void*() const { return m_ptr; }
241  TYP* operator->() { return m_ptr; }
243  const TYP* operator->() const { return m_ptr; }
245  const Range<TYP>& range() const { return m_ptr->range(); }
246  };
247  // ==========================================================================
250  template <class TYP> class Item : virtual public _Accessor< _Item<TYP> > {
251  typedef Item<TYP> _My;
252  public:
254  Item() = default;
256  operator const TYP () const { return this->m_ptr->get(); }
258  TYP operator*() { return this->m_ptr->get(); }
260  const TYP operator*() const { return this->m_ptr->get(); }
261  // Arithmetic operators defined on NTuple column entries
262  Item& operator ++ () { return *this += TYP(1); }
263  Item& operator ++ (int) { return *this += TYP(1); }
264  Item& operator -- () { return *this -= TYP(1); }
265  Item& operator -- (int) { return *this -= TYP(1); }
267  Item& operator=(const TYP data) {
268  this->m_ptr->set( data );
269  return *this;
270  }
272  template<class T>
273  Item& operator=(const Item<T>& data) {
274  this->m_ptr->set( data->get() );
275  return *this;
276  }
277  Item<TYP>& operator += (const TYP data) {
278  this->m_ptr->set ( this->m_ptr->get() + data );
279  return *this;
280  }
281  Item<TYP>& operator -= (const TYP data) {
282  this->m_ptr->set ( this->m_ptr->get() - data );
283  return *this;
284  }
285  Item<TYP>& operator *= (const TYP data) {
286  this->m_ptr->set ( this->m_ptr->get() * data );
287  return *this;
288  }
289  Item<TYP>& operator /= (const TYP data) {
290  this->m_ptr->set ( this->m_ptr->get() / data );
291  return *this;
292  }
293  };
294  // ==========================================================================
297  template <> class Item<bool> : virtual public _Accessor< _Item<bool> > {
298  typedef Item<bool> _My;
299  public:
301  Item() = default;
303  operator bool () const { return this->m_ptr->get(); }
305  Item& operator=(const bool data) {
306  this->m_ptr->set( data );
307  return *this;
308  }
310  template<class T>
311  Item& operator=(const Item<T>& data) {
312  this->m_ptr->set( data->get() );
313  return *this;
314  }
315  };
316  // ==========================================================================
319  template <class TYP> 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) { return this->m_ptr->data(i); }
333  template <class T>
334  const TYP& operator[] (const T i) const { return this->m_ptr->data(i); }
335 
336  TYP* begin() { return this->m_ptr->begin(); }
337  TYP* end() { return this->m_ptr->end(); }
338 
339 
340  ~Array() override = default;
341  };
342  // =========================================================================
345  template <class TYP> class Matrix : virtual public _Accessor< _Matrix<TYP> > {
346  public:
348  Matrix() = default;
350  template <class T>
351  Matrix& operator=(const Matrix<T>& copy) {
352  *(this->m_ptr) = *(copy.operator->());
353  return *this;
354  }
356  template <class T>
357  TYP* operator[] (const T i) { return this->m_ptr->column(i); }
359  template <class T>
360  const TYP* operator[] (const T i) const { return this->m_ptr->column(i); }
361  ~Matrix() override = default;
362  };
363  // =========================================================================
370  class Tuple : public DataObject, virtual public INTuple {
371 
372  protected:
374  template <class TYPE> StatusCode i_item(const std::string& name,
375  _Item<TYPE>*& result) const {
376  try {
377  result = dynamic_cast< _Item<TYPE>* > (i_find(name));
378  }
379  catch (...) {
380  result = nullptr;
381  }
382  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
383  }
385  template <class TYPE> StatusCode i_item(const std::string& name,
386  _Item<TYPE*>*& result) const {
387  try {
388  _Item<void*>* p = dynamic_cast< _Item<void*>* > (i_find(name));
389  result = (_Item<TYPE*>*)p;
390  }
391  catch (...) {
392  result = nullptr;
393  }
394  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
395  }
398  _Item<IOpaqueAddress*>*& result) const {
399  try {
400  result = dynamic_cast< _Item<IOpaqueAddress*>* > (i_find(name));
401  }
402  catch (...) {
403  result = nullptr;
404  }
405  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
406  }
408  template <class TYPE> StatusCode i_item(const std::string& name,
409  _Array<TYPE>*& result) const {
410  try {
411  if ( clID() == CLID_ColumnWiseTuple ) {
412  result = dynamic_cast< _Array<TYPE>* > (i_find(name));
413  }
414  }
415  catch (...) {
416  result = nullptr;
417  }
418  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
419  }
421  template <class TYPE> StatusCode i_item(const std::string& name,
422  _Matrix<TYPE>*& result) const {
423  try {
424  if ( clID() == CLID_ColumnWiseTuple ) {
425  result = dynamic_cast< _Matrix<TYPE>* > (i_find(name));
426  }
427  }
428  catch (...) {
429  result = nullptr;
430  }
431  return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
432  }
434  template <class TYPE>
436  long,
437  const std::string&,
438  TYPE low,
439  TYPE high,
440  _Item<TYPE>*& result) {
441  if ( !i_find(name) ) {
442  TYPE nil;
443  nil = 0;
444  return add( result = _Item<TYPE>::create(this, name, typeid(TYPE), low, high, nil) );
445  }
446  return StatusCode::FAILURE;
447  }
449  template <class TYPE>
451  long dim,
452  const std::string& index,
453  TYPE low,
454  TYPE high,
455  _Array<TYPE>*& result) {
456  if ( !i_find(name) && clID() == CLID_ColumnWiseTuple ) {
457  return add( result = _Array<TYPE>::create(this,
458  name,
459  typeid(TYPE),
460  index,
461  dim,
462  low,
463  high,
464  TYPE(0)) );
465  }
466  return StatusCode::FAILURE;
467  }
469  template <class TYPE>
471  long dim1,
472  long dim2,
473  const std::string& index,
474  TYPE low,
475  TYPE high,
476  _Matrix<TYPE>*& result) {
477  if ( !i_find(name) && clID() == CLID_ColumnWiseTuple ) {
478  return add( result = _Matrix<TYPE>::create(this,
479  name,
480  typeid(TYPE),
481  index,
482  dim1,
483  dim2,
484  low,
485  high,
486  TYPE(0)) );
487  }
488  return StatusCode::FAILURE;
489  }
490  template <class TYPE> StatusCode
491  i_addObject(const std::string& name,_Item<TYPE*>*& result,const std::type_info& /* typ */) {
492  if ( !i_find(name) && clID() == CLID_ColumnWiseTuple ) {
493  return add( result = (_Item<TYPE*>*)_Item<void*>::create(this, name, typeid(TYPE),0,0,0) );
494  }
495  return StatusCode::FAILURE;
496  }
497 
498  public:
500  ~Tuple() override = default;
501 
503  template <class TYPE> StatusCode item(const std::string& name,
504  Item<TYPE>& result)
505  {
506  return i_item(name, result.m_ptr);
507  }
509  template <class TYPE> StatusCode item(const std::string& name,
510  const Item<TYPE>& result) const
511  {
512  return i_item(name, result.m_ptr);
513  }
515  template <class TYPE> StatusCode
516  item(const std::string& name, Array<TYPE>& result)
517  {
518  return i_item(name, result.m_ptr);
519  }
521  template <class TYPE> StatusCode item(const std::string& name,
522  const Array<TYPE>& result) const
523  {
524  return i_item(name, result.m_ptr);
525  }
527  template <class TYPE> StatusCode item(const std::string& name,
528  Matrix<TYPE>& result)
529  {
530  return i_item(name, result.m_ptr);
531  }
532 
534  template <class TYPE> StatusCode item( const std::string& name,
535  const Matrix<TYPE>& result) const
536  {
537  return i_item(name, result.m_ptr);
538  }
539 
553  template <class TYPE> StatusCode
555  typedef Range<TYPE> _R;
556  return i_addItem(name, 1, "", _R::min(), _R::max(), itm.m_ptr);
557  }
558 
567  template <class TYPE> StatusCode
569  return i_addObject(name,itm.m_ptr,typeid(TYPE));
570  }
571 
580  StatusCode
582  typedef Range<IOpaqueAddress*> _R;
583  return i_addItem(name, 1, "", _R::min(), _R::max(), itm.m_ptr);
584  }
585 
603  template <class TYPE, class RANGE> StatusCode
605  Item<TYPE>& itm,
606  const RANGE low,
607  const RANGE high)
608  {
609  return i_addItem( name, 1, "", TYPE(low), TYPE(high), itm.m_ptr);
610  }
611 
625  template <class TYPE> StatusCode
627  long dim,
629  {
630  return i_addItem(name,
631  dim,
632  "",
635  array.m_ptr);
636  }
637 
657  template <class TYPE, class RANGE> StatusCode
659  long dim,
661  const RANGE low,
662  const RANGE high)
663  {
664  return i_addItem(name,
665  dim,
666  "",
667  TYPE(low),
668  TYPE(high),
669  array.m_ptr);
670  }
671 
702  template <class TYPE, class INDEX, class RANGE> StatusCode
704  Item<INDEX>& index,
706  const RANGE low,
707  const RANGE high)
708  {
709  return i_addItem( name,
710  index->range().distance(),
711  index->name(),
712  TYPE(low),
713  TYPE(high),
714  array.m_ptr);
715  }
716 
742  template <class TYPE, class INDEX, class RANGE> StatusCode
744  Item<INDEX>& index,
746  const RANGE low,
747  const RANGE high)
748  {
749  return i_addItem( name,
750  index->range().distance(),
751  index->name(),
752  TYPE(low),
753  TYPE(high),
754  array.m_ptr);
755  }
756 
781  template <class TYPE, class INDEX> StatusCode
783  Item<INDEX>& index,
785  {
786  return i_addItem( name,
787  index->range().distance(),
788  index->name(),
791  array.m_ptr);
792  }
793 
813  template <class TYPE, class INDEX> StatusCode
815  Item<INDEX>& index,
817  {
818  return i_addItem( name,
819  index->range().distance(),
820  index->name(),
823  array.m_ptr);
824  }
825 
843  template <class TYPE> StatusCode
845  long cols,
846  long rows,
848  {
849  return i_addItem(name,
850  cols,
851  rows,
852  "",
855  matrix.m_ptr);
856  }
857 
880  template <class TYPE, class RANGE> StatusCode
882  long cols,
883  long rows,
884  Matrix<TYPE>& result,
885  const RANGE low,
886  const RANGE high)
887  {
888  return i_addItem(name,
889  cols,
890  rows,
891  "",
892  TYPE(low),
893  TYPE(high),
894  result.m_ptr);
895  }
896 
922  template <class TYPE, class INDEX> StatusCode
924  Item<INDEX>& index,
926  long rows)
927  {
928  return i_addItem( name,
929  index->range().distance(),
930  rows,
931  index->name(),
934  matrix.m_ptr);
935  }
936 
957  template <class TYPE, class INDEX> StatusCode
959  Item<INDEX>& col_index,
960  long rows,
962  {
963  return i_addItem( name,
964  col_index->range().distance(),
965  rows,
966  col_index->name(),
969  matrix.m_ptr);
970  }
971 
1004  template <class TYPE, class INDEX, class RANGE> StatusCode
1006  Item<INDEX>& index,
1008  long rows,
1009  const RANGE low,
1010  const RANGE high)
1011  {
1012  return i_addItem( name,
1013  index->range().distance(),
1014  rows,
1015  index->name(),
1016  TYPE(low),
1017  TYPE(high),
1018  matrix.m_ptr);
1019  }
1020 
1048  template <class TYPE, class INDEX, class RANGE> StatusCode
1050  Item<INDEX>& index,
1051  long rows,
1053  const RANGE low,
1054  const RANGE high)
1055  {
1056  return i_addItem( name,
1057  index->range().distance(),
1058  rows,
1059  index->name(),
1060  TYPE(low),
1061  TYPE(high),
1062  matrix.m_ptr);
1063  }
1064  };
1065 
1068  class Directory : public DataObject {
1069  public:
1072  }
1074  ~Directory() override = default;
1075 
1077  static const CLID& classID() {
1078  return CLID_NTupleDirectory;
1079  }
1081  const CLID& clID() const override {
1082  return classID();
1083  }
1084  };
1085 
1088  class File : public Directory {
1089  protected:
1095  long m_type = 0;
1097  bool m_isOpen = false;
1098  public:
1099  File() = default;
1102  : m_name(std::move(name)), m_logName(std::move(logName)), m_type(type) {
1103  }
1105  ~File() override = default ;
1106 
1108  static const CLID& classID() {
1109  return CLID_NTupleFile;
1110  }
1112  const CLID& clID() const override {
1113  return classID();
1114  }
1116  void setType(const long typ) {
1117  m_type = typ;
1118  }
1120  long type() const {
1121  return m_type;
1122  }
1124  const std::string& name() const {
1125  return m_name;
1126  }
1128  void setName(std::string nam) {
1129  m_name = std::move(nam);
1130  }
1132  const std::string& logicalName() const {
1133  return m_logName;
1134  }
1137  m_logName = std::move(l);
1138  }
1140  void setOpen(bool flag) {
1141  m_isOpen = flag;
1142  }
1144  bool isOpen() const {
1145  return m_isOpen;
1146  }
1147  };
1148  // =========================================================================
1149  // inhibit certain types by defining specialized templates which do not
1150  // allow for construction.
1151  template <>
1153  {
1154  Array() = delete;
1155  public:
1156  virtual ~Array() = default;
1157  virtual void dummy() = 0;
1158  };
1159  template <>
1161  {
1162  Matrix() = delete;
1163  public:
1164  virtual ~Matrix() = default;
1165  virtual void dummy() = 0;
1166  };
1167  // =========================================================================
1168 #ifndef ALLOW_ALL_TYPES
1169 #else
1170  typedef Item<bool> BoolItem;
1171  typedef Item<char> CharItem;
1172  typedef Item<unsigned char> UCharItem;
1173  typedef Item<short> ShortItem;
1174  typedef Item<unsigned short> UShortItem;
1175  typedef Item<long> LongItem;
1176  typedef Item<long long> LongLongItem;
1177  typedef Item<unsigned long> ULongItem;
1178  typedef Item<unsigned long long> ULongLongItem;
1179  typedef Item<int> IntItem;
1180  typedef Item<unsigned int> UIntItem;
1181  typedef Item<float> FloatItem;
1182  typedef Item<double> DoubleItem;
1183  typedef Array<bool> BoolArray;
1184  typedef Array<char> CharArray;
1185  typedef Array<unsigned char> UCharArray;
1186  typedef Array<short> ShortArray;
1187  typedef Array<unsigned short> UShortArray;
1188  typedef Array<long> LongArray;
1189  typedef Array<unsigned long> ULongArray;
1190  typedef Array<int> IntArray;
1191  typedef Array<unsigned int> UIntArray;
1192  typedef Array<float> FloatArray;
1193  typedef Array<double> DoubleArray;
1194  typedef Matrix<bool> BoolMatrix;
1195  typedef Matrix<char> CharMatrix;
1196  typedef Matrix<unsigned char> UCharMatrix;
1197  typedef Matrix<short> ShortMatrix;
1198  typedef Matrix<unsigned short> UShortMatrix;
1199  typedef Matrix<long> LongMatrix;
1200  typedef Matrix<unsigned long> ULongMatrix;
1201  typedef Matrix<int> IntMatrix;
1202  typedef Matrix<unsigned int> UIntMatrix;
1203  typedef Matrix<float> FloatMatrix;
1204  typedef Matrix<double> DoubleMatrix;
1205 #endif
1206 
1207  template <class T>
1208  inline std::ostream& operator<<(std::ostream& s, const Item<T>& obj)
1209  {
1210  return s << T(obj);
1211  }
1212 } // end of namespace NTuple
1213 
1214 // Useful:
1218 
1219 #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:1005
const std::string & name() const
Retrun physical file name.
Definition: NTuple.h:1124
bool lower() const
Lower boundary of range.
Definition: NTuple.h:91
Item< bool > _My
Definition: NTuple.h:298
void setOpen(bool flag)
Set "open" flag.
Definition: NTuple.h:1140
File(long type, std::string name, std::string logName)
Standard constructor.
Definition: NTuple.h:1101
KeyedObjectManager< array > Array
Forward declaration of specialized redirection array object manager.
TYP m_lower
Lower boundary of range.
Definition: NTuple.h:50
bool operator!(const Gaudi::Time &t)
Definition: Time.icpp:248
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:782
std::string m_logName
Logical file name.
Definition: NTuple.h:1093
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:703
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:1049
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
Abstract class describing a matrix column in a N tuple.
Definition: NTuple.h:40
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:44
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:374
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:470
Abstract class describing a column in a N tuple.
Definition: NTuple.h:38
Range< TYP > ItemRange
Set type definition to make life more easy easy.
Definition: NTuple.h:117
SmartDataPtr< NTuple::File > NTupleFilePtr
Definition: NTuple.h:1217
_Array< TYP > & operator=(const _Array< T > &copy)
Assignment operator.
Definition: NTuple.h:164
TYP * begin()
Definition: NTuple.h:180
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:509
static TYP min()
Minimal number of data.
Definition: NTuple.h:76
TYP * operator->()
Dereference operator.
Definition: NTuple.h:241
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:534
const TYP operator*() const
Dereference operator for pointers(CONST)
Definition: NTuple.h:260
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:844
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:521
TYP * column(long i)
Access to data by reference.
Definition: NTuple.h:215
T copy_n(T...args)
_Matrix< TYP > & operator=(const _Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:203
SmartDataPtr< NTuple::Tuple > NTuplePtr
Definition: NTuple.h:1215
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:743
const Range< TYP > & range() const
Access the range.
Definition: NTuple.h:245
NTuple name space.
Definition: INTupleSvc.h:10
virtual TYP get() const
Access to data by reference (CONST)
Definition: NTuple.h:146
long type() const
Return access type.
Definition: NTuple.h:1120
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:923
static const CLID & classID()
class ID of the object
Definition: NTuple.h:1108
STL class.
NTuple interface class definition.
Definition: INTuple.h:79
Matrix & operator=(const Matrix< T > &copy)
Assignment operator.
Definition: NTuple.h:351
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:958
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:814
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:421
NTuple interface class definition.
Definition: INTuple.h:26
Class acting as a smart pointer holding a N tuple entry.
Definition: NTuple.h:41
virtual long length() const =0
Access the buffer length.
static bool max()
Maximal number of data.
Definition: NTuple.h:99
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
_Item< TYP > & operator=(const _Item< T > &copy)
Assignment operator.
Definition: NTuple.h:139
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:604
void setName(std::string nam)
Set access type.
Definition: NTuple.h:1128
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:881
void setLogicalName(std::string l)
Definition: NTuple.h:1136
static TYP max()
Maximal number of data.
Definition: NTuple.h:78
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:311
bool upper() const
Upper boundary of range.
Definition: NTuple.h:93
std::string m_name
Physical file name.
Definition: NTuple.h:1091
StatusCode i_addObject(const std::string &name, _Item< TYPE * > *&result, const std::type_info &)
Definition: NTuple.h:491
Specialization acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:297
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:626
TYP upper() const
Upper boundary of range.
Definition: NTuple.h:72
Abstract class describing basic data in an Ntuple.
Definition: NTuple.h:37
bool isOpen() const
Access "open" flag.
Definition: NTuple.h:1144
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:581
Range(const Range< TYP > &copy)
Copy constructor.
Definition: NTuple.h:58
T move(T...args)
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
void setType(const long typ)
Set access type.
Definition: NTuple.h:1116
dictionary l
Definition: gaudirun.py:421
virtual const void * buffer() const =0
Access data buffer (CONST)
std::vector< Row > Matrix
Definition: Vector.h:21
TYP * end()
Definition: NTuple.h:337
TYP distance() const
Distance between lower and upper range.
Definition: NTuple.h:74
_Item< TYP > * m_ptr
Pointer to instance.
Definition: NTuple.h:230
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:568
const TYP * column(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:217
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:450
Item< TYP > _My
Definition: NTuple.h:251
Item & operator=(const bool data)
Assignment operator.
Definition: NTuple.h:305
StatusCode item(const std::string &name, Array< TYPE > &result)
Locate a Array of data to the N tuple type safe.
Definition: NTuple.h:516
Item & operator=(const Item< T > &data)
Assignment operator.
Definition: NTuple.h:273
TYP * begin()
Definition: NTuple.h:336
const TYP & data(long i) const
Access to data by reference (CONST)
Definition: NTuple.h:176
Item & operator=(const TYP data)
Assignment operator.
Definition: NTuple.h:267
string s
Definition: gaudirun.py:245
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataPtr.h:46
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:554
long m_rows
Number of rows per column.
Definition: NTuple.h:189
TYP m_upper
Upper boundary of range.
Definition: NTuple.h:52
Class defining a range.
Definition: NTuple.h:36
Range(const Range< bool > &)
Copy constructor.
Definition: NTuple.h:87
SmartDataPtr< NTuple::Directory > NTupleDirPtr
Definition: NTuple.h:1216
Array & operator=(const Array< T > &copy)
Assignment operator.
Definition: NTuple.h:325
const TYP * operator->() const
Dereference operator (CONST)
Definition: NTuple.h:243
Range(const bool, const bool)
Standard constructor.
Definition: NTuple.h:85
StatusCode item(const std::string &name, Item< TYPE > &result)
Locate a scalar Item of data to the N tuple type safe.
Definition: NTuple.h:503
Directory()
Standard constructor.
Definition: NTuple.h:1071
Opaque address interface definition.
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:1112
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:385
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:658
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:42
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:397
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:43
static bool min()
Minimal number of data.
Definition: NTuple.h:97
#define GAUDI_API
Definition: Kernel.h:107
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:1068
_Accessor< TYP > & operator=(const _Accessor< TYP > &)
Definition: NTuple.h:225
bool distance() const
Distance between lower and upper range.
Definition: NTuple.h:95
TYP * end()
Definition: NTuple.h:181
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:527
const std::string & logicalName() const
Definition: NTuple.h:1132
TYP operator*()
Dereference operator for pointers.
Definition: NTuple.h:258
TYP lower() const
Lower boundary of range.
Definition: NTuple.h:70
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:408
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:435
const CLID & clID() const override
class ID of the object
Definition: NTuple.h:1081
TYP & data(long i)
Access to data by reference (CONST)
Definition: NTuple.h:178
Range & operator=(const Range< TYP > &copy)
Adjust ranges.
Definition: NTuple.h:62
Small class representing an N tuple file in the transient store.
Definition: NTuple.h:1088
static const CLID & classID()
class ID of the object
Definition: NTuple.h:1077
Range(TYP low, TYP upper)
Standard constructor.
Definition: NTuple.h:55
Abstract class describing a column-array in a N tuple.
Definition: NTuple.h:39