18 #define DATASVC_MULTISTORESVC_CPP    36 #include "boost/variant.hpp"    51   struct Partition final {
    62     return dataProvider.get();
    67     return dataManager.get();
    72     template <
typename lambda>
    73     struct arg_helper : 
public arg_helper<decltype( &lambda::operator() )> {
    75     template <
typename T, 
typename Ret, 
typename Arg>
    76     struct arg_helper<Ret ( T::* )( Arg ) const> {
    82     template <
typename lambda>
    85   auto dispatch_variant = []( 
auto&& variant, 
auto&&... lambdas ) -> decltype( 
auto ) {
   121     boost::variant<boost::blank, ADDRESS*, OBJECT*> 
root;
   129   template <
typename Fun>
   132     auto* svc = m_current.get<std::decay_t<detail::argument_t<Fun>>>();
   205     for ( 
auto& i : m_partitions ) {
   206       i.second.dataManager->clearStore().
ignore();
   210                         if ( p ) p->release();
   212                       []( boost::blank ) {} );
   238                         if ( p ) p->release();
   240                       []( boost::blank ) {} );
   244     return activate( m_defaultPartition );
   253                         if ( p ) p->release();
   255                       []( boost::blank ) {} );
   261     return activate( m_defaultPartition );
   266     m_dataLoader = pDataLoader;
   267     if ( m_dataLoader ) m_dataLoader->
setDataProvider( dpsvc ? dpsvc : 
this );
   268     for ( 
auto& i : m_partitions ) {
   269       i.second.dataManager->setDataLoader( m_dataLoader.
get() ).ignore();
   306     return registerObject( 
nullptr, path, pObj );
   488     return create( nam, typ, pPartition );
   493     if ( 
get( nam, pPartition ).isSuccess() ) 
return PARTITION_EXISTS;
   495     auto isvc = serviceLocator()->service<
IService>( typ );
   496     if ( !isvc ) 
return NO_INTERFACE;
   499     if ( !dataMgr || !dataProv ) 
return NO_INTERFACE;
   500     m_partitions.
emplace( nam, Partition{dataProv, dataMgr, nam} );
   507     auto i = m_partitions.
find( nam );
   508     if ( i == m_partitions.
end() ) 
return PARTITION_NOT_PRESENT;
   509     if ( i->second.dataManager == m_current.dataManager ) {
   510       m_current = Partition();
   512     i->second.dataManager->clearStore().ignore();
   513     m_partitions.
erase( i );
   521     if ( !provider ) 
return NO_INTERFACE;
   523                            [&]( Partitions::const_reference p ) { 
return p.second.dataProvider == provider; } );
   524     if ( i == 
std::end( m_partitions ) ) 
return PARTITION_NOT_PRESENT;
   525     i->second.dataManager->clearStore().ignore();
   526     m_partitions.
erase( i );
   533     auto i = m_partitions.
find( nam );
   534     if ( i != m_partitions.
end() ) {
   535       m_current = i->second;
   539     return PARTITION_NOT_PRESENT;
   546     m_current     = Partition();
   547     if ( !provider ) 
return NO_INTERFACE;
   549                            [&]( Partitions::const_reference p ) { 
return p.second.dataProvider == provider; } );
   550     if ( i == 
std::end( m_partitions ) ) 
return PARTITION_NOT_PRESENT;
   551     m_current = i->second;
   558     auto i = m_partitions.
find( nam );
   559     if ( i != m_partitions.
end() ) {
   560       pPartition = i->second.dataProvider;
   563     pPartition = 
nullptr;
   564     return PARTITION_NOT_PRESENT;
   570     if ( m_current.dataProvider ) {
   571       nam        = m_current.name;
   572       pPartition = m_current.dataProvider;
   576     pPartition = 
nullptr;
   577     return NO_ACTIVE_PARTITION;
   583     m_addrCreator = service( m_loader, 
true );
   584     if ( !m_addrCreator ) {
   585       error() << 
"Failed to retrieve data loader "   586               << 
"\"" << m_loader << 
"\"" << 
endmsg;
   590     auto dataLoader = service<IConversionSvc>( m_loader, true );
   592       error() << 
"Failed to retrieve data loader "   593               << 
"\"" << m_loader << 
"\"" << 
endmsg;
   596     auto sc = setDataLoader( dataLoader.get() );
   597     if ( !sc.isSuccess() ) {
   598       error() << 
"Failed to set data loader "   599               << 
"\"" << m_loader << 
"\"" << 
endmsg;
   606     m_addrCreator.
reset();
   607     m_dataLoader.
reset();
   617     sc = makePartitions();
   619       error() << 
"Failed to connect to all store partitions." << 
endmsg;
   622     return attachServices();
   630       error() << 
"Enable to reinitialize base class" << 
endmsg;
   634     sc = attachServices();
   636       error() << 
"Failed to attach necessary services." << 
endmsg;
   639     sc = makePartitions();
   641       error() << 
"Failed to connect to store partitions." << 
endmsg;
   651     setDataLoader( 
nullptr ).
ignore();
   652     clearStore().ignore();
   653     clearPartitions().ignore();
   654     m_current = Partition();
   662   using extends::extends;
   667     setDataLoader( 
nullptr ).ignore();
   668     resetPreLoad().ignore();
   669     clearStore().ignore();
   670     clearPartitions().ignore();
   677     for ( 
auto& i : m_partitions ) {
   680                                       if ( !address ) return STATUS::FAILURE;
   681                                       ADDRESS* pAdd = nullptr;
   682                                       ADDRESS* p    = address;
   683                                       auto sc       = m_addrCreator->createAddress( p->svcType(), p->clID(), p->par(),
   685                                       return sc.isSuccess() ? i.second.dataManager->setRoot( m_root.path, pAdd ) : sc;
   687                                     [&]( 
OBJECT* 
object ) -> STATUS {
   688                                       if ( object && object->clID() == CLID_DataObject ) {
   689                                         return i.second.dataManager->setRoot( m_root.path, new DataObject() );
   694       if ( !sc.isSuccess() ) iret = sc;
   702     for ( 
auto& i : m_partitions ) i.second.dataManager->clearStore().
ignore();
   703     m_partitions.clear();
   712     clearPartitions().ignore();
   713     for ( 
auto part : m_partitionDefs ) {
   714       for ( 
auto attrib : Parser( 
std::move( part ) ) ) {
   715         switch (::
toupper( attrib.tag[0] ) ) {
   724       STATUS sc = create( nam, typ );
   726       if ( m_defaultPartition.empty() ) m_defaultPartition = nam;
 virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store. 
STATUS findObject(boost::string_ref parent, boost::string_ref path, OBJECT *&pObj) override
Find object in the data store. 
STATUS registerObject(boost::string_ref parent, int item, OBJECT *pObj) override
Register object with the data store. 
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. 
StatusCode initialize() override
STATUS unlinkObject(boost::string_ref path) override
Remove a link to another object. 
STATUS updateObject(boost::string_ref parent, boost::string_ref updatePath) override
Update object. 
STATUS preLoad() override
load all preload items of the list 
STATUS unregisterAddress(boost::string_ref path) override
IDataManagerSvc: Unregister object address from the data store. 
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 ...
STATUS registerObject(boost::string_ref parent, boost::string_ref obj, OBJECT *pObj) override
Register object with the data store. 
virtual StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath)=0
Remove a link to another object. 
Partitions m_partitions
Datastore partitions. 
STATUS finalize() override
Service initialisation. 
STATUS unregisterObject(OBJECT *pObj, boost::string_ref path) override
Unregister object from the data store. 
StatusCode finalize() override
Implementation of property with value of concrete type. 
virtual StatusCode addPreLoadItem(const DataStoreItem &item)=0
Add an item to the preload list. 
const std::string & rootName() const  override
Name for root Event. 
CLID rootCLID() const  override
IDataManagerSvc: Accessor for root event CLID. 
STATUS updateObject(OBJECT *pObj) override
Update object. 
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. 
virtual StatusCode findObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject)=0
Find object identified by its directory entry. 
STATUS retrieveObject(IRegistry *parent, boost::string_ref path, OBJECT *&pObj) override
Retrieve object from data store. 
bool isSuccess() const 
Test for a status code of SUCCESS. 
STATUS removePreLoadItem(std::string item) override
Add an item to the preload list. 
STATUS registerObject(boost::string_ref path, OBJECT *pObj) override
Register object with the data store. 
Root type (address or object) 
STATUS findObject(boost::string_ref path, OBJECT *&pObj) override
Find object identified by its full path in the data store. 
STATUS traverseSubTree(boost::string_ref path, AGENT *pAgent) override
Analyze by traversing all data objects below the sub tree. 
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service. 
boost::variant< boost::blank, ADDRESS *, OBJECT * > root
STATUS unregisterObject(boost::string_ref parent, int obj) override
Unregister object from the data store. 
virtual StatusCode preLoad()=0
Load all preload items of the list. 
STATUS clearSubTree(boost::string_ref path) override
Remove all data objects below the sub tree identified. 
virtual StatusCode resetPreLoad()=0
Clear the preload list. 
STATUS create(CSTR &nam, CSTR &typ, IInterface *&pPartition) override
Create a partition object. The name identifies the partition uniquely. 
STATUS unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object. 
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. 
STATUS addPreLoadItem(std::string item) override
Add an item to the preload list. 
STATUS unlinkObject(boost::string_ref from, boost::string_ref objPath) override
Remove a link to another object. 
virtual StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent)=0
IDataManagerSvc: Explore the object store: retrieve the object's parent. 
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service. 
#define DECLARE_COMPONENT(type)
STATUS linkObject(boost::string_ref from, boost::string_ref objPath, OBJECT *to) override
Add a link to another object. 
STATUS create(CSTR &nam, CSTR &typ) override
Create a partition object. The name identifies the partition uniquely. 
STATUS setDataLoader(IConversionSvc *pDataLoader, IDataProviderSvc *dpsvc=nullptr) override
IDataManagerSvc: Pass a default data loader to the service. 
virtual StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *toObj)=0
Add a link to another 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. 
virtual StatusCode traverseSubTree(boost::string_ref sub_path, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by its full path name...
STATUS makePartitions()
Create all partitions according to job options. 
STATUS linkObject(IRegistry *from, boost::string_ref objPath, OBJECT *to) override
Add a link to another object. 
TupleObj.h GaudiAlg/TupleObj.h namespace with few technical implementations. 
STATUS registerAddress(IRegistry *parent, boost::string_ref path, ADDRESS *pAddr) override
IDataManagerSvc: Register object address with the data store. 
STATUS setRoot(std::string path, OBJECT *pObj) override
Initialize data store for new event by giving new event path and root object. 
STATUS unregisterAddress(OBJECT *pParent, boost::string_ref path) override
IDataManagerSvc: Unregister object address from the data store. 
STATUS addPreLoadItem(const DataStoreItem &item) override
Add an item to the preload list. 
STATUS unlinkObject(OBJECT *from, boost::string_ref objPath) override
Remove a link to another object. 
STATUS findObject(OBJECT *parent, boost::string_ref path, OBJECT *&pObject) override
Find object in the data store. 
General service interface definition. 
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. 
virtual StatusCode updateObject(IRegistry *pDirectory)=0
Update object identified by its directory entry. 
STATUS unregisterAddress(IRegistry *pParent, boost::string_ref path) override
IDataManagerSvc: Unregister object address from the data store. 
STATUS activate(CSTR &nam) override
Activate a partition object. The name identifies the partition uniquely. 
STATUS linkObject(boost::string_ref fullPath, OBJECT *to) override
Add a link to another object. 
Definition of the basic interface. 
STATUS updateObject(OBJECT *parent, boost::string_ref updatePath) override
Update object. 
STATUS registerObject(OBJECT *parent, boost::string_ref obj, 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...
StatusCode reinitialize() override
STATUS clearPartitions()
Clear all partitions. 
virtual StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject)=0
Retrieve object identified by its directory entry. 
unsigned int CLID
Class ID definition. 
virtual StatusCode clearSubTree(boost::string_ref sub_path)=0
Remove all data objects below the sub tree identified by its full path name. 
STATUS findObject(boost::string_ref parent, int item, OBJECT *&pObject) override
Find object in the data store. 
Partition m_current
Current partition. 
STATUS preparePartitions()
Prepare partition for usage. 
STATUS registerAddress(OBJECT *parent, boost::string_ref path, ADDRESS *pAddr) override
IDataManagerSvc: Register object address with the data store. 
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. 
STATUS resetPreLoad() override
Clear the preload list. 
virtual StatusCode unregisterAddress(boost::string_ref fullPath)=0
Unregister object address from the data store. 
STATUS unregisterObject(OBJECT *pObj, int item) override
Unregister object from the data store. 
STATUS findObject(IRegistry *parent, boost::string_ref path, OBJECT *&pObj) override
Find object identified by its full path in the data store. 
virtual StatusCode unregisterObject(boost::string_ref fullPath)=0
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. 
STATUS unregisterObject(boost::string_ref path) override
Unregister object from the data store. 
Base class used to extend a class implementing other interfaces. 
virtual StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject)=0
Register object with the data store. 
STATUS activate(IInterface *pPartition) override
Activate a partition object. 
SmartIF< IAddressCreator > m_addrCreator
Reference to address creator. 
STATUS retrieveObject(boost::string_ref path, OBJECT *&pObj) override
Retrieve object identified by its full path from the data store. 
virtual StatusCode registerAddress(boost::string_ref fullPath, IOpaqueAddress *pAddress)=0
Register object address with the data store. 
StatusCode activePartition(std::string &nam, IInterface *&pPartition) const  override
Access the active partition object. 
STATUS retrieveObject(OBJECT *parent, boost::string_ref path, OBJECT *&pObj) override
Retrieve object from data store. 
STATUS retrieveObject(OBJECT *parent, int item, OBJECT *&pObj) override
Retrieve object from data store. 
STATUS updateObject(boost::string_ref path) override
Update object. 
STATUS unregisterObject(boost::string_ref parent, boost::string_ref obj) override
Unregister object from the data store. 
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one. 
Opaque address interface definition. 
STATUS linkObject(OBJECT *from, boost::string_ref objPath, OBJECT *to) override
Add a link to another object. 
details::composer_t< std::decay_t< lambda_ts >... > compose(lambda_ts &&...lambdas)
STATUS traverseSubTree(OBJECT *pObject, AGENT *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects below the sub tree. 
std::map< std::string, Partition > Partitions
A DataObject is the base class of any identifiable object on any data store. 
STATUS clearStore() override
IDataManagerSvc: Remove all data objects in the data store. 
STATUS updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry. 
STATUS retrieveObject(boost::string_ref parent, int item, OBJECT *&pObj) override
Retrieve object from data store. 
void toupper(std::string &s)
STATUS drop(IInterface *pPartition) override
Drop a partition object. The name identifies the partition uniquely. 
STATUS registerAddress(boost::string_ref path, ADDRESS *pAddr) override
IDataManagerSvc: Register object address with the data store. 
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. 
STATUS retrieveObject(boost::string_ref parent, boost::string_ref path, OBJECT *&pObj) override
Retrieve object from data store. 
STATUS objectParent(const IRegistry *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent. 
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.