| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# PartitionSwitchAlg Class Reference

Inheritance diagram for PartitionSwitchAlg:

[legend]
Collaboration diagram for PartitionSwitchAlg:

[legend]
List of all members.

## Detailed Description

Small algorith, which switches the partition of a configurable multi-service.

The algorithm can be part of a sequence, which allows for e.g. buffer tampering.

Author:
  : M.Frank

Version:
  : 1.0

Definition at line 26 of file PartitionSwitchAlg.cpp.

## Public Member Functions
| PartitionSwitchAlg (CSTR name, ISvcLocator *pSvcLocator)
| Standard algorithm constructor.
virtual | ~PartitionSwitchAlg ()
| Standard Destructor.
virtual STATUS | queryInterface (const InterfaceID &riid, void **ppvUnknown)
| IInterface overload: Query implemented interface(s).
virtual STATUS | initialize ()
| Initialize.
virtual STATUS | finalize ()
| Finalize.
virtual STATUS | execute ()
| Execute procedure.
void | _check (STATUS sc, CSTR msg) const
virtual STATUS | create (CSTR nam, CSTR typ)
| Create a partition object. The name identifies the partition uniquely.
virtual STATUS | create (CSTR nam, CSTR typ, IInterface *&pPartition)
| Create a partition object. The name identifies the partition uniquely.
virtual STATUS | drop (CSTR nam)
| Drop a partition object. The name identifies the partition uniquely.
virtual STATUS | drop (IInterface *pPartition)
| Drop a partition object. The name identifies the partition uniquely.
virtual STATUS | activate (CSTR nam)
| Activate a partition object. The name identifies the partition uniquely.
virtual STATUS | activate (IInterface *pPartition)
| Activate a partition object.
virtual STATUS | get (CSTR nam, IInterface *&pPartition) const
| Access a partition object. The name identifies the partition uniquely.
virtual STATUS | activePartition (std::string &nam, IInterface *&pPartition) const
| Access the active partition object.
## Private Types
typedef StatusCode | STATUS
typedef const std::string & | CSTR
## Private Attributes
std::string | m_partName
| Job option to set the reuested partition name.
std::string | m_toolType
| Job option to set the tool manipulating the multi-service name.
IPartitionControl * | m_actor
| reference to Partition Controller

## Member Typedef Documentation

typedef StatusCode PartitionSwitchAlg::STATUS`[private]`

Definition at line 28 of file PartitionSwitchAlg.cpp.

typedef const std::string& PartitionSwitchAlg::CSTR`[private]`

Definition at line 29 of file PartitionSwitchAlg.cpp.

## Constructor & Destructor Documentation

PartitionSwitchAlg::PartitionSwitchAlg | ( | CSTR | name,
|  | ISvcLocator * | pSvcLocator |
| ) |  |  | `[inline]`

Standard algorithm constructor.

Definition at line 43 of file PartitionSwitchAlg.cpp.

References Algorithm::declareProperty(), m_partName, and m_toolType.

    00044   :     Algorithm(name, pSvcLocator), m_actor(0)
    00045   {
    00046     declareProperty("Partition",  m_partName);
    00047     declareProperty("Tool",       m_toolType="PartitionSwitchTool");
    00048   }

virtual PartitionSwitchAlg::~PartitionSwitchAlg | ( |  | ) | `[inline, virtual]`

Standard Destructor.

Definition at line 50 of file PartitionSwitchAlg.cpp.

    00050                                     {
    00051   }

## Member Function Documentation

virtual STATUS PartitionSwitchAlg::queryInterface | ( | const InterfaceID & | riid,
|  | void ** | ppvUnknown |
| ) |  |  | `[inline, virtual]`

IInterface overload: Query implemented interface(s).

Reimplemented from Algorithm.

Definition at line 54 of file PartitionSwitchAlg.cpp.

References Algorithm::addRef(), IPartitionControl::interfaceID(), Algorithm::queryInterface(), and IInterface::SUCCESS.

    00054                                                                             {
    00055     if ( IPartitionControl::interfaceID().versionMatch(riid) )
    00056       *ppvUnknown = (IPartitionControl*)this;
    00057     else
    00058       return Algorithm::queryInterface(riid, ppvUnknown);
    00059     addRef();
    00060     return SUCCESS;
    00061   }

virtual STATUS PartitionSwitchAlg::initialize | ( |  | ) | `[inline, virtual]`

Initialize.

Release old tool

Now check if the partition is present. If not: try to create it

Reimplemented from Algorithm.

Definition at line 64 of file PartitionSwitchAlg.cpp.

References endmsg(), MSG::ERROR, IPartitionControl::get(), StatusCode::isFailure(), StatusCode::isSuccess(), m_actor, m_partName, m_toolType, Algorithm::msgSvc(), Algorithm::name(), IToolSvc::releaseTool(), IToolSvc::retrieveTool(), and Algorithm::toolSvc().

    00064                                 {
    00065     MsgStream log(msgSvc(), name());
    00066     SmartIF<IAlgTool> tool(m_actor);
    00067     STATUS sc = toolSvc()->retrieveTool(m_toolType,m_actor,this);
    00068     if ( sc.isFailure() ) {
    00069       log << MSG::ERROR << "Unable to load PartitionSwitchTool "
    00070           << m_toolType << endmsg;
    00071       return sc;
    00072     }
    00074     if ( tool ) toolSvc()->releaseTool(tool);
    00076     IInterface* partititon = 0;
    00077     sc = m_actor->get(m_partName, partititon);
    00078     if ( !sc.isSuccess() )  {
    00079       log << MSG::ERROR << "Cannot access partition \""
    00080           << m_partName << "\"" << endmsg;
    00081     }
    00082     return sc;
    00083   }

virtual STATUS PartitionSwitchAlg::finalize | ( | void |  | ) | `[inline, virtual]`

Finalize.

Reimplemented from Algorithm.

Definition at line 86 of file PartitionSwitchAlg.cpp.

References m_actor, IToolSvc::releaseTool(), StatusCode::SUCCESS, and Algorithm::toolSvc().

    00086                             {
    00087     SmartIF<IAlgTool> tool(m_actor);
    00088     if ( tool ) toolSvc()->releaseTool(tool);
    00089     m_actor = 0;
    00090     return STATUS::SUCCESS;
    00091   }

virtual STATUS PartitionSwitchAlg::execute | ( |  | ) | `[inline, virtual]`

Execute procedure.

Implements IAlgorithm.

Definition at line 94 of file PartitionSwitchAlg.cpp.

References IPartitionControl::activate(), endmsg(), MSG::ERROR, StatusCode::FAILURE, StatusCode::isSuccess(), m_actor, m_partName, m_toolType, Algorithm::msgSvc(), and Algorithm::name().

    00094                               {
    00095     if ( m_actor )  {
    00096       STATUS sc = m_actor->activate(m_partName);
    00097       if ( !sc.isSuccess() )  {
    00098         MsgStream log(msgSvc(), name());
    00099         log << MSG::ERROR << "Cannot activate partition \""
    00100             << m_partName << "\"!" << endmsg;
    00101       }
    00102       return sc;
    00103     }
    00104     MsgStream log(msgSvc(), name());
    00105     log << MSG::ERROR << "The partition control tool \"" << name()
    00106         << "." << m_toolType << "\" cannot be accessed!" << endmsg;
    00107     return STATUS::FAILURE;
    00108   }

void PartitionSwitchAlg::_check | ( | STATUS | sc,
|  | CSTR | msg |
| ) |  |  | const`[inline]`

Definition at line 110 of file PartitionSwitchAlg.cpp.

References endmsg(), MSG::ERROR, StatusCode::getCode(), Algorithm::msgSvc(), and Algorithm::name().

    00110                                           {
    00111     MsgStream log(msgSvc(), name());
    00112     log << MSG::ERROR << msg << " Status=" << sc.getCode() << endmsg;
    00113   }

virtual STATUS PartitionSwitchAlg::create | ( | CSTR | nam,
|  | CSTR | typ |
| ) |  |  | `[inline, virtual]`

Create a partition object. The name identifies the partition uniquely.

Definition at line 117 of file PartitionSwitchAlg.cpp.

References CHECK, IPartitionControl::create(), m_actor, and IInterface::NO_INTERFACE.

    00117                                              {
    00118     STATUS sc = m_actor ? m_actor->create(nam,typ) : NO_INTERFACE;
    00119     CHECK(sc, "Cannot create partition: "+nam+" of type "+typ);
    00120   }

virtual STATUS PartitionSwitchAlg::create | ( | CSTR | nam,
|  | CSTR | typ,
|  | IInterface *& | pPartition |
| ) |  |  | `[inline, virtual]`

Create a partition object. The name identifies the partition uniquely.

Definition at line 122 of file PartitionSwitchAlg.cpp.

References CHECK, IPartitionControl::create(), m_actor, and IInterface::NO_INTERFACE.

    00122                                                                       {
    00123     STATUS sc = m_actor ? m_actor->create(nam,typ,pPartition) : NO_INTERFACE;
    00124     CHECK(sc, "Cannot create partition: "+nam+" of type "+typ);
    00125   }

virtual STATUS PartitionSwitchAlg::drop | ( | CSTR | nam | ) | `[inline, virtual]`

Drop a partition object. The name identifies the partition uniquely.

Definition at line 127 of file PartitionSwitchAlg.cpp.

References CHECK, IPartitionControl::drop(), m_actor, and IInterface::NO_INTERFACE.

    00127                                  {
    00128     STATUS sc = m_actor ? m_actor->drop(nam) : NO_INTERFACE;
    00129     CHECK(sc, "Cannot drop partition: "+nam);
    00130   }

virtual STATUS PartitionSwitchAlg::drop | ( | IInterface * | pPartition | ) | `[inline, virtual]`

Drop a partition object. The name identifies the partition uniquely.

Implements IPartitionControl.

Definition at line 132 of file PartitionSwitchAlg.cpp.

References CHECK, IPartitionControl::drop(), m_actor, and IInterface::NO_INTERFACE.

    00132                                                {
    00133     STATUS sc = m_actor ? m_actor->drop(pPartition) : NO_INTERFACE;
    00134     CHECK(sc, "Cannot drop partition by Interface.");
    00135   }

virtual STATUS PartitionSwitchAlg::activate | ( | CSTR | nam | ) | `[inline, virtual]`

Activate a partition object. The name identifies the partition uniquely.

Definition at line 137 of file PartitionSwitchAlg.cpp.

References IPartitionControl::activate(), CHECK, m_actor, and IInterface::NO_INTERFACE.

    00137                                      {
    00138     STATUS sc = m_actor ? m_actor->activate(nam) : NO_INTERFACE;
    00139     CHECK(sc, "Cannot activate partition: "+nam);
    00140   }

virtual STATUS PartitionSwitchAlg::activate | ( | IInterface * | pPartition | ) | `[inline, virtual]`

Activate a partition object.

Implements IPartitionControl.

Definition at line 142 of file PartitionSwitchAlg.cpp.

References IPartitionControl::activate(), CHECK, m_actor, and IInterface::NO_INTERFACE.

    00142                                                    {
    00143     STATUS sc = m_actor ? m_actor->activate(pPartition) : NO_INTERFACE;
    00144     CHECK(sc, "Cannot activate partition by Interface.");
    00145   }

virtual STATUS PartitionSwitchAlg::get | ( | CSTR | nam,
|  | IInterface *& | pPartition |
| ) |  |  | const`[inline, virtual]`

Access a partition object. The name identifies the partition uniquely.

Definition at line 147 of file PartitionSwitchAlg.cpp.

References CHECK, IPartitionControl::get(), m_actor, and IInterface::NO_INTERFACE.

    00147                                                                {
    00148     STATUS sc = m_actor ? m_actor->get(nam, pPartition) : NO_INTERFACE;
    00149     CHECK(sc, "Cannot get partition "+nam);
    00150   }

virtual STATUS PartitionSwitchAlg::activePartition | ( | std::string & | nam,
|  | IInterface *& | pPartition |
| ) |  |  | const`[inline, virtual]`

Access the active partition object.

Implements IPartitionControl.

Definition at line 152 of file PartitionSwitchAlg.cpp.

References IPartitionControl::activePartition(), CHECK, m_actor, and IInterface::NO_INTERFACE.

    00152                                                                                  {
    00153     STATUS sc = m_actor ? m_actor->activePartition(nam, pPartition) : NO_INTERFACE;
    00154     CHECK(sc, "Cannot determine active partition.");
    00155   }

## Member Data Documentation

std::string PartitionSwitchAlg::m_partName`[private]`

Job option to set the reuested partition name.

Definition at line 34 of file PartitionSwitchAlg.cpp.

Referenced by execute(), initialize(), and PartitionSwitchAlg().

std::string PartitionSwitchAlg::m_toolType`[private]`

Job option to set the tool manipulating the multi-service name.

Definition at line 36 of file PartitionSwitchAlg.cpp.

Referenced by execute(), initialize(), and PartitionSwitchAlg().

IPartitionControl* PartitionSwitchAlg::m_actor`[private]`

reference to Partition Controller

Definition at line 38 of file PartitionSwitchAlg.cpp.

Referenced by activate(), activePartition(), create(), drop(), execute(), finalize(), get(), and initialize().

The documentation for this class was generated from the following file:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiSvc/v17r1/src/DataSvc/PartitionSwitchAlg.cpp