The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
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
18class INTupleSvc;
19class IConversionSvc;
20
21namespace NTuple {
22 // Concrete N tuple class definition
23 class GAUDI_API TupleImp : public Tuple {
24 protected:
28 bool m_isBooked = false;
30 std::string m_title;
34 std::unique_ptr<char[]> m_buffer;
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(); }
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
unsigned int CLID
Class ID definition.
Definition ClassID.h:16
#define GAUDI_API
Definition Kernel.h:49
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
std::vector< INTupleItem * > ItemContainer
Definition INTuple.h:93
NTuple interface class definition.
Definition INTuple.h:32
A select statement can either contain.
static const CLID & classID()
Static access to class defininition structure.
const CLID & clID() const override
Retrieve Reference to class defininition structure.
ColumnWiseTuple(std::string title)
Standard Constructor.
static const CLID & classID()
Static access to class defininition structure.
const CLID & clID() const override
Retrieve Reference to class defininition structure.
RowWiseTuple(std::string title)
Standard Constructor.
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition NTuple.h:380
char * buffer() override
Access N tuple data buffer.
INTupleSvc * tupleService() const
Access conversion service.
INTupleItem * i_find(const std::string &name) const override
Internally used by abstract classes.
TupleImp(const TupleImp &)=delete
Standard Copy Constructor.
const std::string & title() const override
Object title.
IConversionSvc * conversionService() const
Access conversion service.
bool m_isBooked
Flag wether N tuple is booked.
IConversionSvc * m_cnvSvc
Reference to the conversion service used.
const INTupleItem * find(const std::string &name) const override
Find an item row of the Ntuple (CONST)
const char * buffer() const override
Access N tuple data buffer (CONST)
SmartIF< ISelectStatement > m_pSelector
Possibly hanging selector.
const ItemContainer & items() const override
Access item container (CONST)
void setTupleService(INTupleSvc *svc)
Access conversion service.
ItemContainer m_items
Container with N tuple _Columns.
ItemContainer & items() override
Access item container.
std::string m_title
N tuple title.
INTupleItem * find(const std::string &name) override
Find an item row of the Ntuple.
std::unique_ptr< char[]> m_buffer
Buffer.
INTupleSvc * m_ntupleSvc
Reference to N-tuple service used.
void setConversionService(IConversionSvc *svc)
Access conversion service.
Small smart pointer class with automatic reference counting for IInterface.
Definition SmartIF.h:28
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
NTuple name space.
Definition INTupleSvc.h:16
STL namespace.