| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Public Member Functions | Private Types | Private Attributes

# PartitionSwitchAlg Class Reference

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

Inheritance diagram for PartitionSwitchAlg:
[legend]
Collaboration diagram for PartitionSwitchAlg:
[legend]

List of all members.

## Public Member Functions
| PartitionSwitchAlg (CSTR name, ISvcLocator *pSvcLocator)
| Standard algorithm constructor.
virtual | ~PartitionSwitchAlg ()
| Standard Destructor.
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 requested partition name.
std::string | m_toolType
| Job option to set the tool manipulating the multi-service name.
IPartitionControl * | m_actor
| reference to Partition Controller

## 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.

## Member Typedef Documentation

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

Definition at line 29 of file PartitionSwitchAlg.cpp.

typedef StatusCode PartitionSwitchAlg::STATUS`[private]`

Definition at line 28 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.

      : base_class(name, pSvcLocator), m_actor(0)
      {
        declareProperty("Partition",  m_partName);
        declareProperty("Tool",       m_toolType="PartitionSwitchTool");
      }

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

Standard Destructor.

Definition at line 50 of file PartitionSwitchAlg.cpp.

                                        {
      }

## Member Function Documentation

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

Definition at line 100 of file PartitionSwitchAlg.cpp.

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

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

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

Definition at line 127 of file PartitionSwitchAlg.cpp.

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

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

Activate a partition object.

Implements IPartitionControl.

Definition at line 132 of file PartitionSwitchAlg.cpp.

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

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

Access the active partition object.

Implements IPartitionControl.

Definition at line 142 of file PartitionSwitchAlg.cpp.

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

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

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

Definition at line 107 of file PartitionSwitchAlg.cpp.

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

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 112 of file PartitionSwitchAlg.cpp.

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

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

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

Implements IPartitionControl.

Definition at line 122 of file PartitionSwitchAlg.cpp.

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

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

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

Definition at line 117 of file PartitionSwitchAlg.cpp.

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

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

Execute procedure.

Definition at line 84 of file PartitionSwitchAlg.cpp.

                                  {
        if ( m_actor )  {
          STATUS sc = m_actor->activate(m_partName);
          if ( !sc.isSuccess() )  {
            MsgStream log(msgSvc(), name());
            log << MSG::ERROR << "Cannot activate partition \""
                << m_partName << "\"!" << endmsg;
          }
          return sc;
        }
        MsgStream log(msgSvc(), name());
        log << MSG::ERROR << "The partition control tool \"" << name()
            << "." << m_toolType << "\" cannot be accessed!" << endmsg;
        return STATUS::FAILURE;
      }

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

Finalize.

Reimplemented from Algorithm.

Definition at line 76 of file PartitionSwitchAlg.cpp.

                                {
        SmartIF<IAlgTool> tool(m_actor);
        if ( tool ) toolSvc()->releaseTool(tool);
        m_actor = 0;
        return STATUS::SUCCESS;
      }

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

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

Definition at line 137 of file PartitionSwitchAlg.cpp.

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

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 54 of file PartitionSwitchAlg.cpp.

                                    {
        MsgStream log(msgSvc(), name());
        SmartIF<IAlgTool> tool(m_actor);
        STATUS sc = toolSvc()->retrieveTool(m_toolType,m_actor,this);
        if ( sc.isFailure() ) {
          log << MSG::ERROR << "Unable to load PartitionSwitchTool "
              << m_toolType << endmsg;
          return sc;
        }
        if ( tool ) toolSvc()->releaseTool(tool);
        IInterface* partititon = 0;
        sc = m_actor->get(m_partName, partititon);
        if ( !sc.isSuccess() )  {
          log << MSG::ERROR << "Cannot access partition \""
              << m_partName << "\"" << endmsg;
        }
        return sc;
      }

## Member Data Documentation

IPartitionControl* PartitionSwitchAlg::m_actor`[private]`

reference to Partition Controller

Definition at line 38 of file PartitionSwitchAlg.cpp.

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

Job option to set the requested partition name.

Definition at line 34 of file PartitionSwitchAlg.cpp.

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.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiCommonSvc/src/DataSvc/PartitionSwitchAlg.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines