The Gaudi Framework  v33r0 (d5ea422b)
DetDataSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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 #ifndef DETECTORDATASVC_DETDATASVC_H
12 #define DETECTORDATASVC_DETDATASVC_H
13 
14 // Base classes
15 //#include "GaudiKernel/DataSvc.h"
16 // D. Piparo: Change to the new thread safe version
19 #include "GaudiKernel/IRegistry.h"
20 #include "GaudiKernel/Time.h"
21 #include "GaudiKernel/TsDataSvc.h"
22 
23 // Forward declarations
24 class StatusCode;
25 class IAddressCreator;
26 
28  //--------------------------------------------------------------------------
38 
39 class DetDataSvc : public extends<TsDataSvc, IDetDataSvc, IIncidentListener> {
40 
41  // unhides DataSvc updateObject methods
43 
44 public:
45  // Overloaded DataSvc methods
46 
48  StatusCode initialize() override;
49 
51  StatusCode reinitialize() override;
52 
54  StatusCode finalize() override;
55 
57  StatusCode clearStore() override;
58 
60  StatusCode updateObject( DataObject* toUpdate ) override;
61 
63  DetDataSvc( const std::string& name, ISvcLocator* svc );
64 
66  ~DetDataSvc() override = default;
67 
68 private:
71 
73  StatusCode loadObject( IConversionSvc* pLoader, IRegistry* pNode ) override final {
75  serviceLocator().as<IStateful>()->FSMState() != Gaudi::StateMachine::RUNNING ) ) {
76  return TsDataSvc::loadObject( pLoader, pNode );
77  }
78  error() << "Trying to load " << pNode->identifier() << " while RUNNING" << endmsg;
79  return StatusCode::FAILURE;
80  }
81 
82 public:
83  // Implementation of the IDetDataSvc interface
84 
87  bool validEventTime() const override;
88 
90  const Gaudi::Time& eventTime() const override;
91 
93  void setEventTime( const Gaudi::Time& time ) override;
94 
95 public:
96  // Implementation of the IIncidentListener interface
97 
99  void handle( const Incident& ) override;
100 
101 private:
103  "Detector Data Persistency Storage type"};
104  Gaudi::Property<std::string> m_detDbLocation{this, "DetDbLocation", "empty",
105  "location of detector Db (filename,URL)"};
107  "DetDbRootName",
108  "dd",
109  [this]( Gaudi::Details::PropertyBase& ) {
110  this->setProperty( "RootName", "/" + this->m_detDbRootName ).ignore();
111  },
113  "name of the root node of the detector"};
114  Gaudi::Property<bool> m_usePersistency{this, "UsePersistency", false, "control if the persistency is required"};
115  Gaudi::Property<std::string> m_persistencySvcName{this, "PersistencySvc", "DetectorPersistencySvc",
116  "name of the persistency service"};
117 
118  Gaudi::Property<bool> m_allowLoadInRunning{this, "AllowLoadInRunning", true,
119  "if set to false, no new object can be loaded while in running state "
120  "(updates are still allowed), this forces preloading of the geometry"};
121 
124 
127 };
128 
129 #endif // DETECTORDATASVC_DETDATASVC_H
bool validEventTime() const override
Check if the event time has been set.
Definition: DetDataSvc.cpp:187
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:287
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:35
Implementation of property with value of concrete type.
Definition: Property.h:370
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:62
StatusCode setProperty(const Gaudi::Details::PropertyBase &p) override
set the property form another property
const Gaudi::Time & eventTime() const override
Get the event time.
Definition: DetDataSvc.cpp:190
void handle(const Incident &) override
Inform that a new incident has occured.
Definition: DetDataSvc.cpp:193
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: TsDataSvc.cpp:659
StatusCode updateObject(DataObject *toUpdate) override
Update object.
Definition: DetDataSvc.cpp:203
Gaudi::tagged_bool< class ImmediatelyInvokeHandler_tag > ImmediatelyInvokeHandler
Definition: Property.h:159
IAddressCreator interface definition.
Gaudi::Property< std::string > m_detDbRootName
Definition: DetDataSvc.h:106
~DetDataSvc() override=default
Standard Destructor.
Gaudi::Property< std::string > m_detDbLocation
Definition: DetDataSvc.h:104
STL class.
Gaudi::Property< bool > m_usePersistency
Definition: DetDataSvc.h:114
StatusCode setupDetectorDescription()
Deal with Detector Description initialization.
Definition: DetDataSvc.cpp:65
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:284
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
A DataSvc specialized in detector data.
Definition: DetDataSvc.h:39
StatusCode clearStore() override
Remove all data objects in the data store.
Definition: DetDataSvc.cpp:153
Based on seal::Time.
Definition: Time.h:241
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
SmartIF< IAddressCreator > m_addrCreator
Address Creator to be used.
Definition: DetDataSvc.h:126
DetDataSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: DetDataSvc.cpp:176
StatusCode reinitialize() override
Initialize the service.
Definition: DetDataSvc.cpp:117
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:32
StatusCode finalize() override
Finalize the service.
Definition: DetDataSvc.cpp:135
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:42
StatusCode loadObject(IConversionSvc *pLoader, IRegistry *pNode) override final
Invoke Persistency service to create transient object from its persistent representation.
Definition: DetDataSvc.h:73
StatusCode initialize() override
Initialize the service.
Definition: DetDataSvc.cpp:37
#define LIKELY(x)
Definition: Kernel.h:105
const long XML_StorageType
Definition: ClassID.h:67
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:164
Gaudi::Property< std::string > m_persistencySvcName
Definition: DetDataSvc.h:115
Gaudi::Time m_eventTime
Current event time.
Definition: DetDataSvc.h:123
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
Base class for all Incidents (computing events).
Definition: Incident.h:27
constexpr static const auto FAILURE
Definition: StatusCode.h:97
Gaudi::Property< int > m_detStorageType
Definition: DetDataSvc.h:102
void setEventTime(const Gaudi::Time &time) override
Set the new event time.
Definition: DetDataSvc.cpp:181
Gaudi::Property< bool > m_allowLoadInRunning
Definition: DetDataSvc.h:118
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:40
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: TsDataSvc.cpp:469
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202