Loading [MathJax]/extensions/MathZoom.js
The Gaudi Framework  master (b9786168)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages Concepts
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
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
28struct IDataManagerSvc;
29class TBufferFile;
30class DataStoreItem;
31class IAddressCreator;
32
39
40namespace 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;
111 };
112} // namespace GaudiMP
#define GAUDI_API
Definition Kernel.h:49
A DataObject is the base class of any identifiable object on any data store.
Definition DataObject.h:37
Description of the DataStoreItem class.
IDataManagerSvc * m_TESMgr
TES pointer.
std::vector< DataStoreItem * > Items
Objects m_objects
Selected list of Objects to be serialized (DataObject ptrs)
bool analyse(IRegistry *dir, int level) override
Analysis callback.
void dumpBuffer(TBufferFile &)
Dump TES contents listed in m_itemList/m_optItemList to a TBufferFile.
std::map< std::type_index, TClass * > m_classMap
Map of gROOT class information.
DataStoreItem * m_currentItem
Current item while traversing the TES tree.
void checkItems()
print out the contents of m_itemList and m_optItemList (std::cout)
TClass * getClass(DataObject *obj)
caching wrapper to TClass::GetClass
bool m_verifyItems
Boolean Flag as used by GaudiSvc/PersistencySvc/OutputStreamer.
bool m_strict
Boolean Flag used to determine error tolerance.
ItemNames m_itemNames
Vector of item names.
std::vector< std::string > ItemNames
TESSerializer(IDataProviderSvc *svc, IAddressCreator *ac)
Constructor.
ItemNames m_optItemNames
Vector of item names (std::strings)
void addOptItem(const std::string &path)
add an item to the TESSerializer's optional list (#notation)
IAddressCreator * m_addressCreator
IAddress Creator for Opaque Addresses.
void addItem(const std::string &path)
add an item to the TESSerializer's list (#notation)
void loadBuffer(TBufferFile &)
Rebuild TES from items in a TBufferFile.
std::vector< DataObject * > Objects
IDataProviderSvc * m_TES
TES pointer.
Items m_itemList
Vector of items to be saved to this stream (DataStoreItem ptrs)
Items m_optItemList
Vector of optional items to be saved to this stream (DataStoreItem ptrs)
IAddressCreator interface definition.
Data provider interface definition.
Generic data agent interface.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition IRegistry.h:29
A class to serialize/deserialize TES objects to and from a TBufferFile Author: P.