MultiStoreSvc.cpp
Go to the documentation of this file.
1 //====================================================================
2 // MultiStoreSvc.cpp
3 //--------------------------------------------------------------------
4 //
5 // Package : System ( The LHCb Offline System)
6 //
7 // Description: implementation of the Transient event data service.
8 //
9 // Author : M.Frank
10 // History :
11 // +---------+----------------------------------------------+---------
12 // | Date | Comment | Who
13 // +---------+----------------------------------------------+---------
14 // | 29/10/98| Initial version | MF
15 // +---------+----------------------------------------------+---------
16 //
17 //====================================================================
18 #define DATASVC_MULTISTORESVC_CPP
19 
20 // Include files
21 #include "GaudiKernel/Service.h"
22 #include "GaudiKernel/SmartIF.h"
24 #include "GaudiKernel/MsgStream.h"
26 #include "GaudiKernel/DataObject.h"
35 
36 #include <map>
37 
38 // Forward declarations
39 // This class
41 
42 typedef const std::string CSTR;
47 
48 namespace {
49  struct Partition final {
50  SmartIF<IDataProviderSvc> dataProvider;
51  SmartIF<IDataManagerSvc> dataManager;
53  };
54 }
55 
67 class MultiStoreSvc: public extends<Service,
68  IDataProviderSvc,
69  IDataManagerSvc,
70  IPartitionControl>
71 {
72 protected:
86  enum { no_type = 0, address_type = 1, object_type = 2};
87  struct tagROOT {
88  int type = no_type;
90  union {
93  } root;
94  tagROOT() { root.address = nullptr; }
95  } m_root;
97  Partition m_current;
99  Partitions m_partitions;
101  PartitionDefs m_partitionDefs;
104 
105  // member templates to help writing the function calls
106  template <typename... Args, typename... UArgs>
107  STATUS call_(STATUS (IDataProviderSvc::*pmf)( Args... ), UArgs&&... args)
108  {
109  return m_current.dataProvider ? (m_current.dataProvider->*pmf)(std::forward<UArgs>(args)...)
111  }
112  template <typename... Args, typename... UArgs>
113  STATUS call_(STATUS (IDataManagerSvc::*pmf)( Args... ), UArgs&&... args)
114  {
115  return m_current.dataManager ? (m_current.dataManager->*pmf)(std::forward<UArgs>(args)...)
117  }
118 
119 public:
121  CLID rootCLID() const override {
122  return m_rootCLID;
123  }
125  const std::string& rootName() const override {
126  return m_rootName;
127  }
128 
130  STATUS registerAddress(CSTR& path, ADDRESS* pAddr) override {
131  return call_<CSTR&,ADDRESS*>( &IDataManagerSvc::registerAddress, path, pAddr);
132  }
134  STATUS registerAddress(OBJECT* parent, CSTR& path, ADDRESS* pAddr) override {
135  return call_<OBJECT*,CSTR&,ADDRESS*>( &IDataManagerSvc::registerAddress, parent, path, pAddr);
136  }
138  STATUS registerAddress(IRegistry* parent, CSTR& path, ADDRESS* pAdd) override {
139  return call_<IRegistry*,CSTR&,ADDRESS*>( &IDataManagerSvc::registerAddress, parent, path, pAdd);
140  }
143  return call_<CSTR&>( &IDataManagerSvc::unregisterAddress, path);
144  }
146  STATUS unregisterAddress(OBJECT* pParent, CSTR& path) override {
147  return call_<OBJECT*,CSTR&>( &IDataManagerSvc::unregisterAddress, pParent, path);
148  }
150  STATUS unregisterAddress(IRegistry* pParent, CSTR& path) override {
151  return call_<IRegistry*,CSTR&>( &IDataManagerSvc::unregisterAddress, pParent, path);
152  }
154  STATUS objectLeaves(const OBJECT* pObject, std::vector<IRegistry*>& leaves) override {
155  return call_<const OBJECT*,std::vector<IRegistry*>&>(&IDataManagerSvc::objectLeaves, pObject, leaves);
156  }
158  STATUS objectLeaves(const IRegistry* pObject, std::vector<IRegistry*>& leaves) override {
159  return call_<const IRegistry*,std::vector<IRegistry*>&>( &IDataManagerSvc::objectLeaves, pObject, leaves);
160  }
162  STATUS objectParent(const OBJECT* pObject, IRegistry*& refpParent) override {
163  return call_<const OBJECT*, IRegistry*&>( &IDataManagerSvc::objectParent, pObject, refpParent);
164  }
166  STATUS objectParent(const IRegistry* pObject, IRegistry*& refpParent) override {
167  return call_<const IRegistry*, IRegistry*&>( &IDataManagerSvc::objectParent, pObject, refpParent);
168  }
171  return call_<CSTR&>( &IDataManagerSvc::clearSubTree, path);
172  }
174  STATUS clearSubTree(OBJECT* pObject) override {
175  return call_<OBJECT*>( &IDataManagerSvc::clearSubTree, pObject);
176  }
178  STATUS clearStore() override {
179  for(auto &i : m_partitions) {
180  i.second.dataManager->clearStore().ignore();
181  }
182  if ( m_root.root.object ) {
183  switch ( m_root.type ) {
184  case address_type:
186  break;
187  case object_type:
189  break;
190  }
191  m_root.root.object = nullptr;
192  }
193  m_root.path.clear();
194  m_root.type = no_type;
195  return STATUS::SUCCESS;
196  }
198  STATUS traverseSubTree(CSTR& path, AGENT* pAgent) override {
199  return call_<CSTR&,AGENT*>( &IDataManagerSvc::traverseSubTree, path, pAgent);
200  }
202  STATUS traverseSubTree(OBJECT* pObject, AGENT* pAgent) override {
203  return call_<OBJECT*,AGENT*>( &IDataManagerSvc::traverseSubTree, pObject, pAgent);
204  }
206  STATUS traverseTree( AGENT* pAgent ) override {
207  return call_<AGENT*>( &IDataManagerSvc::traverseTree, pAgent);
208  }
211  STATUS setRoot( std::string path, OBJECT* pObj) override {
212  if ( m_root.root.object ) {
213  switch ( m_root.type ) {
214  case address_type:
216  break;
217  case object_type:
219  break;
220  }
221  }
222  m_root.path = std::move(path);
224  m_root.root.object = pObj;
226  return activate(m_defaultPartition);
227  }
228 
231  STATUS setRoot (std::string path, ADDRESS* pAddr) override {
232  if ( m_root.root.object ) {
233  switch ( m_root.type ) {
234  case address_type:
236  break;
237  case object_type:
239  break;
240  }
241  }
242  m_root.path = std::move(path);
244  m_root.root.address = pAddr;
245  if ( m_root.root.address ) {
248  return activate(m_defaultPartition);
249  }
250  return STATUS::FAILURE;
251  }
253  STATUS setDataLoader(IConversionSvc* pDataLoader, IDataProviderSvc* dpsvc = nullptr) override {
254  m_dataLoader = pDataLoader;
255  if ( m_dataLoader ) m_dataLoader->setDataProvider(dpsvc ? dpsvc : this);
256  for(auto& i : m_partitions) {
257  i.second.dataManager->setDataLoader(m_dataLoader.get()).ignore();
258  }
259  return SUCCESS;
260  }
263  return call_<const DataStoreItem&>( &IDataProviderSvc::addPreLoadItem, item);
264  }
267  return call_<CSTR&>( &IDataProviderSvc::addPreLoadItem, item);
268  }
271  return call_<const DataStoreItem&>( &IDataProviderSvc::removePreLoadItem, item);
272  }
275  return call_<CSTR&>( &IDataProviderSvc::removePreLoadItem, item);
276  }
278  STATUS resetPreLoad() override {
279  return call_<>( &IDataProviderSvc::resetPreLoad);
280  }
282  STATUS preLoad() override {
283  return call_<>( &IDataProviderSvc::preLoad );
284  }
286  STATUS registerObject(CSTR& path, OBJECT* pObj) override {
287  return registerObject(nullptr, path, pObj);
288  }
290  STATUS registerObject(CSTR& parent, CSTR& obj, OBJECT* pObj) override {
291  return call_<CSTR&,CSTR&,OBJECT*>(&IDataProviderSvc::registerObject, parent,obj,pObj);
292  }
294  STATUS registerObject(CSTR& parent, int item, OBJECT* pObj) override {
295  return call_<CSTR&,int,OBJECT*>( &IDataProviderSvc::registerObject, parent, item, pObj);
296  }
298  STATUS registerObject(OBJECT* parent, CSTR& obj, OBJECT* pObj) override {
299  return call_<OBJECT*,CSTR&,OBJECT*>( &IDataProviderSvc::registerObject, parent, obj, pObj);
300  }
302  STATUS registerObject(OBJECT* parent, int obj, OBJECT* pObj) override {
303  return call_<OBJECT*,int,OBJECT*>( &IDataProviderSvc::registerObject, parent, obj, pObj);
304  }
307  return call_<CSTR&>( &IDataProviderSvc::unregisterObject, path);
308  }
310  STATUS unregisterObject(CSTR& parent, CSTR& obj) override {
311  return call_<CSTR&,CSTR&>( &IDataProviderSvc::unregisterObject, parent, obj);
312  }
314  STATUS unregisterObject(CSTR& parent, int obj) override {
315  return call_<CSTR&,int>( &IDataProviderSvc::unregisterObject, parent, obj);
316  }
318  STATUS unregisterObject(OBJECT* pObj) override {
319  return call_<OBJECT*>( &IDataProviderSvc::unregisterObject, pObj);
320  }
322  STATUS unregisterObject(OBJECT* pObj, CSTR& path) override {
323  return call_<OBJECT*,CSTR&>( &IDataProviderSvc::unregisterObject, pObj, path);
324  }
326  STATUS unregisterObject(OBJECT* pObj, int item ) override {
327  return call_<OBJECT*,int>( &IDataProviderSvc::unregisterObject, pObj, item);
328  }
330  STATUS retrieveObject(IRegistry* parent, CSTR& path, OBJECT*& pObj ) override {
331  return call_<IRegistry*,CSTR&,OBJECT*&>( &IDataProviderSvc::retrieveObject, parent, path, pObj);
332  }
334  STATUS retrieveObject(CSTR& path, OBJECT*& pObj) override {
335  return call_<CSTR&,OBJECT*&>( &IDataProviderSvc::retrieveObject, path, pObj);
336  }
338  STATUS retrieveObject(CSTR& parent, CSTR& path, OBJECT*& pObj ) override {
339  return call_<CSTR&,CSTR&,OBJECT*&>( &IDataProviderSvc::retrieveObject, parent, path, pObj);
340  }
342  STATUS retrieveObject(CSTR& parent, int item, OBJECT*& pObj) override {
343  return call_<CSTR&,int,OBJECT*&>( &IDataProviderSvc::retrieveObject, parent, item, pObj);
344  }
346  STATUS retrieveObject(OBJECT* parent, CSTR& path, OBJECT*& pObj ) override {
347  return call_<OBJECT*,CSTR&,OBJECT*&>( &IDataProviderSvc::retrieveObject, parent, path, pObj);
348  }
350  STATUS retrieveObject(OBJECT* parent, int item, OBJECT*& pObj ) override {
351  return call_<OBJECT*,int,OBJECT*&>( &IDataProviderSvc::retrieveObject, parent, item, pObj);
352  }
354  STATUS findObject(CSTR& path, OBJECT*& pObj) override {
355  return call_<CSTR&,OBJECT*&>( &IDataProviderSvc::retrieveObject, path, pObj);
356  }
358  STATUS findObject(IRegistry* parent, CSTR& path, OBJECT*& pObj) override {
359  return call_<IRegistry*,CSTR&,OBJECT*&>( &IDataProviderSvc::findObject, parent, path, pObj);
360  }
362  STATUS findObject(CSTR& parent, CSTR& path, OBJECT*& pObj) override {
363  return call_<CSTR&,CSTR&,OBJECT*&>( &IDataProviderSvc::retrieveObject, parent, path, pObj);
364  }
366  STATUS findObject(CSTR& parent, int item, OBJECT*& pObject ) override {
367  return call_<CSTR&,int,OBJECT*&>( &IDataProviderSvc::findObject, parent, item, pObject);
368  }
370  STATUS findObject(OBJECT* parent, CSTR& path, OBJECT*& pObject) override {
371  return call_<OBJECT*,CSTR&,OBJECT*&>( &IDataProviderSvc::findObject, parent, path, pObject);
372  }
374  STATUS findObject(OBJECT* parent, int item, OBJECT*& pObject) override {
375  return call_<OBJECT*,int,OBJECT*&>( &IDataProviderSvc::findObject, parent, item, pObject);
376  }
378  STATUS linkObject(IRegistry* from, CSTR& objPath, OBJECT* to) override {
379  return call_<IRegistry*,CSTR&,OBJECT*>( &IDataProviderSvc::linkObject, from, objPath, to);
380  }
382  STATUS linkObject(CSTR& from, CSTR& objPath, OBJECT* to) override {
383  return call_<CSTR&,CSTR&,OBJECT*>( &IDataProviderSvc::linkObject, from, objPath, to);
384  }
386  STATUS linkObject(OBJECT* from, CSTR& objPath, OBJECT* to) override {
387  return call_<OBJECT*,CSTR&,OBJECT*>( &IDataProviderSvc::linkObject, from, objPath, to);
388  }
390  STATUS linkObject(CSTR& fullPath, OBJECT* to) override {
391  return call_<CSTR&,OBJECT*>( &IDataProviderSvc::linkObject, fullPath, to);
392  }
394  STATUS unlinkObject(IRegistry* from, CSTR& objPath) override {
395  return call_<IRegistry*,CSTR&>( &IDataProviderSvc::unlinkObject, from, objPath);
396  }
398  STATUS unlinkObject(CSTR& from, CSTR& objPath) override {
399  return call_<CSTR&,CSTR&>( &IDataProviderSvc::unlinkObject, from, objPath);
400  }
402  STATUS unlinkObject(OBJECT* from, CSTR& objPath) override {
403  return call_<OBJECT*,CSTR&>( &IDataProviderSvc::unlinkObject, from, objPath);
404  }
407  return call_<CSTR&>( &IDataProviderSvc::unlinkObject, path);
408  }
410  STATUS updateObject(IRegistry* pDirectory ) override {
411  return call_<IRegistry*>( &IDataProviderSvc::updateObject, pDirectory);
412  }
415  return call_<CSTR&>( &IDataProviderSvc::updateObject, path);
416  }
418  STATUS updateObject(OBJECT* pObj ) override {
419  return call_<OBJECT*>( &IDataProviderSvc::updateObject, pObj);
420  }
422  STATUS updateObject(CSTR& parent, CSTR& updatePath ) override {
423  return call_<CSTR&,CSTR&>( &IDataProviderSvc::updateObject, parent, updatePath);
424  }
426  STATUS updateObject(OBJECT* parent, CSTR& updatePath) override {
427  return call_<OBJECT*,CSTR&>( &IDataProviderSvc::updateObject, parent, updatePath);
428  }
429 
431  STATUS create(CSTR& nam, CSTR& typ) override {
432  IInterface* pPartition = nullptr;
433  return create(nam, typ, pPartition);
434  }
436  STATUS create(CSTR& nam, CSTR& typ, IInterface*& pPartition) override {
437  if ( get(nam, pPartition).isSuccess() ) return PARTITION_EXISTS;
439  auto isvc = serviceLocator()->service<IService>(typ);
440  if (!isvc) return NO_INTERFACE;
441  auto dataMgr = isvc.as<IDataManagerSvc>();
442  auto dataProv = isvc.as<IDataProviderSvc>();
443  if ( !dataMgr || !dataProv ) return NO_INTERFACE;
444  m_partitions.emplace( nam, Partition{ dataProv, dataMgr, nam } );
445  return STATUS::SUCCESS;
446  }
447 
449  STATUS drop(CSTR& nam) override {
450  auto i = m_partitions.find(nam);
451  if ( i == m_partitions.end() ) return PARTITION_NOT_PRESENT;
452  if ( i->second.dataManager == m_current.dataManager ) {
453  m_current = Partition();
454  }
455  i->second.dataManager->clearStore().ignore();
456  m_partitions.erase(i);
457  return STATUS::SUCCESS;
458  }
459 
461  STATUS drop(IInterface* pPartition) override {
462  auto provider = SmartIF<IDataProviderSvc>(pPartition);
463  if ( !provider ) return NO_INTERFACE;
464  auto i = std::find_if( std::begin(m_partitions), std::end(m_partitions),
465  [&](Partitions::const_reference p) {
466  return p.second.dataProvider == provider;
467  } );
468  if (i==std::end(m_partitions)) return PARTITION_NOT_PRESENT;
469  i->second.dataManager->clearStore().ignore();
470  m_partitions.erase(i);
471  return STATUS::SUCCESS;
472  }
473 
475  STATUS activate(CSTR& nam) override {
476  auto i = m_partitions.find(nam);
477  if ( i != m_partitions.end() ) {
478  m_current = i->second;
479  return STATUS::SUCCESS;
480  }
481  m_current = Partition();
482  return PARTITION_NOT_PRESENT;
483  }
484 
486  STATUS activate(IInterface* pPartition) override {
487  auto provider = SmartIF<IDataProviderSvc>(pPartition);
488  m_current = Partition();
489  if ( !provider ) return NO_INTERFACE;
490  auto i = std::find_if(std::begin(m_partitions), std::end(m_partitions),
491  [&](Partitions::const_reference p) {
492  return p.second.dataProvider == provider;
493  } );
494  if (i == std::end(m_partitions)) return PARTITION_NOT_PRESENT;
495  m_current = i->second;
496  return STATUS::SUCCESS;
497  }
498 
500  STATUS get(CSTR& nam, IInterface*& pPartition) const override {
501  auto i = m_partitions.find(nam);
502  if ( i != m_partitions.end() ) {
503  pPartition = i->second.dataProvider;
504  return STATUS::SUCCESS;
505  }
506  pPartition = nullptr;
507  return PARTITION_NOT_PRESENT;
508  }
509 
511  StatusCode activePartition(std::string& nam, IInterface*& pPartition) const override {
512  if ( m_current.dataProvider ) {
513  nam = m_current.name;
514  pPartition = m_current.dataProvider;
515  return STATUS::SUCCESS;
516  }
517  nam.clear();
518  pPartition = nullptr;
519  return NO_ACTIVE_PARTITION;
520  }
521 
523  // Attach address creator facility
524  m_addrCreator = service(m_loader, true);
525  if (!m_addrCreator) {
526  error()
527  << "Failed to retrieve data loader "
528  << "\"" << m_loader << "\"" << endmsg;
529  return StatusCode::FAILURE;
530  }
531  // Attach data loader facility
532  auto dataLoader = service<IConversionSvc>(m_loader, true);
533  if (!dataLoader) {
534  error() << "Failed to retrieve data loader "
535  << "\"" << m_loader << "\"" << endmsg;
536  return StatusCode::FAILURE;
537  }
538  auto sc = setDataLoader(dataLoader.get());
539  if (!sc.isSuccess()) {
540  error() << "Failed to set data loader "
541  << "\"" << m_loader << "\"" << endmsg;
542  }
543  return sc;
544  }
545 
547  m_addrCreator.reset();
548  m_dataLoader.reset();
549  return STATUS::SUCCESS;
550  }
551 
553  STATUS initialize() override {
554  // Nothing to do: just call base class initialisation
556  if ( !sc.isSuccess() ) return sc;
557  sc = makePartitions();
558  if (!sc.isSuccess()) {
559  error() << "Failed to connect to all store partitions." << endmsg;
560  return sc;
561  }
562  return attachServices();
563  }
564 
566  STATUS reinitialize() override {
568  if (!sc.isSuccess()) {
569  error() << "Enable to reinitialize base class"
570  << endmsg;
571  return sc;
572  }
573  detachServices();
574  sc = attachServices();
575  if ( !sc.isSuccess() ) {
576  error() << "Failed to attach necessary services." << endmsg;
577  return sc;
578  }
579  sc = makePartitions();
580  if (!sc.isSuccess()) {
581  error() << "Failed to connect to store partitions." << endmsg;
582  return sc;
583  }
584  // return
585  return STATUS::SUCCESS;
586  }
587 
589  STATUS finalize() override {
590  setDataLoader(nullptr).ignore();
591  clearStore().ignore();
593  m_current = Partition();
594  detachServices();
595  return Service::finalize();
596  }
597 
598 
599 //protected:
600 
603  : base_class(name,svc)
604  {
605  declareProperty("RootCLID", m_rootCLID = 110);
606  declareProperty("RootName", m_rootName = "/Event");
607  declareProperty("Partitions", m_partitionDefs);
608  declareProperty("DataLoader", m_loader="EventPersistencySvc");
609  declareProperty("DefaultPartition", m_defaultPartition="Default");
610  }
611 
613  ~MultiStoreSvc() override {
614  setDataLoader(nullptr).ignore();
615  resetPreLoad().ignore();
616  clearStore().ignore();
618  }
619 
622  STATUS iret = STATUS::SUCCESS;
623  for(auto& i : m_partitions) {
625  switch ( m_root.type ) {
626  case address_type:
627  if ( m_root.root.address ) {
628  ADDRESS* pAdd = nullptr;
629  ADDRESS* p = m_root.root.address;
630  sc = m_addrCreator->createAddress(p->svcType(),
631  p->clID(),
632  p->par(),
633  p->ipar(),
634  pAdd);
635  if ( sc.isSuccess() ) {
636  sc = i.second.dataManager->setRoot(m_root.path, pAdd);
637  }
638  }
639  break;
640  case object_type:
641  if ( m_root.root.object ) {
642  if ( m_root.root.object->clID() == CLID_DataObject ) {
643  sc = i.second.dataManager->setRoot(m_root.path, new DataObject());
644  }
645  }
646  break;
647  default:
648  sc = STATUS::FAILURE;
649  break;
650  }
651  if ( !sc.isSuccess() ) iret = sc;
652  }
653  return iret;
654  }
655 
658  for(auto &i : m_partitions) i.second.dataManager->clearStore().ignore();
659  m_partitions.clear();
660  return STATUS::SUCCESS;
661  }
662 
665  using Parser = Gaudi::Utils::AttribStringParser;
666  std::string typ, nam;
668  for(auto part: m_partitionDefs) {
669  for(auto attrib: Parser(std::move(part))) {
670  switch( ::toupper(attrib.tag[0]) ) {
671  case 'N':
672  nam = std::move(attrib.value);
673  break;
674  case 'T':
675  typ = std::move(attrib.value);
676  break;
677  }
678  }
679  STATUS sc = create(nam, typ);
680  if ( !sc.isSuccess() ) return sc;
681  if ( m_defaultPartition.empty() ) m_defaultPartition = nam;
682  }
683  return STATUS::SUCCESS;
684  }
685 };
686 
687 // Instantiation of a static factory class used by clients to create
688 // instances of this service
virtual StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent)=0
IDataManagerSvc: Explore the object store: retrieve the object's parent.
Parse attribute strings allowing iteration over the various attributes.
STATUS objectLeaves(const IRegistry *pObject, std::vector< IRegistry * > &leaves) override
Explore the object store: retrieve all leaves attached to the object.
virtual const std::string * par() const =0
Retrieve String parameters.
StatusCode initialize() override
Definition: Service.cpp:68
STATUS clearSubTree(CSTR &path) override
Remove all data objects below the sub tree identified.
STATUS unregisterObject(CSTR &path) override
Unregister object from the data store.
STATUS removePreLoadItem(CSTR &item) override
Add an item to the preload list.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
STATUS preLoad() override
load all preload items of the list
T empty(T...args)
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Partitions m_partitions
Datastore partitions.
STATUS unlinkObject(CSTR &path) override
Remove a link to another object.
STATUS finalize() override
Service initialisation.
STATUS registerAddress(CSTR &path, ADDRESS *pAddr) override
IDataManagerSvc: Register object address with the data store.
PartitionDefs m_partitionDefs
Datastore partition definitions.
StatusCode finalize() override
Definition: Service.cpp:193
virtual StatusCode addPreLoadItem(const DataStoreItem &item)=0
Add an item to the preload list.
STATUS updateObject(OBJECT *pObj) override
Update object.
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ipar, IOpaqueAddress *&refpAddress)=0
Create a Generic address using explicit arguments to identify a single object.
virtual StatusCode clearSubTree(const std::string &sub_path)=0
Remove all data objects below the sub tree identified by its full path name.
Invalid root path object cannot be retrieved or stored.
STATUS objectParent(const OBJECT *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
STATUS findObject(OBJECT *parent, int item, OBJECT *&pObject) override
Find object in the data store.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
STATUS detachServices()
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
virtual StatusCode preLoad()=0
Load all preload items of the list.
StatusCode STATUS
STATUS registerObject(CSTR &parent, CSTR &obj, OBJECT *pObj) override
Register object with the data store.
virtual StatusCode resetPreLoad()=0
Clear the preload list.
STATUS unregisterAddress(OBJECT *pParent, CSTR &path) override
IDataManagerSvc: Unregister object address from the data store.
STATUS unregisterObject(CSTR &parent, CSTR &obj) override
Unregister object from the data store.
STATUS unlinkObject(OBJECT *from, CSTR &objPath) override
Remove a link to another object.
T end(T...args)
virtual unsigned long release()=0
release reference to object
STATUS create(CSTR &nam, CSTR &typ, IInterface *&pPartition) override
Create a partition object. The name identifies the partition uniquely.
Data service base class.
virtual StatusCode unregisterAddress(const std::string &fullPath)=0
Unregister object address from the data store.
STATUS findObject(CSTR &parent, int item, OBJECT *&pObject) override
Find object in the data store.
STATUS reinitialize() override
Service initialisation.
Data provider interface definition.
STATUS removePreLoadItem(const DataStoreItem &item) override
Remove an item from the preload list.
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
virtual long svcType() const =0
Retrieve service type.
STATUS linkObject(OBJECT *from, CSTR &objPath, OBJECT *to) override
Add a link to another object.
std::string m_rootName
Name of root event.
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
STATUS traverseSubTree(CSTR &path, AGENT *pAgent) override
Analyze by traversing all data objects below the sub tree.
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
STATUS create(CSTR &nam, CSTR &typ) override
Create a partition object. The name identifies the partition uniquely.
STATUS linkObject(CSTR &from, CSTR &objPath, OBJECT *to) override
Add a link to another object.
STATUS setDataLoader(IConversionSvc *pDataLoader, IDataProviderSvc *dpsvc=nullptr) override
IDataManagerSvc: Pass a default data loader to the service.
STL class.
STATUS updateObject(CSTR &parent, CSTR &updatePath) override
Update object.
std::vector< std::string > PartitionDefs
virtual StatusCode removePreLoadItem(const DataStoreItem &item)=0
Remove an item from the preload list.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
STATUS updateObject(OBJECT *parent, CSTR &updatePath) override
Update object.
STATUS makePartitions()
Create all partitions according to job options.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
STATUS retrieveObject(CSTR &path, OBJECT *&pObj) override
Retrieve object identified by its full path from the data store.
STATUS unlinkObject(IRegistry *from, CSTR &objPath) override
Remove a link to another object.
STATUS unregisterAddress(IRegistry *pParent, CSTR &path) override
IDataManagerSvc: Unregister object address from the data store.
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition: DataObject.cpp:68
virtual StatusCode findObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Find object identified by its directory entry.
STATUS setRoot(std::string path, OBJECT *pObj) override
Initialize data store for new event by giving new event path and root object.
virtual const CLID & clID() const =0
Retrieve class information from link.
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
STATUS addPreLoadItem(const DataStoreItem &item) override
Add an item to the preload list.
STATUS findObject(IRegistry *parent, CSTR &path, OBJECT *&pObj) override
Find object identified by its full path in the data store.
virtual StatusCode unregisterObject(const std::string &fullPath)=0
Unregister object from the data store.
STATUS retrieveObject(IRegistry *parent, CSTR &path, OBJECT *&pObj) override
Retrieve object from data store.
virtual StatusCode linkObject(IRegistry *from, const std::string &objPath, DataObject *toObj)=0
Add a link to another object.
General service interface definition.
Definition: IService.h:18
STATUS clearSubTree(OBJECT *pObject) override
Remove all data objects below the sub tree identified.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual StatusCode updateObject(IRegistry *pDirectory)=0
Update object identified by its directory entry.
STATUS activate(CSTR &nam) override
Activate a partition object. The name identifies the partition uniquely.
Definition of the basic interface.
Definition: IInterface.h:234
struct MultiStoreSvc::tagROOT m_root
T erase(T...args)
STATUS registerObject(CSTR &path, OBJECT *pObj) override
Register object with the data store.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
const std::string CSTR
STATUS findObject(CSTR &parent, CSTR &path, OBJECT *&pObj) override
Find object in the data store.
DataObject OBJECT
MultiStoreSvc(CSTR &name, ISvcLocator *svc)
Standard Constructor.
StatusCode reinitialize() override
Definition: Service.cpp:282
STATUS retrieveObject(CSTR &parent, int item, OBJECT *&pObj) override
Retrieve object from data store.
STATUS unregisterObject(OBJECT *pObj, CSTR &path) override
Unregister object from the data store.
STATUS linkObject(CSTR &fullPath, OBJECT *to) override
Add a link to another object.
STATUS clearPartitions()
Clear all partitions.
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
T clear(T...args)
STATUS call_(STATUS(IDataProviderSvc::*pmf)(Args...), UArgs &&...args)
T move(T...args)
union MultiStoreSvc::tagROOT::@1 root
std::string m_loader
Data loader name.
CLID rootCLID() const override
IDataManagerSvc: Accessor for root event CLID.
const std::string & rootName() const override
Name for root Event.
Partition m_current
Current partition.
STATUS unregisterAddress(CSTR &path) override
IDataManagerSvc: Unregister object address from the data store.
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
STATUS retrieveObject(OBJECT *parent, CSTR &path, OBJECT *&pObj) override
Retrieve object from data store.
STATUS preparePartitions()
Prepare partition for usage.
STATUS objectLeaves(const OBJECT *pObject, std::vector< IRegistry * > &leaves) override
Explore the object store: retrieve all leaves attached to the object.
STATUS unregisterObject(OBJECT *pObj) override
Unregister object from the data store.
STATUS setRoot(std::string path, ADDRESS *pAddr) override
Initialize data store for new event by giving new event path and address of root object.
virtual StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves)=0
Explore the object store: retrieve all leaves attached to the object The object is identified by its ...
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:56
STATUS resetPreLoad() override
Clear the preload list.
T find(T...args)
STATUS unregisterObject(OBJECT *pObj, int item) override
Unregister object from the data store.
STATUS initialize() override
Service initialisation.
Generic data agent interface.
STATUS drop(CSTR &nam) override
Drop a partition object. The name identifies the partition uniquely.
list args
Definition: gaudirun.py:290
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
T begin(T...args)
virtual StatusCode unlinkObject(IRegistry *from, const std::string &objPath)=0
Remove a link to another object.
STATUS activate(IInterface *pPartition) override
Activate a partition object.
STATUS addPreLoadItem(CSTR &item) override
Add an item to the preload list.
StatusCode activePartition(std::string &nam, IInterface *&pPartition) const override
Access the active partition object.
SmartIF< IAddressCreator > m_addrCreator
Reference to address creator.
STATUS registerObject(OBJECT *parent, CSTR &obj, OBJECT *pObj) override
Register object with the data store.
T emplace(T...args)
CLID m_rootCLID
Integer Property corresponding to CLID of root entry.
tuple item
print s1,s2
Definition: ana.py:146
STATUS retrieveObject(OBJECT *parent, int item, OBJECT *&pObj) override
Retrieve object from data store.
STATUS findObject(CSTR &path, OBJECT *&pObj) override
Find object identified by its full path in the data store.
STATUS retrieveObject(CSTR &parent, CSTR &path, OBJECT *&pObj) override
Retrieve object from data store.
STATUS linkObject(IRegistry *from, CSTR &objPath, OBJECT *to) override
Add a link to another object.
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:144
STATUS updateObject(CSTR &path) override
Update object.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
virtual StatusCode registerAddress(const std::string &fullPath, IOpaqueAddress *pAddress)=0
Register object address with the data store.
Opaque address interface definition.
STATUS unregisterObject(CSTR &parent, int obj) override
Unregister object from the data store.
void ignore() const
Definition: StatusCode.h:108
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:215
IOpaqueAddress ADDRESS
virtual StatusCode registerObject(const std::string &fullPath, DataObject *pObject)=0
Register object with the data store.
STATUS traverseSubTree(OBJECT *pObject, AGENT *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects below the sub tree.
virtual StatusCode traverseSubTree(const std::string &sub_path, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by its full path name...
STATUS call_(STATUS(IDataManagerSvc::*pmf)(Args...), UArgs &&...args)
std::map< std::string, Partition > Partitions
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
STATUS clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
list i
Definition: ana.py:128
std::string m_defaultPartition
Default partition.
STATUS registerObject(CSTR &parent, int item, OBJECT *pObj) override
Register object with the data store.
STATUS registerAddress(OBJECT *parent, CSTR &path, ADDRESS *pAddr) override
IDataManagerSvc: Register object address with the data store.
STATUS registerAddress(IRegistry *parent, CSTR &path, ADDRESS *pAdd) override
IDataManagerSvc: Register object address with the data store.
STATUS updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
STATUS unlinkObject(CSTR &from, CSTR &objPath) override
Remove a link to another object.
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
STATUS findObject(OBJECT *parent, CSTR &path, OBJECT *&pObject) override
Find object in the data store.
void toupper(std::string &s)
STATUS drop(IInterface *pPartition) override
Drop a partition object. The name identifies the partition uniquely.
STATUS traverseTree(AGENT *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects in the data store.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
IDataStoreAgent AGENT
STATUS objectParent(const IRegistry *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
STATUS attachServices()
STATUS registerObject(OBJECT *parent, int obj, OBJECT *pObj) override
Register object with the data store.
~MultiStoreSvc() override
Standard Destructor.
virtual unsigned long addRef()=0
Add reference to object.
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.