The Gaudi Framework  v30r3 (a5ef0a68)
DetDataSvc.h
Go to the documentation of this file.
1 #ifndef DETECTORDATASVC_DETDATASVC_H
2 #define DETECTORDATASVC_DETDATASVC_H
3 
4 // Base classes
5 //#include "GaudiKernel/DataSvc.h"
6 // D. Piparo: Change to the new thread safe version
10 #include "GaudiKernel/Time.h"
11 #include "GaudiKernel/TsDataSvc.h"
12 
13 // Forward declarations
14 class StatusCode;
15 class IAddressCreator;
16 
18  //--------------------------------------------------------------------------
28 
29 class DetDataSvc : public extends<TsDataSvc, IDetDataSvc, IIncidentListener>
30 {
31 
32  // unhides DataSvc updateObject methods
34 
35 public:
36  // Overloaded DataSvc methods
37 
39  StatusCode initialize() override;
40 
42  StatusCode reinitialize() override;
43 
45  StatusCode finalize() override;
46 
48  StatusCode clearStore() override;
49 
51  StatusCode updateObject( DataObject* toUpdate ) override;
52 
54  DetDataSvc( const std::string& name, ISvcLocator* svc );
55 
57  ~DetDataSvc() override = default;
58 
59 private:
62 
64  StatusCode loadObject( IConversionSvc* pLoader, IRegistry* pNode ) override final
65  {
67  serviceLocator().as<IStateful>()->FSMState() != Gaudi::StateMachine::RUNNING ) ) {
68  return TsDataSvc::loadObject( pLoader, pNode );
69  }
70  error() << "Trying to load " << pNode->identifier() << " while RUNNING" << endmsg;
71  return StatusCode::FAILURE;
72  }
73 
74 public:
75  // Implementation of the IDetDataSvc interface
76 
79  bool validEventTime() const override;
80 
82  const Gaudi::Time& eventTime() const override;
83 
85  void setEventTime( const Gaudi::Time& time ) override;
86 
87 public:
88  // Implementation of the IIncidentListener interface
89 
91  void handle( const Incident& ) override;
92 
93 private:
95  "Detector Data Persistency Storage type"};
96  Gaudi::Property<std::string> m_detDbLocation{this, "DetDbLocation", "empty",
97  "location of detector Db (filename,URL)"};
98  Gaudi::Property<std::string> m_detDbRootName{this, "DetDbRootName", "dd", "name of the root node of the detector"};
99  Gaudi::Property<bool> m_usePersistency{this, "UsePersistency", false, "control if the persistency is required"};
100  Gaudi::Property<std::string> m_persistencySvcName{this, "PersistencySvc", "DetectorPersistencySvc",
101  "name of the persistency service"};
102 
103  Gaudi::Property<bool> m_allowLoadInRunning{this, "AllowLoadInRunning", true,
104  "if set to false, no new object can be loaded while in running state "
105  "(updates are still allowed), this forces preloading of the geometry"};
106 
109 
112 };
113 
114 #endif // DETECTORDATASVC_DETDATASVC_H
constexpr static const auto FAILURE
Definition: StatusCode.h:88
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:288
Implementation of property with value of concrete type.
Definition: Property.h:381
void handle(const Incident &) override
Inform that a new incident has occured.
Definition: DetDataSvc.cpp:196
bool validEventTime() const override
Check if the event time has been set.
Definition: DetDataSvc.cpp:190
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: TsDataSvc.cpp:842
StatusCode updateObject(DataObject *toUpdate) override
Update object.
Definition: DetDataSvc.cpp:208
IAddressCreator interface definition.
Gaudi::Property< std::string > m_detDbRootName
Definition: DetDataSvc.h:98
~DetDataSvc() override=default
Standard Destructor.
Gaudi::Property< std::string > m_detDbLocation
Definition: DetDataSvc.h:96
const Gaudi::Time & eventTime() const override
Get the event time.
Definition: DetDataSvc.cpp:193
STL class.
Gaudi::Property< bool > m_usePersistency
Definition: DetDataSvc.h:99
StatusCode setupDetectorDescription()
Deal with Detector Description initialization.
Definition: DetDataSvc.cpp:56
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode clearStore() override
Remove all data objects in the data store.
Definition: DetDataSvc.cpp:148
Based on seal::Time.
Definition: Time.h:237
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
SmartIF< IAddressCreator > m_addrCreator
Address Creator to be used.
Definition: DetDataSvc.h:111
DetDataSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: DetDataSvc.cpp:174
StatusCode reinitialize() override
Initialize the service.
Definition: DetDataSvc.cpp:110
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode finalize() override
Finalize the service.
Definition: DetDataSvc.cpp:129
StatusCode loadObject(IConversionSvc *pLoader, IRegistry *pNode) override final
Invoke Persistency service to create transient object from its persistent representation.
Definition: DetDataSvc.h:64
StatusCode initialize() override
Initialize the service.
Definition: DetDataSvc.cpp:27
#define LIKELY(x)
Definition: Kernel.h:121
const long XML_StorageType
Definition: ClassID.h:57
Gaudi::Property< std::string > m_persistencySvcName
Definition: DetDataSvc.h:100
Gaudi::Time m_eventTime
Current event time.
Definition: DetDataSvc.h:108
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
Base class for all Incidents (computing events).
Definition: Incident.h:17
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:53
Gaudi::Property< int > m_detStorageType
Definition: DetDataSvc.h:94
void setEventTime(const Gaudi::Time &time) override
Set the new event time.
Definition: DetDataSvc.cpp:183
Gaudi::Property< bool > m_allowLoadInRunning
Definition: DetDataSvc.h:103
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:291
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: TsDataSvc.cpp:571
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209