Go to the documentation of this file.
28 #define DATASVC_RECORDDATASVC_CPP
56 m_cnvSvc = service( m_persSvcName,
true );
58 error() <<
"Failed to access RecordPersistencySvc." <<
endmsg;
65 sc = setDataLoader( m_cnvSvc.get() );
67 error() <<
"Failed to attach dataloader RecordPersistencySvc." <<
endmsg;
73 warning() <<
"Error declaring Record root DataObject" <<
endmsg;
77 if ( !m_incidentSvc ) {
78 fatal() <<
"IncidentSvc is invalid--base class failed." <<
endmsg;
86 m_incidentSvc->addListener(
this,
"FILE_OPEN_READ" );
87 m_incidentSvc->addListener(
this, m_saveIncidentName );
93 if ( m_incidentSvc ) m_incidentSvc->removeListener(
this );
101 if ( incident.
type() ==
"FILE_OPEN_READ" ) {
103 auto inc =
dynamic_cast<const Ctxt*
>( &incident );
105 always() <<
"Received invalid incident of type:" << incident.
type() <<
endmsg;
107 registerRecord( inc->source(), inc->tag() );
108 if ( !m_incidentName.empty() ) {
109 auto incidents = m_incidents;
111 for (
const auto& i : incidents ) m_incidentSvc->fireIncident(
Incident{ i, m_incidentName } );
114 }
else if ( m_saveIncidentName == incident.
type() ) {
115 always() <<
"Saving records not implemented." <<
endmsg;
122 error() <<
"Failed to load records object" <<
endmsg;
129 debug() <<
"Loaded records object: " << id0 <<
endmsg;
130 sc = objectLeaves( pObj, leaves );
132 for (
const auto& i : leaves ) loadRecords( i );
140 if ( !data.
empty() && pAddr ) {
142 debug() <<
"Request to load record for file " << fid <<
endmsg;
143 StatusCode sc = registerAddress( m_root.get(), fid, pAddr );
145 warning() <<
"Failed to register record for:" << fid <<
endmsg;
149 if ( m_autoLoad ) { loadRecords( pAddr->
registry() ); }
151 }
else if ( !data.
empty() && !pAddr ) {
152 info() <<
"Failed to register record for:" << data <<
" [Invalid Address]" <<
endmsg;
virtual unsigned long release()=0
release reference to object
StatusCode initialize() override
Service initialisation.
RecordDataSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
void handle(const Incident &incident) override
IIncidentListener override: Inform that a new incident has occured.
void registerRecord(const std::string &data, IOpaqueAddress *pAddr)
Load new record into the data store if necessary.
Gaudi::Property< std::string > m_rootName
StatusCode finalize() override
Service finalization.
void loadRecords(IRegistry *pReg)
Load dependent records into memory.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
virtual IRegistry * registry() const =0
Update branch name.
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
constexpr static const auto SUCCESS
#define DECLARE_COMPONENT(type)
virtual const id_type & identifier() const =0
Full identifier (or key)
const std::string & type() const
Access to the incident type.
StatusCode initialize() override
Service initialization.
constexpr static const auto FAILURE
StatusCode finalize() override
Service initialization.