The Gaudi Framework
v30r3 (a5ef0a68)
|
Create / access partitions. More...
#include <GaudiKernel/IPartitionControl.h>
Public Types | |
enum | Status : StatusCode::code_t { Status::PARTITION_NOT_PRESENT = 2, Status::PARTITION_EXISTS = 4, Status::NO_ACTIVE_PARTITION = 6 } |
Public Types inherited from IInterface | |
enum | Status : StatusCode::code_t { Status::FAILURE = 0, Status::SUCCESS = 1, Status::NO_INTERFACE, Status::VERSMISMATCH, Status::LAST_ERROR } |
Return status. More... | |
using | iid = Gaudi::InterfaceId< IInterface, 0, 0 > |
Interface ID. More... | |
using | ext_iids = Gaudi::interface_list< iid > |
Extra interfaces. More... | |
Public Member Functions | |
DeclareInterfaceID (IPartitionControl, 1, 0) | |
InterfaceID. More... | |
virtual StatusCode | create (const std::string &name, const std::string &type)=0 |
Create a partition object. The name identifies the partition uniquely. More... | |
virtual StatusCode | create (const std::string &name, const std::string &type, IInterface *&pPartition)=0 |
Create a partition object. The name identifies the partition uniquely. More... | |
virtual StatusCode | drop (const std::string &name)=0 |
Drop a partition object. The name identifies the partition uniquely. More... | |
virtual StatusCode | drop (IInterface *pPartition)=0 |
Drop a partition object. The name identifies the partition uniquely. More... | |
virtual StatusCode | activate (const std::string &name)=0 |
Activate a partition object. The name identifies the partition uniquely. More... | |
virtual StatusCode | activate (IInterface *pPartition)=0 |
Activate a partition object. More... | |
virtual StatusCode | get (const std::string &name, IInterface *&pPartition) const =0 |
Access a partition object. The name identifies the partition uniquely. More... | |
virtual StatusCode | activePartition (std::string &name, IInterface *&pPartition) const =0 |
Access the active partition object. More... | |
Public Member Functions inherited from IInterface | |
virtual void * | i_cast (const InterfaceID &) const =0 |
main cast function More... | |
virtual std::vector< std::string > | getInterfaceNames () const =0 |
Returns a vector of strings containing the names of all the implemented interfaces. More... | |
virtual unsigned long | addRef ()=0 |
Increment the reference count of Interface instance. More... | |
virtual unsigned long | release ()=0 |
Release Interface instance. More... | |
virtual unsigned long | refCount () const =0 |
Current reference count. More... | |
virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp)=0 |
Set the void** to the pointer to the requested interface of the instance. More... | |
virtual | ~IInterface ()=default |
Virtual destructor. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from IInterface | |
static const InterfaceID & | interfaceID () |
Return an instance of InterfaceID identifying the interface. More... | |
Create / access partitions.
Partitioning is used to switch between different instances of multi-services like it is used e.g. in the event buffer tampering.
Switch between buffers for data processing. Use this technique to populate e.g. different datastores in order to later compare the different results.
auto partCtrl = eventSvc().as<IPartitionControl>(); if ( partCtrl ) { if ( partCtrl.activate("Partition_1").isSuccess() ) { SmartDataPtr mcparts(eventSvc(), "MC/Particles"); .... work with particles from buffer "Partition 1" all data registered by code here will go to "Partition 2" } if ( partCtrl.activate("Partition_2").isSuccess() ) { SmartDataPtr mcparts(eventSvc(), "MC/Particles"); .... work with particles from buffer "Partition 2" they are NOT they same as those in buffer 1 all data registered by code here will go to "Partition 2" } }
The access to the underlying service is also possible.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Be careful: This usage MAY NOT MODIFY e.g. the datastore by adding additional objects! This should solely by used for analysis after buffer tampering. In particular with "data on demand" this can easily have unexpected results.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
auto partCtrl = eventSvc().as<IPartitionControl>(); if ( partCtrl ) { IInterface* ptr = 0; if ( partCtrl->get("Partition 1", ptr).isSuccess() ) { SmartIF<IDataProviderSvc> partition(ptr); // Now we can work directly with this partition // There is no additional dispathing in the "eventSvc()". SmartDataPtr mcparts(partition, "MC/Particles"); if ( mcparts ) { } } }
Definition at line 66 of file IPartitionControl.h.
|
strong |
Enumerator | |
---|---|
PARTITION_NOT_PRESENT | |
PARTITION_EXISTS | |
NO_ACTIVE_PARTITION |
Definition at line 175 of file IPartitionControl.h.
|
pure virtual |
Activate a partition object. The name identifies the partition uniquely.
Access an existing partition object. Preferred call. The activation of a partition does not change the state of the partition. It only means that any call issued to the corresponding multi-service will be redirected to the this partition - typically a service implementing the same interfaces as the multi-service.
name | [IN] Partition name |
|
pure virtual |
Activate a partition object.
Access an existing partition object. The activation of a partition does not change the state of the partition. It only means that any call issued to the corresponding multi-service will be redirected to the this partition - typically a service implementing the same interfaces as the multi-service.
If the interface pointer is invalid, IInterface::NO_INTERFACE is returned.
pPartition | [IN] Pointer to the partition. |
|
pure virtual |
Access the active partition object.
Access the active partition object.
name | [OUT] Partition name |
pPartition | [OUT] Location to store the pointer to the partition. |
|
pure virtual |
Create a partition object. The name identifies the partition uniquely.
Create a new partition. If the partition exists already the existing object is returned. In this event the return code is PARTITION_EXISTS. The partition type typically contains all the information necessary to access the corresponding service, typically a pair "<service-type>/<service name>"
name | [IN] Partition name |
type | [IN] Partition type |
|
pure virtual |
Create a partition object. The name identifies the partition uniquely.
Create a new partition. If the partition exists already the existing object is returned. In this event the return code is PARTITION_EXISTS. The partition type typically contains all the information necessary to access the corresponding service, typically a pair "<service-type>/<service name>"
name | [IN] Partition name |
type | [IN] Partition type |
pPartition | [OUT] Reference to the created/existing partition |
IPartitionControl::DeclareInterfaceID | ( | IPartitionControl | , |
1 | , | ||
0 | |||
) |
|
pure virtual |
Drop a partition object. The name identifies the partition uniquely.
Remove a partition object. If the partition object does not exists, the return code is PARTITION_NOT_PRESENT. The partition may not be used anymore after this call.
name | [IN] Partition name |
|
pure virtual |
Drop a partition object. The name identifies the partition uniquely.
Remove a partition object. If the partition object does not exists, the return code is PARTITION_NOT_PRESENT. The partition may not be used anymore after this call. If the interface pointer is invalid, IInterface::NO_INTERFACE is returned.
pPartition | [IN] Reference to existing partition |
|
pure virtual |
Access a partition object. The name identifies the partition uniquely.
Access an existing partition object.
name | [IN] Partition name |
pPartition | [IN] Location to store the pointer to the partition. |