File indexing completed on 2025-01-18 09:57:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef GAUDIMP_TESSERIALIZER_H
0012 #define GAUDIMP_TESSERIALIZER_H
0013
0014 #include "GaudiKernel/DataObject.h"
0015 #include "GaudiKernel/IAddressCreator.h"
0016 #include "GaudiKernel/IDataStoreAgent.h"
0017
0018
0019 #include "TClass.h"
0020
0021
0022 #include <map>
0023 #include <string>
0024 #include <typeindex>
0025 #include <vector>
0026
0027
0028 class IDataProviderSvc;
0029 struct IDataManagerSvc;
0030 class TBufferFile;
0031 class DataStoreItem;
0032 class IAddressCreator;
0033
0034
0035
0036
0037
0038
0039
0040
0041 namespace GaudiMP {
0042 class GAUDI_API TESSerializer : virtual public IDataStoreAgent {
0043 typedef std::vector<DataStoreItem*> Items;
0044 typedef std::vector<std::string> ItemNames;
0045 typedef std::vector<DataObject*> Objects;
0046
0047 public:
0048
0049 TESSerializer( IDataProviderSvc* svc, IAddressCreator* ac );
0050
0051
0052 void dumpBuffer( TBufferFile& );
0053
0054
0055 void loadBuffer( TBufferFile& );
0056
0057
0058 void addItem( const std::string& path );
0059
0060
0061 void addOptItem( const std::string& path );
0062
0063
0064 bool analyse( IRegistry* dir, int level ) override;
0065
0066
0067 void checkItems();
0068
0069 virtual ~TESSerializer() {}
0070
0071 protected:
0072
0073 void addItem( Items& itms, const std::string& descriptor );
0074
0075
0076 DataStoreItem* findItem( const std::string& path );
0077
0078 private:
0079
0080 TClass* getClass( DataObject* obj ) {
0081 auto& id = typeid( *obj );
0082 auto pos = m_classMap.find( id );
0083 if ( pos == end( m_classMap ) ) { return m_classMap[id] = TClass::GetClass( id ); }
0084 return pos->second;
0085 }
0086
0087
0088 IDataProviderSvc* m_TES;
0089
0090 IDataManagerSvc* m_TESMgr;
0091
0092 ItemNames m_itemNames;
0093
0094 Items m_itemList;
0095
0096 ItemNames m_optItemNames;
0097
0098 Items m_optItemList;
0099
0100 DataStoreItem* m_currentItem;
0101
0102 Objects m_objects;
0103
0104
0105 std::map<std::type_index, TClass*> m_classMap;
0106
0107 bool m_verifyItems;
0108
0109 bool m_strict;
0110
0111 IAddressCreator* m_addressCreator;
0112 };
0113 }
0114 #endif