Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (d98a2936)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
NTupleImplementation.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 
13 #include <GaudiKernel/Kernel.h>
14 #include <GaudiKernel/NTuple.h>
15 #include <GaudiKernel/SmartIF.h>
16 #include <memory>
17 
18 class INTupleSvc;
19 class IConversionSvc;
20 
21 namespace NTuple {
22  // Concrete N tuple class definition
23  class GAUDI_API TupleImp : public Tuple {
24  protected:
26  ItemContainer m_items;
28  bool m_isBooked = false;
30  std::string m_title;
34  std::unique_ptr<char[]> m_buffer;
36  INTupleSvc* m_ntupleSvc = nullptr;
38  IConversionSvc* m_cnvSvc = nullptr;
39 
40  private:
42  TupleImp( const TupleImp& ) = delete;
43 
44  public:
46  INTupleItem* i_find( const std::string& name ) const override;
47 
48  public:
50  TupleImp( std::string title );
52  ~TupleImp() override;
54  ItemContainer& items() override { return m_items; }
56  const ItemContainer& items() const override { return m_items; }
58  const std::string& title() const override { return m_title; }
60  const INTupleItem* find( const std::string& name ) const override { return i_find( name ); }
62  INTupleItem* find( const std::string& name ) override { return i_find( name ); }
64  char* buffer() override { return m_buffer.get(); }
66  const char* buffer() const override { return m_buffer.get(); }
68  IConversionSvc* conversionService() const { return m_cnvSvc; }
70  void setConversionService( IConversionSvc* svc ) { m_cnvSvc = svc; }
72  INTupleSvc* tupleService() const { return m_ntupleSvc; }
74  void setTupleService( INTupleSvc* svc ) { m_ntupleSvc = svc; }
76  StatusCode attachSelector( ISelectStatement* sel ) override;
78  ISelectStatement* selector() override;
80  virtual char* setBuffer( std::unique_ptr<char[]>&& buff );
81  char* setBuffer( char* buff ) override;
83  void reset() override;
85  StatusCode add( INTupleItem* item ) override;
87  StatusCode remove( INTupleItem* item ) override;
89  StatusCode remove( const std::string& name ) override;
91  StatusCode write() override;
93  StatusCode writeRecord() override;
95  StatusCode read() override;
97  StatusCode readRecord() override;
99  StatusCode save() override;
100  };
101 
102  // Concrete column wise N tuple class definition
103  class ColumnWiseTuple : public TupleImp {
104  public:
106  ColumnWiseTuple( std::string title ) : TupleImp( std::move( title ) ) {}
108  const CLID& clID() const override { return classID(); }
110  static const CLID& classID() { return CLID_ColumnWiseTuple; }
111  };
112 
113  // Concrete column wise N tuple class definition
114  class RowWiseTuple : public TupleImp {
115  public:
117  RowWiseTuple( std::string title ) : TupleImp( std::move( title ) ) {}
119  const CLID& clID() const override { return classID(); }
121  static const CLID& classID() { return CLID_RowWiseTuple; }
122  };
123 } // namespace NTuple
NTuple::TupleImp::title
const std::string & title() const override
Object title.
Definition: NTupleImplementation.h:58
NTuple::TupleImp::m_buffer
std::unique_ptr< char[]> m_buffer
Buffer.
Definition: NTupleImplementation.h:34
NTuple::TupleImp::items
const ItemContainer & items() const override
Access item container (CONST)
Definition: NTupleImplementation.h:56
NTuple::ColumnWiseTuple
Definition: NTupleImplementation.h:103
GaudiPartProp.decorators.std
std
Definition: decorators.py:32
NTuple::TupleImp::conversionService
IConversionSvc * conversionService() const
Access conversion service.
Definition: NTupleImplementation.h:68
NTuple::RowWiseTuple
Definition: NTupleImplementation.h:114
ISelectStatement
Definition: ISelectStatement.h:38
NTuple::TupleImp::tupleService
INTupleSvc * tupleService() const
Access conversion service.
Definition: NTupleImplementation.h:72
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:121
NTuple::ColumnWiseTuple::classID
static const CLID & classID()
Static access to class defininition structure.
Definition: NTupleImplementation.h:110
NTuple::TupleImp
Definition: NTupleImplementation.h:23
NTuple::TupleImp::find
INTupleItem * find(const std::string &name) override
Find an item row of the Ntuple.
Definition: NTupleImplementation.h:62
SmartIF.h
NTuple::ColumnWiseTuple::clID
const CLID & clID() const override
Retrieve Reference to class defininition structure.
Definition: NTupleImplementation.h:108
StatusCode
Definition: StatusCode.h:64
NTuple::TupleImp::find
const INTupleItem * find(const std::string &name) const override
Find an item row of the Ntuple (CONST)
Definition: NTupleImplementation.h:60
NTuple.h
NTuple::RowWiseTuple::clID
const CLID & clID() const override
Retrieve Reference to class defininition structure.
Definition: NTupleImplementation.h:119
SmartIF< ISelectStatement >
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:16
NTuple::TupleImp::m_title
std::string m_title
N tuple title.
Definition: NTupleImplementation.h:30
INTupleItem
Definition: INTuple.h:32
IOTest.sel
sel
Definition: IOTest.py:106
NTuple::RowWiseTuple::RowWiseTuple
RowWiseTuple(std::string title)
Standard Constructor.
Definition: NTupleImplementation.h:117
NTuple::TupleImp::buffer
const char * buffer() const override
Access N tuple data buffer (CONST)
Definition: NTupleImplementation.h:66
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:32
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:380
Kernel.h
NTuple::TupleImp::items
ItemContainer & items() override
Access item container.
Definition: NTupleImplementation.h:54
NTuple
NTuple name space.
Definition: INTupleSvc.h:16
INTupleSvc
Definition: INTupleSvc.h:43
NTuple::TupleImp::m_items
ItemContainer m_items
Container with N tuple _Columns.
Definition: NTupleImplementation.h:26
NTuple::TupleImp::setConversionService
void setConversionService(IConversionSvc *svc)
Access conversion service.
Definition: NTupleImplementation.h:70
NTuple::ColumnWiseTuple::ColumnWiseTuple
ColumnWiseTuple(std::string title)
Standard Constructor.
Definition: NTupleImplementation.h:106
NTuple::TupleImp::setTupleService
void setTupleService(INTupleSvc *svc)
Access conversion service.
Definition: NTupleImplementation.h:74
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:49
GaudiPython.Persistency.add
def add(instance)
Definition: Persistency.py:50
NTuple::TupleImp::buffer
char * buffer() override
Access N tuple data buffer.
Definition: NTupleImplementation.h:64
IConversionSvc
Definition: IConversionSvc.h:43