Gaudi Framework, version v22r2

Home   Generated: Tue May 10 2011
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:
Inheritance graph
[legend]
Collaboration diagram for PartitionSwitchAlg:
Collaboration graph
[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::stringCSTR

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

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 ( void   ) [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

reference to Partition Controller

Definition at line 38 of file PartitionSwitchAlg.cpp.

Job option to set the requested partition name.

Definition at line 34 of file PartitionSwitchAlg.cpp.

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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Tue May 10 2011 18:55:01 for Gaudi Framework, version v22r2 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004