/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Private Attributes
ConcreteAlgorithm Class Reference

#include <ConcreteAlgorithm.h>

List of all members.

Public Member Functions

 ConcreteAlgorithm (const std::string &name, ISvcLocator *svcloc)
virtual ~ConcreteAlgorithm ()
StatusCode initialize ()
StatusCode reinitialize ()
StatusCode beginRun ()
StatusCode execute ()
StatusCode endRun ()
StatusCode finalize ()
StatusCode setProperty (const Property &p)

Private Attributes

MsgStream m_log
ToolHandle< IVirtualToolm_privTool
ToolHandle< IVirtualToolm_pubTool
ToolHandleArray< IVirtualToolm_listOfPrivateTools
ToolHandleArray< IVirtualToolm_listOfPublicTools
std::vector< std::string > m_strings
double m_double

Detailed Description

Definition at line 15 of file ConcreteAlgorithm.h.


Constructor & Destructor Documentation

ConcreteAlgorithm::ConcreteAlgorithm ( const std::string &  name,
ISvcLocator *  svcloc 
)

Definition at line 5 of file ConcreteAlgorithm.cc.

    : Algorithm(name, svcloc)
    , m_log(msgSvc(),name)
    , m_privTool("ConcreteTool",this)
    , m_pubTool("ConcreteTool")
    , m_listOfPrivateTools(this)
    , m_listOfPublicTools()
{
    declareProperty( "PrivateTool",  m_privTool, "A private tools" );
    declareProperty( "PublicTool",   m_pubTool,  "A public tools" );
    declareProperty( "PrivateToolList",  m_listOfPrivateTools, "list of private helper tools" );
    declareProperty( "PublicToolList",   m_listOfPublicTools,  "list of public helper tools" );
    declareProperty( "StringList", m_strings, "list of strings");
    declareProperty( "Double", m_double=3.141592, "a double");
}
ConcreteAlgorithm::~ConcreteAlgorithm ( ) [virtual]

Definition at line 20 of file ConcreteAlgorithm.cc.

{
}

Member Function Documentation

StatusCode ConcreteAlgorithm::initialize ( )

Definition at line 24 of file ConcreteAlgorithm.cc.

{
    m_log << MSG::INFO << "initialize()" << endreq;
    m_log.setLevel( outputLevel() );
   
    m_log << "Retrieving public tool " << m_pubTool.typeAndName() << endreq;
    if ( m_pubTool.retrieve().isFailure() ) {
        m_log << MSG::ERROR << "Failed to retreive " << m_pubTool << endreq;
        return StatusCode::FAILURE;
    } else {
        m_log << MSG::INFO << "Retrieved " << m_pubTool << endreq;
    }

    m_log << "Retrieving private tool " << m_privTool.typeAndName() << endreq;
    if ( m_privTool.retrieve().isFailure() ) {
        m_log << MSG::ERROR << "Failed to retreive " << m_privTool << endreq;
        return StatusCode::FAILURE;
    } else {
        m_log << MSG::INFO << "Retrieved " << m_privTool << endreq;
    }


    // public
    m_log << MSG::INFO << "Retrieving public tool list" << endreq;
    if ( m_listOfPublicTools.retrieve().isFailure() ) {
        m_log << MSG::ERROR << "Failed to retreive " << m_listOfPublicTools << endreq;
        return StatusCode::FAILURE;
    } else {
        m_log << MSG::INFO << "Retrieved " << m_listOfPublicTools << endreq;
    }

    // private
    m_log << MSG::INFO << "Retrieving private tool list" << endreq;
    if ( m_listOfPrivateTools.retrieve().isFailure() ) {
        m_log << MSG::ERROR << "Failed to retreive " << m_listOfPrivateTools << endreq;
        return StatusCode::FAILURE;
    } else {
        m_log << MSG::INFO << "Retrieved " << m_listOfPrivateTools << endreq;
    }

    return StatusCode::SUCCESS;
}
StatusCode ConcreteAlgorithm::reinitialize ( )

Definition at line 66 of file ConcreteAlgorithm.cc.

{
    m_log << MSG::INFO << "reinitialize()" << endreq;
    return this->initialize();
}
StatusCode ConcreteAlgorithm::beginRun ( )

Definition at line 71 of file ConcreteAlgorithm.cc.

{
    m_log << MSG::INFO << "beginRun()" << endreq;
    return StatusCode::SUCCESS;
}
StatusCode ConcreteAlgorithm::execute ( )

Definition at line 76 of file ConcreteAlgorithm.cc.

{
    m_log << MSG::INFO << "exectue()" << endreq;

    static int count = 0;
    ++count;
    double value = -5 + count;

    // make list of private tools do their work
    ToolHandleArray<IVirtualTool>::iterator itPriv = m_listOfPrivateTools.begin(),
        itPrivEnd = m_listOfPrivateTools.end();
    for (  ; itPriv != itPrivEnd; ++itPriv ) {
        StatusCode sc = (*itPriv)->doSomething(value);
        if ( sc.isFailure() ) {
            m_log << MSG::ERROR << "tool " << (*itPriv).typeAndName() 
                  << " failed it's task ... stop!" << endreq;
            return sc;
        }
        m_log << MSG::INFO << "Public: value = " << value << endreq;
    }

    // make list of tools do their work
    ToolHandleArray< IVirtualTool >::iterator itPub = m_listOfPublicTools.begin(),
        itPubEnd = m_listOfPublicTools.end();
    for (  ; itPub != itPubEnd; ++itPub ) {
        StatusCode sc = (*itPub)->doSomething(value);
        if ( sc.isFailure() ) {
            m_log << MSG::ERROR << "tool " << (*itPub).typeAndName() << 
                " failed it's task ... stop!" << endreq;
            return sc;
        }
        m_log << MSG::INFO << "Private: value = " << value << endreq;
    }
    return StatusCode::SUCCESS;
}
StatusCode ConcreteAlgorithm::endRun ( )

Definition at line 111 of file ConcreteAlgorithm.cc.

{
    m_log << MSG::INFO << "endRun()" << endreq;
    return StatusCode::SUCCESS;
}
StatusCode ConcreteAlgorithm::finalize ( )

Definition at line 116 of file ConcreteAlgorithm.cc.

{
    m_log << MSG::INFO << "finalize()" << endreq;
    return StatusCode::SUCCESS;
}
StatusCode ConcreteAlgorithm::setProperty ( const Property &  p)

Definition at line 122 of file ConcreteAlgorithm.cc.

{
    string name = p.name();

    m_log << MSG::INFO << "ConcreateAlgorithm::setProperty("<<name<<")" << endreq;
    if (dynamic_cast<const GaudiHandleProperty*>(&p)) {
        m_log << "Got a GaudiHandleProperty" << endreq;
    }
    if (dynamic_cast<const GaudiHandleArrayProperty*>(&p)) {
        m_log << "Got a GaudiHandleArrayProperty" << endreq;
        const GaudiHandleArrayProperty& ghap = dynamic_cast<const GaudiHandleArrayProperty&>(p);
        const vector<string> tan = ghap.value().typesAndNames();
        for (size_t ind=0; ind<tan.size(); ++ind) {
            m_log << "\n" << ind << ": " << tan[ind];
        }
        m_log << endreq;
    }
    if (dynamic_cast<const PropertyWithValue<GaudiHandleArrayBase>*>(&p)) {
        m_log << "Got a PropertyWithValue<GaudiHandleArrayBase>" << endreq;
    }
    // This is what the tool lists are coming in as!
    if (dynamic_cast<const SimpleProperty<string>*>(&p)) {
        m_log << "Got a SimpleProperty<string>" << endreq;
    }

    m_log << MSG::INFO << "Property::toString(): " << p.toString() << endreq;

    m_log << MSG::INFO << "Now calling Algorithm::setProperty()" << endreq;
    return Algorithm::setProperty(p);
}

Member Data Documentation

MsgStream ConcreteAlgorithm::m_log [private]

Definition at line 30 of file ConcreteAlgorithm.h.

Definition at line 31 of file ConcreteAlgorithm.h.

Definition at line 31 of file ConcreteAlgorithm.h.

Definition at line 32 of file ConcreteAlgorithm.h.

Definition at line 33 of file ConcreteAlgorithm.h.

std::vector<std::string> ConcreteAlgorithm::m_strings [private]

Definition at line 34 of file ConcreteAlgorithm.h.

double ConcreteAlgorithm::m_double [private]

Definition at line 35 of file ConcreteAlgorithm.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:53:50 for ConfigurableExample by doxygen 1.7.4