8 #include "GaudiKernel/IPartitionControl.h"
9 #include "GaudiKernel/Algorithm.h"
10 #include "GaudiKernel/MsgStream.h"
11 #include "GaudiKernel/IToolSvc.h"
12 #include "GaudiKernel/IAlgTool.h"
13 #include "GaudiKernel/SmartIF.h"
28 using CSTR =
const std::string&;
45 declareProperty(
"Partition", m_partName);
46 declareProperty(
"Tool", m_toolType=
"PartitionSwitchTool");
55 STATUS sc = toolSvc()->retrieveTool(m_toolType,m_actor,
this);
57 log <<
MSG::ERROR <<
"Unable to load PartitionSwitchTool "
62 if ( tool ) toolSvc()->releaseTool(tool);
65 sc = m_actor->
get(m_partName, partititon);
67 log <<
MSG::ERROR <<
"Cannot access partition \""
68 << m_partName <<
"\"" <<
endmsg;
76 if ( tool ) toolSvc()->releaseTool(tool);
87 log <<
MSG::ERROR <<
"Cannot activate partition \""
88 << m_partName <<
"\"!" <<
endmsg;
94 <<
"." << m_toolType <<
"\" cannot be accessed!" <<
endmsg;
103 template <
typename...FArgs,
typename...Args>
105 return m_actor ? (m_actor->*
fun)(std::forward<Args>(
args)...) : NO_INTERFACE;
107 template <
typename...FArgs,
typename...Args>
109 return m_actor ? (m_actor->*
fun)(std::forward<Args>(
args)...) : NO_INTERFACE;
115 return sc.isSuccess() ?
sc :
log_(
sc,
"Cannot create partition: "+nam+
" of type "+typ);
120 return sc.isSuccess() ?
sc :
log_(
sc,
"Cannot create partition: "+nam+
" of type "+typ);
125 return sc.isSuccess() ?
sc :
log_(
sc,
"Cannot drop partition: "+nam);
130 return sc.isSuccess() ?
sc :
log_(
sc,
"Cannot drop partition by Interface.");
135 return sc.isSuccess() ?
sc :
log_(
sc,
"Cannot activate partition: "+nam);
140 return sc.isSuccess() ?
sc :
log_(
sc,
"Cannot activate partition by Interface.");
145 return sc.isSuccess() ?
sc :
log_(
sc,
"Cannot get partition "+nam);
150 return sc.isSuccess() ?
sc :
log_(
sc,
"Cannot determine active partition.");
StatusCode fwd_(StatusCode(IPartitionControl::*fun)(FArgs...) const, Args &&...args) const
Definition of the MsgStream class used to transmit messages.
Small smart pointer class with automatic reference counting for IInterface.
STATUS initialize() override
Initialize.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
virtual StatusCode activePartition(std::string &name, IInterface *&pPartition) const =0
Access the active partition object.
unsigned long getCode() const
Get the status code by value.
STATUS drop(IInterface *pPartition) override
Drop a partition object. The name identifies the partition uniquely.
StatusCode log_(StatusCode sc, const std::string &msg) const
bool isSuccess() const
Test for a status code of SUCCESS.
virtual StatusCode create(const std::string &name, const std::string &type)=0
Create a partition object. The name identifies the partition uniquely.
STATUS finalize() override
Finalize.
StatusCode fwd_(StatusCode(IPartitionControl::*fun)(FArgs...), Args &&...args)
bool isFailure() const
Test for a status code of FAILURE.
~PartitionSwitchAlg() override=default
Standard Destructor.
STATUS drop(CSTR nam) override
Drop a partition object. The name identifies the partition uniquely.
std::string m_partName
Job option to set the requested partition name.
This class is used for returning status codes from appropriate routines.
#define DECLARE_COMPONENT(type)
Definition of the basic interface.
virtual StatusCode get(const std::string &name, IInterface *&pPartition) const =0
Access a partition object. The name identifies the partition uniquely.
PartitionSwitchAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm constructor.
STATUS create(CSTR nam, CSTR typ, IInterface *&pPartition) override
Create a partition object. The name identifies the partition uniquely.
Small algorithm which switches the partition of a configurable multi-service.
STATUS activate(IInterface *pPartition) override
Activate a partition object.
Create / access partitions.
Base class used to extend a class implementing other interfaces.
double fun(const std::vector< double > &x)
STATUS create(CSTR nam, CSTR typ) override
Create a partition object. The name identifies the partition uniquely.
IPartitionControl * m_actor
reference to Partition Controller
virtual StatusCode drop(const std::string &name)=0
Drop a partition object. The name identifies the partition uniquely.
virtual StatusCode activate(const std::string &name)=0
Activate a partition object. The name identifies the partition uniquely.
STATUS activate(CSTR nam) override
Activate a partition object. The name identifies the partition uniquely.
STATUS activePartition(std::string &nam, IInterface *&pPartition) const override
Access the active partition object.
std::string m_toolType
Job option to set the tool manipulating the multi-service name.
STATUS execute() override
Execute procedure.