The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
NTuple.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12
15#include <GaudiKernel/INTuple.h>
18#include <algorithm>
19#include <cfloat>
20#include <limits>
21#include <stdexcept>
22#include <string>
23
24class NTupleFile;
25class NTupleDirectory;
26
35namespace NTuple {
36 // local forward declarations
37 template <class TYP>
38 class Range;
39 template <class TYP>
40 class _Data;
41 template <class TYP>
42 class _Item;
43 template <class TYP>
44 class _Array;
45 template <class TYP>
46 class _Matrix;
47 template <class TYP>
48 class _Accessor;
49 template <class TYP>
50 class Item;
51 template <class TYP>
52 class Array;
53 template <class TYP>
54 class Matrix;
55
57 template <class TYP>
58 class Range {
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 m_lower = copy.m_lower;
72 m_upper = copy.m_upper;
73 return *this;
74 }
75
76 virtual ~Range() = default;
78 TYP lower() const { return m_lower; }
80 TYP upper() const { return m_upper; }
82 TYP distance() const { return m_upper - m_lower; } // cppcheck-suppress CastIntegerToAddressAtReturn
84 static TYP min() { return std::numeric_limits<TYP>::min(); }
86 static TYP max() { return std::numeric_limits<TYP>::max(); }
87 };
88
89 template <>
90 class Range<bool> {
91 public:
93 Range( const bool /* low */, const bool /* upper */ ) {}
95 Range( const Range<bool>& /* copy */ ) {}
97 virtual ~Range() = default;
99 bool lower() const { return false; }
101 bool upper() const { return true; }
103 bool distance() const { return true; }
105 static bool min() { return false; }
107 static bool max() { return true; }
108 };
109
110 template <>
112 return (IOpaqueAddress*)0x0;
113 }
114 template <>
116 return (IOpaqueAddress*)0xffffffff;
117 }
118
121 template <class TYP>
122 class GAUDI_API _Data : virtual public INTupleItem {
123 protected:
125 TYP* m_buffer = nullptr;
126
127 public:
131 virtual void setDefault( const TYP d ) = 0; // cppcheck-suppress passedByValue; small type
133 virtual const ItemRange& range() const = 0;
134 };
135
138 template <class TYP>
139 class GAUDI_API _Item : virtual public _Data<TYP> {
140 public:
142 static _Item* create( INTuple* tup, const std::string& name, const std::type_info& info, TYP min, TYP max,
143 TYP def );
145 template <class T>
146 _Item<TYP>& operator=( const _Item<T>& copy ) {
147 *this->m_buffer = copy.get();
148 return *this;
149 }
150
151 void set( const TYP& item ) { *this->m_buffer = item; }
153 virtual TYP get() const { return *this->m_buffer; }
154 };
155
158 template <class TYP>
159 class GAUDI_API _Array : virtual public _Data<TYP> {
160 public:
162 static _Array* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
163 long len, TYP min, TYP max, TYP def );
165 template <class T>
167 long len = this->length();
168 if ( len == copy.length() ) {
169 const T* source = (const T*)copy.buffer();
170 std::copy_n( source, len, this->m_buffer );
171 return *this;
172 }
173 throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
174 return *this;
175 }
176
177 const TYP& data( long i ) const { return this->m_buffer[i]; }
179 TYP& data( long i ) { return this->m_buffer[i]; }
180
181 TYP* begin() { return this->m_buffer; }
182 TYP* end() { return this->m_buffer + this->length(); }
183 };
184
187 template <class TYP>
188 class GAUDI_API _Matrix : virtual public _Data<TYP> {
189 protected:
191 long m_rows;
192
193 public:
195 static _Matrix* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
196 long ncol, long nrow, TYP min, TYP max, TYP def );
198 template <class T>
200 long len = this->length();
201 if ( len == copy.length() ) {
202 const T* source = (const T*)copy.buffer();
203 std::copy_n( source, len, this->m_buffer );
204 return *this;
205 }
206 throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
207 return *this;
208 }
209
210 TYP* column( long i ) { return this->m_buffer + i * m_rows; }
212 const TYP* column( long i ) const { return this->m_buffer + i * m_rows; }
213 };
214
217 template <class TYP>
218 class _Accessor {
219 friend class Tuple;
220
221 private:
224
225 protected:
227 mutable TYP* m_ptr = nullptr;
228
229 public:
231 _Accessor() = default;
233 virtual ~_Accessor() = default;
235 _Accessor( const _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>
251 class Item : virtual public _Accessor<_Item<TYP>> {
252 typedef Item<TYP> _My;
253
254 public:
256 Item() = default;
258 operator const TYP() const { return this->m_ptr->get(); }
260 TYP operator*() { return this->m_ptr->get(); }
262 const TYP operator*() const { return this->m_ptr->get(); }
263 // Arithmetic operators defined on NTuple column entries
264 Item& operator++() { return *this += TYP( 1 ); }
265 Item& operator++( int ) { return *this += TYP( 1 ); }
266 Item& operator--() { return *this -= TYP( 1 ); }
267 Item& operator--( int ) { return *this -= TYP( 1 ); }
269 Item& operator=( const TYP data ) {
270 this->m_ptr->set( data );
271 return *this;
272 }
273
274 template <class T>
275 Item& operator=( const Item<T>& data ) {
276 this->m_ptr->set( data->get() );
277 return *this;
278 }
279 Item<TYP>& operator+=( const TYP data ) {
280 this->m_ptr->set( this->m_ptr->get() + data );
281 return *this;
282 }
283 Item<TYP>& operator-=( const TYP data ) {
284 this->m_ptr->set( this->m_ptr->get() - data );
285 return *this;
286 }
287 Item<TYP>& operator*=( const TYP data ) {
288 this->m_ptr->set( this->m_ptr->get() * data );
289 return *this;
290 }
291 Item<TYP>& operator/=( const TYP data ) {
292 this->m_ptr->set( this->m_ptr->get() / data );
293 return *this;
294 }
295 };
296
299 template <>
300 class Item<bool> : virtual public _Accessor<_Item<bool>> {
302
303 public:
305 Item() = default;
307 operator bool() const { return this->m_ptr->get(); }
309 Item& operator=( const bool data ) {
310 this->m_ptr->set( data );
311 return *this;
312 }
313
314 template <class T>
315 Item& operator=( const Item<T>& data ) {
316 this->m_ptr->set( data->get() );
317 return *this;
318 }
319 };
320
323 template <class TYP>
324 class Array : virtual public _Accessor<_Array<TYP>> {
325 public:
327 Array() = default;
329 template <class T>
330 Array& operator=( const Array<T>& copy ) {
331 *( this->m_ptr ) = *( copy.operator->() );
332 return *this;
333 }
334
335 template <class T>
336 TYP& operator[]( const T i ) {
337 return this->m_ptr->data( i );
338 }
339
340 template <class T>
341 const TYP& operator[]( const T i ) const {
342 return this->m_ptr->data( i );
343 }
344
345 TYP* begin() { return this->m_ptr->begin(); }
346 TYP* end() { return this->m_ptr->end(); }
347 };
348
351 template <class TYP>
352 class Matrix : virtual public _Accessor<_Matrix<TYP>> {
353 public:
355 Matrix() = default;
357 template <class T>
358 Matrix& operator=( const Matrix<T>& copy ) {
359 *( this->m_ptr ) = *( copy.operator->() );
360 return *this;
361 }
362
363 template <class T>
364 TYP* operator[]( const T i ) {
365 return this->m_ptr->column( i );
366 }
367
368 template <class T>
369 const TYP* operator[]( const T i ) const {
370 return this->m_ptr->column( i );
371 }
372 };
373
380 class Tuple : public DataObject, virtual public INTuple {
381
382 protected:
384 template <class TYPE>
385 StatusCode i_item( const std::string& name, _Item<TYPE>*& result ) const {
386 try {
387 result = dynamic_cast<_Item<TYPE>*>( i_find( name ) );
388 } catch ( ... ) { result = nullptr; }
390 }
391
392 template <class TYPE>
393 StatusCode i_item( const std::string& name, _Item<TYPE*>*& result ) const {
394 try {
395 _Item<void*>* p = dynamic_cast<_Item<void*>*>( i_find( name ) );
396 result = (_Item<TYPE*>*)p;
397 } catch ( ... ) { result = nullptr; }
399 }
400
401 StatusCode i_item( const std::string& name, _Item<IOpaqueAddress*>*& result ) const {
402 try {
403 result = dynamic_cast<_Item<IOpaqueAddress*>*>( i_find( name ) );
404 } catch ( ... ) { result = nullptr; }
406 }
407
408 template <class TYPE>
409 StatusCode i_item( const std::string& name, _Array<TYPE>*& result ) const {
410 try {
411 if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Array<TYPE>*>( i_find( name ) ); }
412 } catch ( ... ) { result = nullptr; }
414 }
415
416 template <class TYPE>
417 StatusCode i_item( const std::string& name, _Matrix<TYPE>*& result ) const {
418 try {
419 if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Matrix<TYPE>*>( i_find( name ) ); }
420 } catch ( ... ) { result = nullptr; }
422 }
423
424 template <class TYPE>
425 StatusCode i_addItem( const std::string& name, long, const std::string&, TYPE low, TYPE high,
426 _Item<TYPE>*& result ) {
427 if ( !i_find( name ) ) {
428 TYPE nil;
429 nil = 0;
430 return add( result = _Item<TYPE>::create( this, name, typeid( TYPE ), low, high, nil ) );
431 }
432 return StatusCode::FAILURE;
433 }
434
435 template <class TYPE>
436 StatusCode i_addItem( const std::string& name, long dim, const std::string& index, TYPE low, TYPE high,
437 _Array<TYPE>*& result ) {
438 if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
439 return add( result = _Array<TYPE>::create( this, name, typeid( TYPE ), index, dim, low, high, TYPE( 0 ) ) );
440 }
441 return StatusCode::FAILURE;
442 }
443
444 template <class TYPE>
445 StatusCode i_addItem( const std::string& name, long dim1, long dim2, const std::string& index, TYPE low, TYPE high,
446 _Matrix<TYPE>*& result ) {
447 if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
448 return add( result =
449 _Matrix<TYPE>::create( this, name, typeid( TYPE ), index, dim1, dim2, low, high, TYPE( 0 ) ) );
450 }
451 return StatusCode::FAILURE;
452 }
453 template <class TYPE>
454 StatusCode i_addObject( const std::string& name, _Item<TYPE*>*& result, const std::type_info& /* typ */ ) {
455 if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
456 return add( result = (_Item<TYPE*>*)_Item<void*>::create( this, name, typeid( TYPE ), 0, 0, 0 ) );
457 }
458 return StatusCode::FAILURE;
459 }
460
461 public:
463 template <class TYPE>
464 StatusCode item( const std::string& name, Item<TYPE>& result ) {
465 return i_item( name, result.m_ptr );
466 }
467
468 template <class TYPE>
469 StatusCode item( const std::string& name, const Item<TYPE>& result ) const {
470 return i_item( name, result.m_ptr );
471 }
472
473 template <class TYPE>
474 StatusCode item( const std::string& name, Array<TYPE>& result ) {
475 return i_item( name, result.m_ptr );
476 }
477
478 template <class TYPE>
479 StatusCode item( const std::string& name, const Array<TYPE>& result ) const {
480 return i_item( name, result.m_ptr );
481 }
482
483 template <class TYPE>
484 StatusCode item( const std::string& name, Matrix<TYPE>& result ) {
485 return i_item( name, result.m_ptr );
486 }
487
489 template <class TYPE>
490 StatusCode item( const std::string& name, const Matrix<TYPE>& result ) const {
491 return i_item( name, result.m_ptr );
492 }
493
507 template <class TYPE>
508 StatusCode addItem( const std::string& name, Item<TYPE>& itm ) {
509 typedef Range<TYPE> _R;
510 return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
511 }
512
521 template <class TYPE>
522 StatusCode addItem( const std::string& name, Item<TYPE*>& itm ) {
523 return i_addObject( name, itm.m_ptr, typeid( TYPE ) );
524 }
525
534 StatusCode addItem( const std::string& name, Item<IOpaqueAddress*>& itm ) {
535 typedef Range<IOpaqueAddress*> _R;
536 return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
537 }
538
556 template <class TYPE, class RANGE>
557 StatusCode addItem( const std::string& name, Item<TYPE>& itm, const RANGE low, const RANGE high ) {
558 return i_addItem( name, 1, "", TYPE( low ), TYPE( high ), itm.m_ptr );
559 }
560
574 template <class TYPE>
575 StatusCode addItem( const std::string& name, long dim, Array<TYPE>& array ) {
576 return i_addItem( name, dim, "", Range<TYPE>::min(), Range<TYPE>::max(), array.m_ptr );
577 }
578
598 template <class TYPE, class RANGE>
599 StatusCode addItem( const std::string& name, long dim, Array<TYPE>& array, const RANGE low, const RANGE high ) {
600 return i_addItem( name, dim, "", TYPE( low ), TYPE( high ), array.m_ptr );
601 }
602
633 template <class TYPE, class INDEX, class RANGE>
634 StatusCode addItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array, const RANGE low,
635 const RANGE high ) {
636 return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
637 }
638
664 template <class TYPE, class INDEX, class RANGE>
665 StatusCode addIndexedItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array, const RANGE low,
666 const RANGE high ) {
667 return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
668 }
669
694 template <class TYPE, class INDEX>
695 StatusCode addItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array ) {
696 return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
697 array.m_ptr );
698 }
699
719 template <class TYPE, class INDEX>
720 StatusCode addIndexedItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array ) {
721 return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
722 array.m_ptr );
723 }
724
742 template <class TYPE>
743 StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& matrix ) {
744 return i_addItem( name, cols, rows, "", Range<TYPE>::min(), Range<TYPE>::max(), matrix.m_ptr );
745 }
746
769 template <class TYPE, class RANGE>
770 StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& result, const RANGE low,
771 const RANGE high ) {
772 return i_addItem( name, cols, rows, "", TYPE( low ), TYPE( high ), result.m_ptr );
773 }
774
800 template <class TYPE, class INDEX>
801 StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows ) {
802 return i_addItem( name, index->range().distance(), rows, index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
803 matrix.m_ptr );
804 }
805
826 template <class TYPE, class INDEX>
827 StatusCode addIndexedItem( const std::string& name, Item<INDEX>& col_index, long rows, Matrix<TYPE>& matrix ) {
828 return i_addItem( name, col_index->range().distance(), rows, col_index->name(), Range<TYPE>::min(),
829 Range<TYPE>::max(), matrix.m_ptr );
830 }
831
864 template <class TYPE, class INDEX, class RANGE>
865 StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows, const RANGE low,
866 const RANGE high ) {
867 return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
868 }
869
897 template <class TYPE, class INDEX, class RANGE>
898 StatusCode addIndexedItem( const std::string& name, Item<INDEX>& index, long rows, Matrix<TYPE>& matrix,
899 const RANGE low, const RANGE high ) {
900 return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
901 }
902 };
903
908 static const CLID& classID() { return CLID_NTupleDirectory; }
910 const CLID& clID() const override { return classID(); }
911 };
912
915 class File : public Directory {
916 protected:
918 std::string m_name;
920 std::string m_logName;
922 long m_type = 0;
924 bool m_isOpen = false;
925
926 public:
927 File() = default;
929 File( long type, std::string name, std::string logName )
930 : m_name( std::move( name ) ), m_logName( std::move( logName ) ), m_type( type ) {}
931
933 static const CLID& classID() { return CLID_NTupleFile; }
935 const CLID& clID() const override { return classID(); }
937 void setType( const long typ ) { m_type = typ; }
939 long type() const { return m_type; }
941 const std::string& name() const { return m_name; }
943 void setName( std::string nam ) { m_name = std::move( nam ); }
945 const std::string& logicalName() const { return m_logName; }
947 void setLogicalName( std::string l ) { m_logName = std::move( l ); }
949 void setOpen( bool flag ) { m_isOpen = flag; }
951 bool isOpen() const { return m_isOpen; }
952 };
953
954 // inhibit certain types by defining specialized templates which do not
955 // allow for construction.
956 template <>
958 Array() = delete;
959
960 public:
961 virtual ~Array() = default;
962 virtual void dummy() = 0;
963 };
964 template <>
966 Matrix() = delete;
967
968 public:
969 virtual ~Matrix() = default;
970 virtual void dummy() = 0;
971 };
972
973#ifndef ALLOW_ALL_TYPES
974#else
975 typedef Item<bool> BoolItem;
976 typedef Item<char> CharItem;
977 typedef Item<unsigned char> UCharItem;
978 typedef Item<short> ShortItem;
979 typedef Item<unsigned short> UShortItem;
980 typedef Item<long> LongItem;
981 typedef Item<long long> LongLongItem;
982 typedef Item<unsigned long> ULongItem;
983 typedef Item<unsigned long long> ULongLongItem;
984 typedef Item<int> IntItem;
985 typedef Item<unsigned int> UIntItem;
986 typedef Item<float> FloatItem;
987 typedef Item<double> DoubleItem;
988 typedef Array<bool> BoolArray;
989 typedef Array<char> CharArray;
990 typedef Array<unsigned char> UCharArray;
991 typedef Array<short> ShortArray;
992 typedef Array<unsigned short> UShortArray;
993 typedef Array<long> LongArray;
994 typedef Array<unsigned long> ULongArray;
995 typedef Array<int> IntArray;
996 typedef Array<unsigned int> UIntArray;
997 typedef Array<float> FloatArray;
998 typedef Array<double> DoubleArray;
999 typedef Matrix<bool> BoolMatrix;
1000 typedef Matrix<char> CharMatrix;
1001 typedef Matrix<unsigned char> UCharMatrix;
1002 typedef Matrix<short> ShortMatrix;
1003 typedef Matrix<unsigned short> UShortMatrix;
1004 typedef Matrix<long> LongMatrix;
1005 typedef Matrix<unsigned long> ULongMatrix;
1006 typedef Matrix<int> IntMatrix;
1007 typedef Matrix<unsigned int> UIntMatrix;
1008 typedef Matrix<float> FloatMatrix;
1009 typedef Matrix<double> DoubleMatrix;
1010#endif
1011
1012 template <class T>
1013 inline std::ostream& operator<<( std::ostream& s, const Item<T>& obj ) {
1014 return s << T( obj );
1015 }
1016} // namespace NTuple
1017
1018// Useful:
unsigned int CLID
Class ID definition.
Definition ClassID.h:16
#define GAUDI_API
Definition Kernel.h:49
SmartDataPtr< NTuple::Directory > NTupleDirPtr
Definition NTuple.h:1020
SmartDataPtr< NTuple::Tuple > NTuplePtr
Definition NTuple.h:1019
SmartDataPtr< NTuple::File > NTupleFilePtr
Definition NTuple.h:1021
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
virtual const CLID & clID() const
Retrieve reference to class definition structure.
DataObject()
Standard Constructor.
NTuple interface class definition.
Definition INTuple.h:86
virtual INTupleItem * i_find(const std::string &name) const =0
Internally used by abstract classes.
virtual StatusCode add(INTupleItem *item)=0
Add an item row to the N tuple.
NTuple interface class definition.
Definition INTuple.h:32
virtual const void * buffer() const =0
Access data buffer (CONST)
virtual const std::string & index() const =0
Access the index _Item.
virtual long length() const =0
Access the buffer length.
virtual const std::string & name() const =0
Access _Item name.
Opaque address interface definition.
Class acting as a smart pointer holding a N tuple entry.
Definition NTuple.h:218
TYP * m_ptr
Pointer to instance.
Definition NTuple.h:227
virtual ~_Accessor()=default
Standard Destructor.
_Accessor()=default
Standard Constructor.
_Accessor(const _Accessor &)=default
Default copy constructor.
TYP * operator->()
Dereference operator.
Definition NTuple.h:241
bool operator!() const
Check if column is present.
Definition NTuple.h:237
friend class Tuple
Definition NTuple.h:219
const Range< TYP > & range() const
Access the range.
Definition NTuple.h:245
const TYP * operator->() const
Dereference operator (CONST)
Definition NTuple.h:243
_Accessor< TYP > & operator=(const _Accessor< TYP > &)=delete
Needs to be implemented in derived classes.
Abstract class describing a column-array in a N tuple.
Definition NTuple.h:159
_Array< TYP > & operator=(const _Array< T > &copy)
Assignment operator.
Definition NTuple.h:166
TYP * begin()
Definition NTuple.h:181
TYP * end()
Definition NTuple.h:182
const TYP & data(long i) const
Access to data by reference (CONST)
Definition NTuple.h:177
TYP & data(long i)
Access to data by reference (CONST)
Definition NTuple.h:179
static _Array * create(INTuple *tup, const std::string &name, const std::type_info &info, const std::string &index, long len, TYP min, TYP max, TYP def)
Create instance.
Abstract class describing basic data in an Ntuple.
Definition NTuple.h:122
virtual void setDefault(const TYP d)=0
Set default value.
virtual const ItemRange & range() const =0
Access the range if specified.
TYP * m_buffer
Pointer to data buffer.
Definition NTuple.h:125
Range< TYP > ItemRange
Set type definition to make life more easy easy.
Definition NTuple.h:129
Abstract class describing a column in a N tuple.
Definition NTuple.h:139
_Item< TYP > & operator=(const _Item< T > &copy)
Assignment operator.
Definition NTuple.h:146
void set(const TYP &item)
Access to data by reference.
Definition NTuple.h:151
virtual TYP get() const
Access to data by reference (CONST)
Definition NTuple.h:153
static _Item * create(INTuple *tup, const std::string &name, const std::type_info &info, TYP min, TYP max, TYP def)
Create instance.
Abstract class describing a matrix column in a N tuple.
Definition NTuple.h:188
static _Matrix * create(INTuple *tup, const std::string &name, const std::type_info &info, const std::string &index, long ncol, long nrow, TYP min, TYP max, TYP def)
Create instance.
_Matrix< TYP > & operator=(const _Matrix< T > &copy)
Assignment operator.
Definition NTuple.h:199
TYP * column(long i)
Access to data by reference.
Definition NTuple.h:210
const TYP * column(long i) const
Access to data by reference (CONST)
Definition NTuple.h:212
long m_rows
Number of rows per column.
Definition NTuple.h:191
Class acting as a smart pointer holding a N tuple _Item.
Definition NTuple.h:324
TYP & operator[](const T i)
Array operator.
Definition NTuple.h:336
TYP * begin()
Definition NTuple.h:345
TYP * end()
Definition NTuple.h:346
Array & operator=(const Array< T > &copy)
Assignment operator.
Definition NTuple.h:330
const TYP & operator[](const T i) const
Array operator.
Definition NTuple.h:341
Array()=default
Standard Constructor.
void setLogicalName(std::string l)
Definition NTuple.h:947
std::string m_name
Physical file name.
Definition NTuple.h:918
static const CLID & classID()
class ID of the object
Definition NTuple.h:933
File()=default
bool m_isOpen
Flag to indicate wether the file was opened already.
Definition NTuple.h:924
File(long type, std::string name, std::string logName)
Standard constructor.
Definition NTuple.h:929
long m_type
Access type.
Definition NTuple.h:922
std::string m_logName
Logical file name.
Definition NTuple.h:920
void setOpen(bool flag)
Set "open" flag.
Definition NTuple.h:949
long type() const
Return access type.
Definition NTuple.h:939
void setName(std::string nam)
Set access type.
Definition NTuple.h:943
void setType(const long typ)
Set access type.
Definition NTuple.h:937
bool isOpen() const
Access "open" flag.
Definition NTuple.h:951
const std::string & name() const
Retrun physical file name.
Definition NTuple.h:941
const CLID & clID() const override
class ID of the object
Definition NTuple.h:935
const std::string & logicalName() const
Definition NTuple.h:945
Class acting as a smart pointer holding a N tuple _Item.
Definition NTuple.h:251
Item< bool > _My
Definition NTuple.h:301
Item< TYP > & operator*=(const TYP data)
Definition NTuple.h:287
Item()=default
Standard Constructor.
TYP operator*()
Dereference operator for pointers.
Definition NTuple.h:260
Item & operator=(const Item< T > &data)
Assignment operator.
Definition NTuple.h:275
Item & operator++(int)
Definition NTuple.h:265
Item< TYP > _My
Definition NTuple.h:252
Item & operator--()
Definition NTuple.h:266
Item()=default
Standard Constructor.
Item & operator++()
Definition NTuple.h:264
Item< TYP > & operator+=(const TYP data)
Definition NTuple.h:279
const TYP operator*() const
Dereference operator for pointers(CONST)
Definition NTuple.h:262
Item & operator=(const TYP data)
Assignment operator.
Definition NTuple.h:269
Item & operator--(int)
Definition NTuple.h:267
Item & operator=(const Item< T > &data)
Assignment operator.
Definition NTuple.h:315
Item< TYP > & operator/=(const TYP data)
Definition NTuple.h:291
Item & operator=(const bool data)
Assignment operator.
Definition NTuple.h:309
Item< TYP > & operator-=(const TYP data)
Definition NTuple.h:283
Class acting as a smart pointer holding a N tuple _Item.
Definition NTuple.h:352
const TYP * operator[](const T i) const
Array operator.
Definition NTuple.h:369
TYP * operator[](const T i)
Array operator.
Definition NTuple.h:364
Matrix()=default
Standard Constructor.
Matrix & operator=(const Matrix< T > &copy)
Assignment operator.
Definition NTuple.h:358
Class defining a range.
Definition NTuple.h:58
static TYP min()
Minimal number of data.
Definition NTuple.h:84
TYP lower() const
Lower boundary of range.
Definition NTuple.h:78
TYP upper() const
Upper boundary of range.
Definition NTuple.h:80
bool upper() const
Upper boundary of range.
Definition NTuple.h:101
TYP distance() const
Distance between lower and upper range.
Definition NTuple.h:82
virtual ~Range()=default
Destructor.
bool lower() const
Lower boundary of range.
Definition NTuple.h:99
TYP m_lower
Lower boundary of range.
Definition NTuple.h:60
Range(const Range< TYP > &copy)
Copy constructor.
Definition NTuple.h:68
static TYP max()
Maximal number of data.
Definition NTuple.h:86
Range(const Range< bool > &)
Copy constructor.
Definition NTuple.h:95
TYP m_upper
Upper boundary of range.
Definition NTuple.h:62
bool distance() const
Distance between lower and upper range.
Definition NTuple.h:103
Range & operator=(const Range< TYP > &copy)
Adjust ranges.
Definition NTuple.h:70
static bool max()
Maximal number of data.
Definition NTuple.h:107
static bool min()
Minimal number of data.
Definition NTuple.h:105
Range(const bool, const bool)
Standard constructor.
Definition NTuple.h:93
Range(TYP low, TYP upper)
Standard constructor.
Definition NTuple.h:66
virtual ~Range()=default
Destructor.
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition NTuple.h:380
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:665
StatusCode i_addObject(const std::string &name, _Item< TYPE * > *&result, const std::type_info &)
Definition NTuple.h:454
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:827
StatusCode addItem(const std::string &name, Item< IOpaqueAddress * > &itm)
Add an address object item to an N tuple: specialized call.
Definition NTuple.h:534
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:445
StatusCode item(const std::string &name, Item< TYPE > &result)
Locate a scalar Item of data to the N tuple type safe.
Definition NTuple.h:464
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:599
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:401
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:720
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:557
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:469
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:436
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:575
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:409
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:865
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:393
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:634
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:490
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:385
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:898
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:695
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:417
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:479
StatusCode addItem(const std::string &name, Item< TYPE * > &itm)
Add an simple object item to an N tuple.
Definition NTuple.h:522
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:801
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition NTuple.h:508
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:770
StatusCode item(const std::string &name, Array< TYPE > &result)
Locate a Array of data to the N tuple type safe.
Definition NTuple.h:474
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:425
StatusCode item(const std::string &name, Matrix< TYPE > &result)
Locate a Matrix of data to the N tuple type safe.
Definition NTuple.h:484
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:743
A small class used to access easily (and efficiently) data items residing in data stores.
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
constexpr static const auto SUCCESS
Definition StatusCode.h:99
constexpr static const auto FAILURE
Definition StatusCode.h:100
NTuple name space.
Definition INTupleSvc.h:16
std::ostream & operator<<(std::ostream &s, const Item< T > &obj)
Definition NTuple.h:1013
STL namespace.
Small class representing an N tuple directory in the transient store.
Definition NTuple.h:906
static const CLID & classID()
class ID of the object
Definition NTuple.h:908
const CLID & clID() const override
class ID of the object
Definition NTuple.h:910