Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:00:34

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #ifndef GAUDIKERNEL_NTUPLEIMP_H
0012 #define GAUDIKERNEL_NTUPLEIMP_H
0013 
0014 #include <memory>
0015 // Framework include files
0016 #include "GaudiKernel/Kernel.h"
0017 #include "GaudiKernel/NTuple.h"
0018 #include "GaudiKernel/SmartIF.h"
0019 
0020 // Forward declarations
0021 class INTupleSvc;
0022 class IConversionSvc;
0023 
0024 namespace NTuple {
0025   // Concrete N tuple class definition
0026   class GAUDI_API TupleImp : public Tuple {
0027   protected:
0028     /// Container with N tuple _Columns
0029     ItemContainer m_items;
0030     /// Flag wether N tuple is booked
0031     bool m_isBooked = false;
0032     /// N tuple title
0033     std::string m_title;
0034     /// Possibly hanging selector
0035     SmartIF<ISelectStatement> m_pSelector;
0036     /// Buffer
0037     std::unique_ptr<char[]> m_buffer;
0038     /// Reference to N-tuple service used
0039     INTupleSvc* m_ntupleSvc = nullptr;
0040     /// Reference to the conversion service used
0041     IConversionSvc* m_cnvSvc = nullptr;
0042 
0043   private:
0044     /// Standard Copy Constructor
0045     TupleImp( const TupleImp& ) = delete;
0046 
0047   public:
0048     /// Internally used by abstract classes
0049     INTupleItem* i_find( const std::string& name ) const override;
0050 
0051   public:
0052     /// Standard Constructor
0053     TupleImp( std::string title );
0054     /// Standard Destructor
0055     ~TupleImp() override;
0056     /// Access item container
0057     ItemContainer& items() override { return m_items; }
0058     /// Access item container   (CONST)
0059     const ItemContainer& items() const override { return m_items; }
0060     /// Object title
0061     const std::string& title() const override { return m_title; }
0062     /// Find an item row of the Ntuple (CONST)
0063     const INTupleItem* find( const std::string& name ) const override { return i_find( name ); }
0064     /// Find an item row of the Ntuple
0065     INTupleItem* find( const std::string& name ) override { return i_find( name ); }
0066     /// Access N tuple data buffer
0067     char* buffer() override { return m_buffer.get(); }
0068     /// Access N tuple data buffer    (CONST)
0069     const char* buffer() const override { return m_buffer.get(); }
0070     /// Access conversion service
0071     IConversionSvc* conversionService() const { return m_cnvSvc; }
0072     /// Access conversion service
0073     void setConversionService( IConversionSvc* svc ) { m_cnvSvc = svc; }
0074     /// Access conversion service
0075     INTupleSvc* tupleService() const { return m_ntupleSvc; }
0076     /// Access conversion service
0077     void setTupleService( INTupleSvc* svc ) { m_ntupleSvc = svc; }
0078     /// Attach selector
0079     StatusCode attachSelector( ISelectStatement* sel ) override;
0080     /// Access selector
0081     ISelectStatement* selector() override;
0082     /// Set N tuple data buffer
0083     virtual char* setBuffer( std::unique_ptr<char[]>&& buff );
0084     char*         setBuffer( char* buff ) override;
0085     /// Reset all entries to their default values
0086     void reset() override;
0087     /// Add an item row to the N tuple
0088     StatusCode add( INTupleItem* item ) override;
0089     /// Remove an item row (identified by pointer) from the N tuple
0090     StatusCode remove( INTupleItem* item ) override;
0091     /// Remove an item row (identified by name) from the N tuple
0092     StatusCode remove( const std::string& name ) override;
0093     /// Write record of the NTuple (Shortcut of writeRecord)
0094     StatusCode write() override;
0095     /// Write record of the NTuple
0096     StatusCode writeRecord() override;
0097     /// Read record of the NTuple (Shortcut of readRecord)
0098     StatusCode read() override;
0099     /// Read record of the NTuple
0100     StatusCode readRecord() override;
0101     /// Save the NTuple
0102     StatusCode save() override;
0103 
0104   }; // end class definition: Tuple
0105 
0106   // Concrete column wise N tuple class definition
0107   class ColumnWiseTuple : public TupleImp {
0108   public:
0109     /// Standard Constructor
0110     ColumnWiseTuple( std::string title ) : TupleImp( std::move( title ) ) {}
0111     /// Retrieve Reference to class defininition structure
0112     const CLID& clID() const override { return classID(); }
0113     /// Static access to class defininition structure
0114     static const CLID& classID() { return CLID_ColumnWiseTuple; }
0115   }; // end class definition: ColumnWiseTuple
0116 
0117   // Concrete column wise N tuple class definition
0118   class RowWiseTuple : public TupleImp {
0119   public:
0120     /// Standard Constructor
0121     RowWiseTuple( std::string title ) : TupleImp( std::move( title ) ) {}
0122     /// Retrieve Reference to class defininition structure
0123     const CLID& clID() const override { return classID(); }
0124     /// Static access to class defininition structure
0125     static const CLID& classID() { return CLID_RowWiseTuple; }
0126   }; // end class definition: RowWiseTuple
0127 } // namespace NTuple
0128 
0129 #endif // GAUDIKERNEL_NTUPLEIMP_H