File indexing completed on 2025-02-21 10:00:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef GAUDIKERNEL_NTUPLEIMP_H
0012 #define GAUDIKERNEL_NTUPLEIMP_H
0013
0014 #include <memory>
0015
0016 #include "GaudiKernel/Kernel.h"
0017 #include "GaudiKernel/NTuple.h"
0018 #include "GaudiKernel/SmartIF.h"
0019
0020
0021 class INTupleSvc;
0022 class IConversionSvc;
0023
0024 namespace NTuple {
0025
0026 class GAUDI_API TupleImp : public Tuple {
0027 protected:
0028
0029 ItemContainer m_items;
0030
0031 bool m_isBooked = false;
0032
0033 std::string m_title;
0034
0035 SmartIF<ISelectStatement> m_pSelector;
0036
0037 std::unique_ptr<char[]> m_buffer;
0038
0039 INTupleSvc* m_ntupleSvc = nullptr;
0040
0041 IConversionSvc* m_cnvSvc = nullptr;
0042
0043 private:
0044
0045 TupleImp( const TupleImp& ) = delete;
0046
0047 public:
0048
0049 INTupleItem* i_find( const std::string& name ) const override;
0050
0051 public:
0052
0053 TupleImp( std::string title );
0054
0055 ~TupleImp() override;
0056
0057 ItemContainer& items() override { return m_items; }
0058
0059 const ItemContainer& items() const override { return m_items; }
0060
0061 const std::string& title() const override { return m_title; }
0062
0063 const INTupleItem* find( const std::string& name ) const override { return i_find( name ); }
0064
0065 INTupleItem* find( const std::string& name ) override { return i_find( name ); }
0066
0067 char* buffer() override { return m_buffer.get(); }
0068
0069 const char* buffer() const override { return m_buffer.get(); }
0070
0071 IConversionSvc* conversionService() const { return m_cnvSvc; }
0072
0073 void setConversionService( IConversionSvc* svc ) { m_cnvSvc = svc; }
0074
0075 INTupleSvc* tupleService() const { return m_ntupleSvc; }
0076
0077 void setTupleService( INTupleSvc* svc ) { m_ntupleSvc = svc; }
0078
0079 StatusCode attachSelector( ISelectStatement* sel ) override;
0080
0081 ISelectStatement* selector() override;
0082
0083 virtual char* setBuffer( std::unique_ptr<char[]>&& buff );
0084 char* setBuffer( char* buff ) override;
0085
0086 void reset() override;
0087
0088 StatusCode add( INTupleItem* item ) override;
0089
0090 StatusCode remove( INTupleItem* item ) override;
0091
0092 StatusCode remove( const std::string& name ) override;
0093
0094 StatusCode write() override;
0095
0096 StatusCode writeRecord() override;
0097
0098 StatusCode read() override;
0099
0100 StatusCode readRecord() override;
0101
0102 StatusCode save() override;
0103
0104 };
0105
0106
0107 class ColumnWiseTuple : public TupleImp {
0108 public:
0109
0110 ColumnWiseTuple( std::string title ) : TupleImp( std::move( title ) ) {}
0111
0112 const CLID& clID() const override { return classID(); }
0113
0114 static const CLID& classID() { return CLID_ColumnWiseTuple; }
0115 };
0116
0117
0118 class RowWiseTuple : public TupleImp {
0119 public:
0120
0121 RowWiseTuple( std::string title ) : TupleImp( std::move( title ) ) {}
0122
0123 const CLID& clID() const override { return classID(); }
0124
0125 static const CLID& classID() { return CLID_RowWiseTuple; }
0126 };
0127 }
0128
0129 #endif