The Gaudi Framework  v33r1 (b1225454)
NTupleImplementation.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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:
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
A select statement can either contain.
std::unique_ptr< char[]> m_buffer
Buffer.
INTupleSvc * tupleService() const
Access conversion service.
STL namespace.
def read(f, regex='.*', skipevents=0)
Definition: hivetimeline.py:33
INTupleItem * find(const std::string &name) override
Find an item row of the Ntuple.
RowWiseTuple(std::string title)
Standard Constructor.
const CLID & clID() const override
Retrieve Reference to class defininition structure.
IConversionSvc * conversionService() const
Access conversion service.
NTuple name space.
Definition: INTupleSvc.h:19
static const CLID & classID()
Static access to class defininition structure.
ColumnWiseTuple(std::string title)
Standard Constructor.
STL class.
const INTupleItem * find(const std::string &name) const override
Find an item row of the Ntuple (CONST)
NTuple interface class definition.
Definition: INTuple.h:37
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
ItemContainer & items() override
Access item container.
std::string m_title
N tuple title.
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:385
T get(T... args)
STL class.
const CLID & clID() const override
Retrieve Reference to class defininition structure.
SmartIF< ISelectStatement > m_pSelector
Possibly hanging selector.
const char * buffer() const override
Access N tuple data buffer (CONST)
ItemContainer m_items
Container with N tuple _Columns.
void setTupleService(INTupleSvc *svc)
Access conversion service.
void setConversionService(IConversionSvc *svc)
Access conversion service.
const std::string & title() const override
Object title.
const ItemContainer & items() const override
Access item container (CONST)
#define GAUDI_API
Definition: Kernel.h:81
static const CLID & classID()
Static access to class defininition structure.
char * buffer() override
Access N tuple data buffer.