File indexing completed on 2025-01-30 10:07:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef GAUDIKERNEL_NTUPLE_H
0012 #define GAUDIKERNEL_NTUPLE_H
0013
0014
0015
0016 #include "GaudiKernel/DataObject.h"
0017 #include "GaudiKernel/DataTypeInfo.h"
0018 #include "GaudiKernel/INTuple.h"
0019 #include "GaudiKernel/IOpaqueAddress.h"
0020 #include "GaudiKernel/SmartDataPtr.h"
0021
0022
0023
0024 #include <algorithm>
0025 #include <cfloat>
0026 #include <limits>
0027 #include <stdexcept>
0028 #include <string>
0029
0030
0031
0032 class NTupleFile;
0033 class NTupleDirectory;
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 namespace NTuple {
0044
0045 template <class TYP>
0046 class Range;
0047 template <class TYP>
0048 class _Data;
0049 template <class TYP>
0050 class _Item;
0051 template <class TYP>
0052 class _Array;
0053 template <class TYP>
0054 class _Matrix;
0055 template <class TYP>
0056 class _Accessor;
0057 template <class TYP>
0058 class Item;
0059 template <class TYP>
0060 class Array;
0061 template <class TYP>
0062 class Matrix;
0063
0064
0065 template <class TYP>
0066 class Range {
0067
0068 TYP m_lower;
0069
0070 TYP m_upper;
0071
0072 public:
0073
0074 Range( TYP low, TYP upper ) : m_lower( std::move( low ) ), m_upper( std::move( upper ) ) {}
0075
0076 Range( const Range<TYP>& copy ) : m_lower( copy.m_lower ), m_upper( copy.m_upper ) {}
0077
0078 Range& operator=( const Range<TYP>& copy ) {
0079 m_lower = copy.m_lower;
0080 m_upper = copy.m_upper;
0081 return *this;
0082 }
0083
0084 virtual ~Range() = default;
0085
0086 TYP lower() const { return m_lower; }
0087
0088 TYP upper() const { return m_upper; }
0089
0090 TYP distance() const { return m_upper - m_lower; }
0091
0092 static TYP min() { return std::numeric_limits<TYP>::min(); }
0093
0094 static TYP max() { return std::numeric_limits<TYP>::max(); }
0095 };
0096
0097 template <>
0098 class Range<bool> {
0099 public:
0100
0101 Range( const bool , const bool ) {}
0102
0103 Range( const Range<bool>& ) {}
0104
0105 virtual ~Range() = default;
0106
0107 bool lower() const { return false; }
0108
0109 bool upper() const { return true; }
0110
0111 bool distance() const { return true; }
0112
0113 static bool min() { return false; }
0114
0115 static bool max() { return true; }
0116 };
0117
0118 template <>
0119 inline IOpaqueAddress* Range<IOpaqueAddress*>::min() {
0120 return (IOpaqueAddress*)0x0;
0121 }
0122 template <>
0123 inline IOpaqueAddress* Range<IOpaqueAddress*>::max() {
0124 return (IOpaqueAddress*)0xffffffff;
0125 }
0126
0127
0128
0129 template <class TYP>
0130 class GAUDI_API _Data : virtual public INTupleItem {
0131 protected:
0132
0133 TYP* m_buffer = nullptr;
0134
0135 public:
0136
0137 typedef Range<TYP> ItemRange;
0138
0139 virtual void setDefault( const TYP d ) = 0;
0140
0141 virtual const ItemRange& range() const = 0;
0142 };
0143
0144
0145
0146 template <class TYP>
0147 class GAUDI_API _Item : virtual public _Data<TYP> {
0148 public:
0149
0150 static _Item* create( INTuple* tup, const std::string& name, const std::type_info& info, TYP min, TYP max,
0151 TYP def );
0152
0153 template <class T>
0154 _Item<TYP>& operator=( const _Item<T>& copy ) {
0155 *this->m_buffer = copy.get();
0156 return *this;
0157 }
0158
0159 void set( const TYP& item ) { *this->m_buffer = item; }
0160
0161 virtual TYP get() const { return *this->m_buffer; }
0162 };
0163
0164
0165
0166 template <class TYP>
0167 class GAUDI_API _Array : virtual public _Data<TYP> {
0168 public:
0169
0170 static _Array* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
0171 long len, TYP min, TYP max, TYP def );
0172
0173 template <class T>
0174 _Array<TYP>& operator=( const _Array<T>& copy ) {
0175 long len = this->length();
0176 if ( len == copy.length() ) {
0177 const T* source = (const T*)copy.buffer();
0178 std::copy_n( source, len, this->m_buffer );
0179 return *this;
0180 }
0181 throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
0182 return *this;
0183 }
0184
0185 const TYP& data( long i ) const { return this->m_buffer[i]; }
0186
0187 TYP& data( long i ) { return this->m_buffer[i]; }
0188
0189 TYP* begin() { return this->m_buffer; }
0190 TYP* end() { return this->m_buffer + this->length(); }
0191 };
0192
0193
0194
0195 template <class TYP>
0196 class GAUDI_API _Matrix : virtual public _Data<TYP> {
0197 protected:
0198
0199 long m_rows;
0200
0201 public:
0202
0203 static _Matrix* create( INTuple* tup, const std::string& name, const std::type_info& info, const std::string& index,
0204 long ncol, long nrow, TYP min, TYP max, TYP def );
0205
0206 template <class T>
0207 _Matrix<TYP>& operator=( const _Matrix<T>& copy ) {
0208 long len = this->length();
0209 if ( len == copy.length() ) {
0210 const T* source = (const T*)copy.buffer();
0211 std::copy_n( source, len, this->m_buffer );
0212 return *this;
0213 }
0214 throw std::out_of_range( "N-tuple matrix cannot be copied! The index range does not match!" );
0215 return *this;
0216 }
0217
0218 TYP* column( long i ) { return this->m_buffer + i * m_rows; }
0219
0220 const TYP* column( long i ) const { return this->m_buffer + i * m_rows; }
0221 };
0222
0223
0224
0225 template <class TYP>
0226 class _Accessor {
0227 friend class Tuple;
0228
0229 private:
0230 _Accessor<TYP>& operator=( const _Accessor<TYP>& ) { return *this; }
0231
0232 protected:
0233
0234 mutable TYP* m_ptr = nullptr;
0235
0236 public:
0237
0238 _Accessor() = default;
0239
0240 virtual ~_Accessor() = default;
0241
0242 _Accessor( const _Accessor& ) = default;
0243
0244 bool operator!() const { return m_ptr != 0; }
0245
0246 operator const void*() const { return m_ptr; }
0247
0248 TYP* operator->() { return m_ptr; }
0249
0250 const TYP* operator->() const { return m_ptr; }
0251
0252 const Range<TYP>& range() const { return m_ptr->range(); }
0253 };
0254
0255
0256
0257 template <class TYP>
0258 class Item : virtual public _Accessor<_Item<TYP>> {
0259 typedef Item<TYP> _My;
0260
0261 public:
0262
0263 Item() = default;
0264
0265 operator const TYP() const { return this->m_ptr->get(); }
0266
0267 TYP operator*() { return this->m_ptr->get(); }
0268
0269 const TYP operator*() const { return this->m_ptr->get(); }
0270
0271 Item& operator++() { return *this += TYP( 1 ); }
0272 Item& operator++( int ) { return *this += TYP( 1 ); }
0273 Item& operator--() { return *this -= TYP( 1 ); }
0274 Item& operator--( int ) { return *this -= TYP( 1 ); }
0275
0276 Item& operator=( const TYP data ) {
0277 this->m_ptr->set( data );
0278 return *this;
0279 }
0280
0281 template <class T>
0282 Item& operator=( const Item<T>& data ) {
0283 this->m_ptr->set( data->get() );
0284 return *this;
0285 }
0286 Item<TYP>& operator+=( const TYP data ) {
0287 this->m_ptr->set( this->m_ptr->get() + data );
0288 return *this;
0289 }
0290 Item<TYP>& operator-=( const TYP data ) {
0291 this->m_ptr->set( this->m_ptr->get() - data );
0292 return *this;
0293 }
0294 Item<TYP>& operator*=( const TYP data ) {
0295 this->m_ptr->set( this->m_ptr->get() * data );
0296 return *this;
0297 }
0298 Item<TYP>& operator/=( const TYP data ) {
0299 this->m_ptr->set( this->m_ptr->get() / data );
0300 return *this;
0301 }
0302 };
0303
0304
0305
0306 template <>
0307 class Item<bool> : virtual public _Accessor<_Item<bool>> {
0308 typedef Item<bool> _My;
0309
0310 public:
0311
0312 Item() = default;
0313
0314 operator bool() const { return this->m_ptr->get(); }
0315
0316 Item& operator=( const bool data ) {
0317 this->m_ptr->set( data );
0318 return *this;
0319 }
0320
0321 template <class T>
0322 Item& operator=( const Item<T>& data ) {
0323 this->m_ptr->set( data->get() );
0324 return *this;
0325 }
0326 };
0327
0328
0329
0330 template <class TYP>
0331 class Array : virtual public _Accessor<_Array<TYP>> {
0332 public:
0333
0334 Array() = default;
0335
0336 template <class T>
0337 Array& operator=( const Array<T>& copy ) {
0338 *( this->m_ptr ) = *( copy.operator->() );
0339 return *this;
0340 }
0341
0342 template <class T>
0343 TYP& operator[]( const T i ) {
0344 return this->m_ptr->data( i );
0345 }
0346
0347 template <class T>
0348 const TYP& operator[]( const T i ) const {
0349 return this->m_ptr->data( i );
0350 }
0351
0352 TYP* begin() { return this->m_ptr->begin(); }
0353 TYP* end() { return this->m_ptr->end(); }
0354 };
0355
0356
0357
0358 template <class TYP>
0359 class Matrix : virtual public _Accessor<_Matrix<TYP>> {
0360 public:
0361
0362 Matrix() = default;
0363
0364 template <class T>
0365 Matrix& operator=( const Matrix<T>& copy ) {
0366 *( this->m_ptr ) = *( copy.operator->() );
0367 return *this;
0368 }
0369
0370 template <class T>
0371 TYP* operator[]( const T i ) {
0372 return this->m_ptr->column( i );
0373 }
0374
0375 template <class T>
0376 const TYP* operator[]( const T i ) const {
0377 return this->m_ptr->column( i );
0378 }
0379 };
0380
0381
0382
0383
0384
0385
0386
0387 class Tuple : public DataObject, virtual public INTuple {
0388
0389 protected:
0390
0391 template <class TYPE>
0392 StatusCode i_item( const std::string& name, _Item<TYPE>*& result ) const {
0393 try {
0394 result = dynamic_cast<_Item<TYPE>*>( i_find( name ) );
0395 } catch ( ... ) { result = nullptr; }
0396 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
0397 }
0398
0399 template <class TYPE>
0400 StatusCode i_item( const std::string& name, _Item<TYPE*>*& result ) const {
0401 try {
0402 _Item<void*>* p = dynamic_cast<_Item<void*>*>( i_find( name ) );
0403 result = (_Item<TYPE*>*)p;
0404 } catch ( ... ) { result = nullptr; }
0405 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
0406 }
0407
0408 StatusCode i_item( const std::string& name, _Item<IOpaqueAddress*>*& result ) const {
0409 try {
0410 result = dynamic_cast<_Item<IOpaqueAddress*>*>( i_find( name ) );
0411 } catch ( ... ) { result = nullptr; }
0412 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
0413 }
0414
0415 template <class TYPE>
0416 StatusCode i_item( const std::string& name, _Array<TYPE>*& result ) const {
0417 try {
0418 if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Array<TYPE>*>( i_find( name ) ); }
0419 } catch ( ... ) { result = nullptr; }
0420 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
0421 }
0422
0423 template <class TYPE>
0424 StatusCode i_item( const std::string& name, _Matrix<TYPE>*& result ) const {
0425 try {
0426 if ( clID() == CLID_ColumnWiseTuple ) { result = dynamic_cast<_Matrix<TYPE>*>( i_find( name ) ); }
0427 } catch ( ... ) { result = nullptr; }
0428 return result ? StatusCode::SUCCESS : StatusCode::FAILURE;
0429 }
0430
0431 template <class TYPE>
0432 StatusCode i_addItem( const std::string& name, long, const std::string&, TYPE low, TYPE high,
0433 _Item<TYPE>*& result ) {
0434 if ( !i_find( name ) ) {
0435 TYPE nil;
0436 nil = 0;
0437 return add( result = _Item<TYPE>::create( this, name, typeid( TYPE ), low, high, nil ) );
0438 }
0439 return StatusCode::FAILURE;
0440 }
0441
0442 template <class TYPE>
0443 StatusCode i_addItem( const std::string& name, long dim, const std::string& index, TYPE low, TYPE high,
0444 _Array<TYPE>*& result ) {
0445 if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
0446 return add( result = _Array<TYPE>::create( this, name, typeid( TYPE ), index, dim, low, high, TYPE( 0 ) ) );
0447 }
0448 return StatusCode::FAILURE;
0449 }
0450
0451 template <class TYPE>
0452 StatusCode i_addItem( const std::string& name, long dim1, long dim2, const std::string& index, TYPE low, TYPE high,
0453 _Matrix<TYPE>*& result ) {
0454 if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
0455 return add( result =
0456 _Matrix<TYPE>::create( this, name, typeid( TYPE ), index, dim1, dim2, low, high, TYPE( 0 ) ) );
0457 }
0458 return StatusCode::FAILURE;
0459 }
0460 template <class TYPE>
0461 StatusCode i_addObject( const std::string& name, _Item<TYPE*>*& result, const std::type_info& ) {
0462 if ( !i_find( name ) && clID() == CLID_ColumnWiseTuple ) {
0463 return add( result = (_Item<TYPE*>*)_Item<void*>::create( this, name, typeid( TYPE ), 0, 0, 0 ) );
0464 }
0465 return StatusCode::FAILURE;
0466 }
0467
0468 public:
0469
0470 template <class TYPE>
0471 StatusCode item( const std::string& name, Item<TYPE>& result ) {
0472 return i_item( name, result.m_ptr );
0473 }
0474
0475 template <class TYPE>
0476 StatusCode item( const std::string& name, const Item<TYPE>& result ) const {
0477 return i_item( name, result.m_ptr );
0478 }
0479
0480 template <class TYPE>
0481 StatusCode item( const std::string& name, Array<TYPE>& result ) {
0482 return i_item( name, result.m_ptr );
0483 }
0484
0485 template <class TYPE>
0486 StatusCode item( const std::string& name, const Array<TYPE>& result ) const {
0487 return i_item( name, result.m_ptr );
0488 }
0489
0490 template <class TYPE>
0491 StatusCode item( const std::string& name, Matrix<TYPE>& result ) {
0492 return i_item( name, result.m_ptr );
0493 }
0494
0495
0496 template <class TYPE>
0497 StatusCode item( const std::string& name, const Matrix<TYPE>& result ) const {
0498 return i_item( name, result.m_ptr );
0499 }
0500
0501
0502
0503
0504
0505
0506
0507
0508
0509
0510
0511
0512
0513
0514 template <class TYPE>
0515 StatusCode addItem( const std::string& name, Item<TYPE>& itm ) {
0516 typedef Range<TYPE> _R;
0517 return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
0518 }
0519
0520
0521
0522
0523
0524
0525
0526
0527
0528 template <class TYPE>
0529 StatusCode addItem( const std::string& name, Item<TYPE*>& itm ) {
0530 return i_addObject( name, itm.m_ptr, typeid( TYPE ) );
0531 }
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541 StatusCode addItem( const std::string& name, Item<IOpaqueAddress*>& itm ) {
0542 typedef Range<IOpaqueAddress*> _R;
0543 return i_addItem( name, 1, "", _R::min(), _R::max(), itm.m_ptr );
0544 }
0545
0546
0547
0548
0549
0550
0551
0552
0553
0554
0555
0556
0557
0558
0559
0560
0561
0562
0563 template <class TYPE, class RANGE>
0564 StatusCode addItem( const std::string& name, Item<TYPE>& itm, const RANGE low, const RANGE high ) {
0565 return i_addItem( name, 1, "", TYPE( low ), TYPE( high ), itm.m_ptr );
0566 }
0567
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581 template <class TYPE>
0582 StatusCode addItem( const std::string& name, long dim, Array<TYPE>& array ) {
0583 return i_addItem( name, dim, "", Range<TYPE>::min(), Range<TYPE>::max(), array.m_ptr );
0584 }
0585
0586
0587
0588
0589
0590
0591
0592
0593
0594
0595
0596
0597
0598
0599
0600
0601
0602
0603
0604
0605 template <class TYPE, class RANGE>
0606 StatusCode addItem( const std::string& name, long dim, Array<TYPE>& array, const RANGE low, const RANGE high ) {
0607 return i_addItem( name, dim, "", TYPE( low ), TYPE( high ), array.m_ptr );
0608 }
0609
0610
0611
0612
0613
0614
0615
0616
0617
0618
0619
0620
0621
0622
0623
0624
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636
0637
0638
0639
0640 template <class TYPE, class INDEX, class RANGE>
0641 StatusCode addItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array, const RANGE low,
0642 const RANGE high ) {
0643 return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
0644 }
0645
0646
0647
0648
0649
0650
0651
0652
0653
0654
0655
0656
0657
0658
0659
0660
0661
0662
0663
0664
0665
0666
0667
0668
0669
0670
0671 template <class TYPE, class INDEX, class RANGE>
0672 StatusCode addIndexedItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array, const RANGE low,
0673 const RANGE high ) {
0674 return i_addItem( name, index->range().distance(), index->name(), TYPE( low ), TYPE( high ), array.m_ptr );
0675 }
0676
0677
0678
0679
0680
0681
0682
0683
0684
0685
0686
0687
0688
0689
0690
0691
0692
0693
0694
0695
0696
0697
0698
0699
0700
0701 template <class TYPE, class INDEX>
0702 StatusCode addItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array ) {
0703 return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
0704 array.m_ptr );
0705 }
0706
0707
0708
0709
0710
0711
0712
0713
0714
0715
0716
0717
0718
0719
0720
0721
0722
0723
0724
0725
0726 template <class TYPE, class INDEX>
0727 StatusCode addIndexedItem( const std::string& name, Item<INDEX>& index, Array<TYPE>& array ) {
0728 return i_addItem( name, index->range().distance(), index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
0729 array.m_ptr );
0730 }
0731
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741
0742
0743
0744
0745
0746
0747
0748
0749 template <class TYPE>
0750 StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& matrix ) {
0751 return i_addItem( name, cols, rows, "", Range<TYPE>::min(), Range<TYPE>::max(), matrix.m_ptr );
0752 }
0753
0754
0755
0756
0757
0758
0759
0760
0761
0762
0763
0764
0765
0766
0767
0768
0769
0770
0771
0772
0773
0774
0775
0776 template <class TYPE, class RANGE>
0777 StatusCode addItem( const std::string& name, long cols, long rows, Matrix<TYPE>& result, const RANGE low,
0778 const RANGE high ) {
0779 return i_addItem( name, cols, rows, "", TYPE( low ), TYPE( high ), result.m_ptr );
0780 }
0781
0782
0783
0784
0785
0786
0787
0788
0789
0790
0791
0792
0793
0794
0795
0796
0797
0798
0799
0800
0801
0802
0803
0804
0805
0806
0807 template <class TYPE, class INDEX>
0808 StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows ) {
0809 return i_addItem( name, index->range().distance(), rows, index->name(), Range<TYPE>::min(), Range<TYPE>::max(),
0810 matrix.m_ptr );
0811 }
0812
0813
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826
0827
0828
0829
0830
0831
0832
0833 template <class TYPE, class INDEX>
0834 StatusCode addIndexedItem( const std::string& name, Item<INDEX>& col_index, long rows, Matrix<TYPE>& matrix ) {
0835 return i_addItem( name, col_index->range().distance(), rows, col_index->name(), Range<TYPE>::min(),
0836 Range<TYPE>::max(), matrix.m_ptr );
0837 }
0838
0839
0840
0841
0842
0843
0844
0845
0846
0847
0848
0849
0850
0851
0852
0853
0854
0855
0856
0857
0858
0859
0860
0861
0862
0863
0864
0865
0866
0867
0868
0869
0870
0871 template <class TYPE, class INDEX, class RANGE>
0872 StatusCode addItem( const std::string& name, Item<INDEX>& index, Matrix<TYPE>& matrix, long rows, const RANGE low,
0873 const RANGE high ) {
0874 return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
0875 }
0876
0877
0878
0879
0880
0881
0882
0883
0884
0885
0886
0887
0888
0889
0890
0891
0892
0893
0894
0895
0896
0897
0898
0899
0900
0901
0902
0903
0904 template <class TYPE, class INDEX, class RANGE>
0905 StatusCode addIndexedItem( const std::string& name, Item<INDEX>& index, long rows, Matrix<TYPE>& matrix,
0906 const RANGE low, const RANGE high ) {
0907 return i_addItem( name, index->range().distance(), rows, index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
0908 }
0909 };
0910
0911
0912
0913 struct Directory : DataObject {
0914
0915 static const CLID& classID() { return CLID_NTupleDirectory; }
0916
0917 const CLID& clID() const override { return classID(); }
0918 };
0919
0920
0921
0922 class File : public Directory {
0923 protected:
0924
0925 std::string m_name;
0926
0927 std::string m_logName;
0928
0929 long m_type = 0;
0930
0931 bool m_isOpen = false;
0932
0933 public:
0934 File() = default;
0935
0936 File( long type, std::string name, std::string logName )
0937 : m_name( std::move( name ) ), m_logName( std::move( logName ) ), m_type( type ) {}
0938
0939
0940 static const CLID& classID() { return CLID_NTupleFile; }
0941
0942 const CLID& clID() const override { return classID(); }
0943
0944 void setType( const long typ ) { m_type = typ; }
0945
0946 long type() const { return m_type; }
0947
0948 const std::string& name() const { return m_name; }
0949
0950 void setName( std::string nam ) { m_name = std::move( nam ); }
0951
0952 const std::string& logicalName() const { return m_logName; }
0953
0954 void setLogicalName( std::string l ) { m_logName = std::move( l ); }
0955
0956 void setOpen( bool flag ) { m_isOpen = flag; }
0957
0958 bool isOpen() const { return m_isOpen; }
0959 };
0960
0961
0962
0963 template <>
0964 class Array<IOpaqueAddress*> {
0965 Array() = delete;
0966
0967 public:
0968 virtual ~Array() = default;
0969 virtual void dummy() = 0;
0970 };
0971 template <>
0972 class Matrix<IOpaqueAddress*> {
0973 Matrix() = delete;
0974
0975 public:
0976 virtual ~Matrix() = default;
0977 virtual void dummy() = 0;
0978 };
0979
0980 #ifndef ALLOW_ALL_TYPES
0981 #else
0982 typedef Item<bool> BoolItem;
0983 typedef Item<char> CharItem;
0984 typedef Item<unsigned char> UCharItem;
0985 typedef Item<short> ShortItem;
0986 typedef Item<unsigned short> UShortItem;
0987 typedef Item<long> LongItem;
0988 typedef Item<long long> LongLongItem;
0989 typedef Item<unsigned long> ULongItem;
0990 typedef Item<unsigned long long> ULongLongItem;
0991 typedef Item<int> IntItem;
0992 typedef Item<unsigned int> UIntItem;
0993 typedef Item<float> FloatItem;
0994 typedef Item<double> DoubleItem;
0995 typedef Array<bool> BoolArray;
0996 typedef Array<char> CharArray;
0997 typedef Array<unsigned char> UCharArray;
0998 typedef Array<short> ShortArray;
0999 typedef Array<unsigned short> UShortArray;
1000 typedef Array<long> LongArray;
1001 typedef Array<unsigned long> ULongArray;
1002 typedef Array<int> IntArray;
1003 typedef Array<unsigned int> UIntArray;
1004 typedef Array<float> FloatArray;
1005 typedef Array<double> DoubleArray;
1006 typedef Matrix<bool> BoolMatrix;
1007 typedef Matrix<char> CharMatrix;
1008 typedef Matrix<unsigned char> UCharMatrix;
1009 typedef Matrix<short> ShortMatrix;
1010 typedef Matrix<unsigned short> UShortMatrix;
1011 typedef Matrix<long> LongMatrix;
1012 typedef Matrix<unsigned long> ULongMatrix;
1013 typedef Matrix<int> IntMatrix;
1014 typedef Matrix<unsigned int> UIntMatrix;
1015 typedef Matrix<float> FloatMatrix;
1016 typedef Matrix<double> DoubleMatrix;
1017 #endif
1018
1019 template <class T>
1020 inline std::ostream& operator<<( std::ostream& s, const Item<T>& obj ) {
1021 return s << T( obj );
1022 }
1023 }
1024
1025
1026 typedef SmartDataPtr<NTuple::Tuple> NTuplePtr;
1027 typedef SmartDataPtr<NTuple::Directory> NTupleDirPtr;
1028 typedef SmartDataPtr<NTuple::File> NTupleFilePtr;
1029
1030 #endif