The Gaudi Framework  v36r1 (3e2fb5a8)
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
TsDataSvc::loadObject
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: TsDataSvc.cpp:469
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: PropertyBase.h:35
DetDataSvc::m_detDbRootName
Gaudi::Property< std::string > m_detDbRootName
Definition: DetDataSvc.h:106
IAddressCreator
Definition: IAddressCreator.h:38
std::string
STL class.
TsDataSvc.h
DetDataSvc::initialize
StatusCode initialize() override
Initialize the service.
Definition: DetDataSvc.cpp:37
PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >::setProperty
StatusCode setProperty(const Gaudi::Details::PropertyBase &p)
Set the property from a property.
Definition: IProperty.h:39
ISvcLocator
Definition: ISvcLocator.h:46
IRegistry
Definition: IRegistry.h:32
DetDataSvc::m_addrCreator
SmartIF< IAddressCreator > m_addrCreator
Address Creator to be used.
Definition: DetDataSvc.h:126
DetDataSvc::setEventTime
void setEventTime(const Gaudi::Time &time) override
Set the new event time.
Definition: DetDataSvc.cpp:181
DetDataSvc::updateObject
StatusCode updateObject(DataObject *toUpdate) override
Update object.
Definition: DetDataSvc.cpp:203
Service::FSMState
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:62
Gaudi::Time
Definition: Time.h:241
Gaudi::Details::Property::ImmediatelyInvokeHandler
Gaudi::tagged_bool< class ImmediatelyInvokeHandler_tag > ImmediatelyInvokeHandler
Definition: Property.h:23
DetDataSvc
Definition: DetDataSvc.h:39
DetDataSvc::m_allowLoadInRunning
Gaudi::Property< bool > m_allowLoadInRunning
Definition: DetDataSvc.h:118
plotSpeedupsPyRoot.time
def time
Definition: plotSpeedupsPyRoot.py:163
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:332
StatusCode
Definition: StatusCode.h:65
DetDataSvc::loadObject
StatusCode loadObject(IConversionSvc *pLoader, IRegistry *pNode) override final
Invoke Persistency service to create transient object from its persistent representation.
Definition: DetDataSvc.h:73
DetDataSvc::m_usePersistency
Gaudi::Property< bool > m_usePersistency
Definition: DetDataSvc.h:114
LIKELY
#define LIKELY(x)
Definition: Kernel.h:105
XML_StorageType
const long XML_StorageType
Definition: ClassID.h:67
DetDataSvc::validEventTime
bool validEventTime() const override
Check if the event time has been set.
Definition: DetDataSvc.cpp:187
DetDataSvc::~DetDataSvc
~DetDataSvc() override=default
Standard Destructor.
SmartIF< IAddressCreator >
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:203
IDetDataSvc.h
DetDataSvc::DetDataSvc
DetDataSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: DetDataSvc.cpp:176
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
IRegistry.h
Gaudi::StateMachine::RUNNING
@ RUNNING
Definition: StateMachine.h:26
DetDataSvc::finalize
StatusCode finalize() override
Finalize the service.
Definition: DetDataSvc.cpp:135
DetDataSvc::m_persistencySvcName
Gaudi::Property< std::string > m_persistencySvcName
Definition: DetDataSvc.h:115
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition: StatusCode.h:156
DetDataSvc::eventTime
const Gaudi::Time & eventTime() const override
Get the event time.
Definition: DetDataSvc.cpp:190
DetDataSvc::setupDetectorDescription
StatusCode setupDetectorDescription()
Deal with Detector Description initialization.
Definition: DetDataSvc.cpp:65
DetDataSvc::m_detDbLocation
Gaudi::Property< std::string > m_detDbLocation
Definition: DetDataSvc.h:104
Time.h
IIncidentListener.h
TsDataSvc::updateObject
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: TsDataSvc.cpp:659
DetDataSvc::reinitialize
StatusCode reinitialize() override
Initialize the service.
Definition: DetDataSvc.cpp:117
DataObject
Definition: DataObject.h:40
DetDataSvc::clearStore
StatusCode clearStore() override
Remove all data objects in the data store.
Definition: DetDataSvc.cpp:153
DetDataSvc::handle
void handle(const Incident &) override
Inform that a new incident has occured.
Definition: DetDataSvc.cpp:193
DetDataSvc::m_detStorageType
Gaudi::Property< int > m_detStorageType
Definition: DetDataSvc.h:102
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
Incident
Definition: Incident.h:27
Gaudi::Property< int >
DetDataSvc::m_eventTime
Gaudi::Time m_eventTime
Current event time.
Definition: DetDataSvc.h:123
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
Definition: Service.cpp:335
IConversionSvc
Definition: IConversionSvc.h:47