The Gaudi Framework  master (37c0b60a)
NTupleImplementation.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 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 #ifndef GAUDIKERNEL_NTUPLEIMP_H
12 #define GAUDIKERNEL_NTUPLEIMP_H
13 
14 #include <memory>
15 // Framework include files
16 #include <GaudiKernel/Kernel.h>
17 #include <GaudiKernel/NTuple.h>
18 #include <GaudiKernel/SmartIF.h>
19 
20 // Forward declarations
21 class INTupleSvc;
22 class IConversionSvc;
23 
24 namespace NTuple {
25  // Concrete N tuple class definition
26  class GAUDI_API TupleImp : public Tuple {
27  protected:
29  ItemContainer m_items;
31  bool m_isBooked = false;
39  INTupleSvc* m_ntupleSvc = nullptr;
41  IConversionSvc* m_cnvSvc = nullptr;
42 
43  private:
45  TupleImp( const TupleImp& ) = delete;
46 
47  public:
49  INTupleItem* i_find( const std::string& name ) const override;
50 
51  public:
53  TupleImp( std::string title );
55  ~TupleImp() override;
57  ItemContainer& items() override { return m_items; }
59  const ItemContainer& items() const override { return m_items; }
61  const std::string& title() const override { return m_title; }
63  const INTupleItem* find( const std::string& name ) const override { return i_find( name ); }
65  INTupleItem* find( const std::string& name ) override { return i_find( name ); }
67  char* buffer() override { return m_buffer.get(); }
69  const char* buffer() const override { return m_buffer.get(); }
71  IConversionSvc* conversionService() const { return m_cnvSvc; }
73  void setConversionService( IConversionSvc* svc ) { m_cnvSvc = svc; }
75  INTupleSvc* tupleService() const { return m_ntupleSvc; }
77  void setTupleService( INTupleSvc* svc ) { m_ntupleSvc = svc; }
79  StatusCode attachSelector( ISelectStatement* sel ) override;
81  ISelectStatement* selector() override;
83  virtual char* setBuffer( std::unique_ptr<char[]>&& buff );
84  char* setBuffer( char* buff ) override;
86  void reset() override;
88  StatusCode add( INTupleItem* item ) override;
90  StatusCode remove( INTupleItem* item ) override;
92  StatusCode remove( const std::string& name ) override;
94  StatusCode write() override;
96  StatusCode writeRecord() override;
98  StatusCode read() override;
100  StatusCode readRecord() override;
102  StatusCode save() override;
103 
104  }; // end class definition: Tuple
105 
106  // Concrete column wise N tuple class definition
107  class ColumnWiseTuple : public TupleImp {
108  public:
112  const CLID& clID() const override { return classID(); }
114  static const CLID& classID() { return CLID_ColumnWiseTuple; }
115  }; // end class definition: ColumnWiseTuple
116 
117  // Concrete column wise N tuple class definition
118  class RowWiseTuple : public TupleImp {
119  public:
123  const CLID& clID() const override { return classID(); }
125  static const CLID& classID() { return CLID_RowWiseTuple; }
126  }; // end class definition: RowWiseTuple
127 } // namespace NTuple
128 
129 #endif // GAUDIKERNEL_NTUPLEIMP_H
NTuple::TupleImp::title
const std::string & title() const override
Object title.
Definition: NTupleImplementation.h:61
NTuple::TupleImp::m_buffer
std::unique_ptr< char[]> m_buffer
Buffer.
Definition: NTupleImplementation.h:37
NTuple::TupleImp::items
const ItemContainer & items() const override
Access item container (CONST)
Definition: NTupleImplementation.h:59
std::string
STL class.
NTuple::ColumnWiseTuple
Definition: NTupleImplementation.h:107
NTuple::TupleImp::conversionService
IConversionSvc * conversionService() const
Access conversion service.
Definition: NTupleImplementation.h:71
NTuple::RowWiseTuple
Definition: NTupleImplementation.h:118
std::unique_ptr::get
T get(T... args)
ISelectStatement
Definition: ISelectStatement.h:42
NTuple::TupleImp::tupleService
INTupleSvc * tupleService() const
Access conversion service.
Definition: NTupleImplementation.h:75
NTuple::TupleImp::TupleImp
TupleImp(const TupleImp &)=delete
Standard Copy Constructor.
NTuple::RowWiseTuple::classID
static const CLID & classID()
Static access to class defininition structure.
Definition: NTupleImplementation.h:125
NTuple::ColumnWiseTuple::classID
static const CLID & classID()
Static access to class defininition structure.
Definition: NTupleImplementation.h:114
NTuple::TupleImp
Definition: NTupleImplementation.h:26
NTuple::TupleImp::find
INTupleItem * find(const std::string &name) override
Find an item row of the Ntuple.
Definition: NTupleImplementation.h:65
SmartIF.h
NTuple::ColumnWiseTuple::clID
const CLID & clID() const override
Retrieve Reference to class defininition structure.
Definition: NTupleImplementation.h:112
StatusCode
Definition: StatusCode.h:65
NTuple::TupleImp::find
const INTupleItem * find(const std::string &name) const override
Find an item row of the Ntuple (CONST)
Definition: NTupleImplementation.h:63
NTuple.h
NTuple::RowWiseTuple::clID
const CLID & clID() const override
Retrieve Reference to class defininition structure.
Definition: NTupleImplementation.h:123
SmartIF< ISelectStatement >
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
NTuple::TupleImp::m_title
std::string m_title
N tuple title.
Definition: NTupleImplementation.h:33
INTupleItem
Definition: INTuple.h:37
IOTest.sel
sel
Definition: IOTest.py:106
NTuple::RowWiseTuple::RowWiseTuple
RowWiseTuple(std::string title)
Standard Constructor.
Definition: NTupleImplementation.h:121
NTuple::TupleImp::buffer
const char * buffer() const override
Access N tuple data buffer (CONST)
Definition: NTupleImplementation.h:69
hivetimeline.read
def read(f, regex=".*", skipevents=0)
Definition: hivetimeline.py:32
NTuple::TupleImp::m_pSelector
SmartIF< ISelectStatement > m_pSelector
Possibly hanging selector.
Definition: NTupleImplementation.h:35
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:388
std
STL namespace.
Kernel.h
NTuple::TupleImp::items
ItemContainer & items() override
Access item container.
Definition: NTupleImplementation.h:57
NTuple
NTuple name space.
Definition: INTupleSvc.h:19
INTupleSvc
Definition: INTupleSvc.h:46
NTuple::TupleImp::m_items
ItemContainer m_items
Container with N tuple _Columns.
Definition: NTupleImplementation.h:29
std::unique_ptr< char[]>
NTuple::TupleImp::setConversionService
void setConversionService(IConversionSvc *svc)
Access conversion service.
Definition: NTupleImplementation.h:73
NTuple::ColumnWiseTuple::ColumnWiseTuple
ColumnWiseTuple(std::string title)
Standard Constructor.
Definition: NTupleImplementation.h:110
NTuple::TupleImp::setTupleService
void setTupleService(INTupleSvc *svc)
Access conversion service.
Definition: NTupleImplementation.h:77
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
GaudiPython.Persistency.add
def add(instance)
Definition: Persistency.py:50
NTuple::TupleImp::buffer
char * buffer() override
Access N tuple data buffer.
Definition: NTupleImplementation.h:67
IConversionSvc
Definition: IConversionSvc.h:47