The Gaudi Framework  master (d98a2936)
TESSerializer.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/DataObject.h>
16 
17 // ROOT includes
18 #include <TClass.h>
19 
20 // vector and string
21 #include <map>
22 #include <string>
23 #include <typeindex>
24 #include <vector>
25 
26 // forward declarations
27 class IDataProviderSvc;
28 struct IDataManagerSvc;
29 class TBufferFile;
30 class DataStoreItem;
31 class IAddressCreator;
32 
40 namespace GaudiMP {
41  class GAUDI_API TESSerializer : virtual public IDataStoreAgent {
42  typedef std::vector<DataStoreItem*> Items;
43  typedef std::vector<std::string> ItemNames;
44  typedef std::vector<DataObject*> Objects;
45 
46  public:
49 
51  void dumpBuffer( TBufferFile& );
52 
54  void loadBuffer( TBufferFile& );
55 
57  void addItem( const std::string& path );
58 
60  void addOptItem( const std::string& path );
61 
63  bool analyse( IRegistry* dir, int level ) override;
64 
66  void checkItems();
67 
68  virtual ~TESSerializer() {}
69 
70  protected:
72  void addItem( Items& itms, const std::string& descriptor );
73 
75  DataStoreItem* findItem( const std::string& path );
76 
77  private:
79  TClass* getClass( DataObject* obj ) {
80  auto& id = typeid( *obj );
81  auto pos = m_classMap.find( id );
82  if ( pos == end( m_classMap ) ) { return m_classMap[id] = TClass::GetClass( id ); }
83  return pos->second;
84  }
85 
102 
104  std::map<std::type_index, TClass*> m_classMap;
108  bool m_strict;
111  };
112 } // namespace GaudiMP
IAddressCreator
Definition: IAddressCreator.h:33
IDataManagerSvc
Definition: IDataManagerSvc.h:47
AtlasMCRecoFullPrecedenceDump.path
path
Definition: AtlasMCRecoFullPrecedenceDump.py:49
GaudiMP::TESSerializer::m_itemNames
ItemNames m_itemNames
Vector of item names.
Definition: TESSerializer.h:91
IAddressCreator.h
GaudiMP::TESSerializer::m_currentItem
DataStoreItem * m_currentItem
Current item while traversing the TES tree.
Definition: TESSerializer.h:99
GaudiMP::TESSerializer::m_TESMgr
IDataManagerSvc * m_TESMgr
TES pointer.
Definition: TESSerializer.h:89
IRegistry
Definition: IRegistry.h:29
GaudiPartProp.tests.id
id
Definition: tests.py:111
GaudiMP::TESSerializer::m_TES
IDataProviderSvc * m_TES
TES pointer.
Definition: TESSerializer.h:87
GaudiMP::TESSerializer::ItemNames
std::vector< std::string > ItemNames
Definition: TESSerializer.h:43
GaudiMP::TESSerializer::m_optItemList
Items m_optItemList
Vector of optional items to be saved to this stream (DataStoreItem ptrs)
Definition: TESSerializer.h:97
GaudiMP::TESSerializer::m_classMap
std::map< std::type_index, TClass * > m_classMap
Map of gROOT class information.
Definition: TESSerializer.h:104
GaudiMP::TESSerializer::Items
std::vector< DataStoreItem * > Items
Definition: TESSerializer.h:42
DataStoreItem
Definition: DataStoreItem.h:25
GaudiMP::TESSerializer
Definition: TESSerializer.h:41
GaudiMP::TESSerializer::m_verifyItems
bool m_verifyItems
Boolean Flag as used by GaudiSvc/PersistencySvc/OutputStreamer.
Definition: TESSerializer.h:106
GaudiMP::TESSerializer::getClass
TClass * getClass(DataObject *obj)
caching wrapper to TClass::GetClass
Definition: TESSerializer.h:79
GaudiPartProp.decorators.Items
Items
Definition: decorators.py:304
gaudirun.level
level
Definition: gaudirun.py:364
GaudiMP::TESSerializer::m_addressCreator
IAddressCreator * m_addressCreator
IAddress Creator for Opaque Addresses.
Definition: TESSerializer.h:110
DataObject.h
GaudiMP::TESSerializer::m_objects
Objects m_objects
Selected list of Objects to be serialized (DataObject ptrs)
Definition: TESSerializer.h:101
GaudiMP::TESSerializer::Objects
std::vector< DataObject * > Objects
Definition: TESSerializer.h:44
DataObject
Definition: DataObject.h:37
GaudiMP::TESSerializer::m_itemList
Items m_itemList
Vector of items to be saved to this stream (DataStoreItem ptrs)
Definition: TESSerializer.h:93
GaudiMP::TESSerializer::m_optItemNames
ItemNames m_optItemNames
Vector of item names (std::strings)
Definition: TESSerializer.h:95
IDataProviderSvc
Definition: IDataProviderSvc.h:48
IOTest.end
end
Definition: IOTest.py:125
IDataStoreAgent.h
GaudiMP::TESSerializer::~TESSerializer
virtual ~TESSerializer()
Definition: TESSerializer.h:68
GaudiMP::TESSerializer::m_strict
bool m_strict
Boolean Flag used to determine error tolerance.
Definition: TESSerializer.h:108
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:49
GaudiMP
A class to serialize/deserialize TES objects to and from a TBufferFile Author: P.
Definition: PyROOTPickle.h:40
IDataStoreAgent
Definition: IDataStoreAgent.h:24