cast::CASTComponent Class Reference

#include <CASTComponent.hpp>

Inheritance diagram for cast::CASTComponent:

cast::interfaces::CASTComponent cast::SubarchitectureComponent ExampleComponent SimpleAggregateServer SimpleServer WordServerClient cast::SubarchitectureWorkingMemory cast::WorkingMemoryAttachedComponent cast::testing::SimpleWorkingMemory cast::TestWorkingMemory cast::WorkingMemoryWriterComponent cast::UnmanagedComponent cast::WorkingMemoryReaderComponent StraightMan cast::ManagedComponent cast::SubarchitectureTaskManager AssistantDirector AudienceMember cast::AbstractTester DirectAccessReader DirectAccessWriter Director ExampleManagedComponent FunnyMan PriorityTester cast::AlwaysPositiveTaskManager

List of all members.

Classes

class  Lock

Public Types

typedef
log4cxx::helpers::ObjectPtrT
< core::logging::ComponentLogger
ComponentLoggerPtr

Public Member Functions

 CASTComponent ()
virtual ~CASTComponent ()
virtual void setID (const std::string &_id, const Ice::Current &_ctx)
virtual void start (const Ice::Current &_ctx)
virtual void run (const Ice::Current &_ctx)
virtual void stop (const Ice::Current &_ctx)
virtual void destroy (const Ice::Current &)
const std::string & getProcessIdentifier () const __attribute__((deprecated))
const std::string & getComponentID () const
virtual std::string getID (const ::Ice::Current &_crt)
virtual void beat (const Ice::Current &_current) const
virtual void configure (const cdl::StringMap &_config, const Ice::Current &_current)
virtual void setComponentManager (const cast::interfaces::ComponentManagerPrx &_man, const ::Ice::Current &_ctx)
interfaces::ComponentManagerPrx getComponentManager () const
virtual void setTimeServer (const cast::interfaces::TimeServerPrx &_ts, const ::Ice::Current &_ctx)
void _setObjectAdapter (const Ice::ObjectAdapterPtr &_adapter)
Ice::ObjectAdapterPtr getObjectAdapter () const
Ice::CommunicatorPtr getCommunicator () const
void _setIceIdentity (const Ice::Identity &_id)
const Ice::Identity & getIceIdentity () const
virtual void println (const std::string &_s) const
virtual void println (const char *format,...) const
virtual void error (const std::string &_s) const
virtual void error (const char *format,...) const
bool isRunning () const
void _setComponentPointer (cast::CASTComponentPtr _ptr)
virtual void log (const std::string &_s) const
virtual void log (const char *format,...) const
virtual void debug (const std::string &_s) const
virtual void debug (const char *format,...) const
void lockProcess () __attribute__((deprecated))
void lockComponent ()
void unlockProcess () __attribute__((deprecated))
void unlockComponent ()
virtual ComponentLoggerPtr getLogger ()
virtual ComponentLoggerPtr getLogger (const std::string &_postfix)
virtual const
core::logging::LogAdditions
getLogAdditions ()
cdl::CASTTime getCASTTime () const
const interfaces::TimeServerPrx getTimeServer () const
template<class InterfaceType >
std::string toServantCategory () const
template<class PointerType >
void registerIceServer (const std::string &_name, const std::string &_category, IceInternal::Handle< PointerType > _servant)
template<class PointerType , class InterfaceType >
void registerIceServer (IceInternal::Handle< PointerType > _servant)
Ice::ObjectPrx getIceServer (const std::string &_name, const std::string &_category, const std::string &_host, unsigned int _port) const
template<typename InterfaceType >
InterfaceType::ProxyType getIceServer (const std::string &_componentID) const

Protected Member Functions

virtual std::string getLoggerName ()
const std::string & getColourEscape ()
virtual void destroy ()
virtual void destroyInternal (const Ice::Current &)
virtual void stop ()
virtual void stopInternal ()
virtual void configure (const std::map< std::string, std::string > &_config)
virtual void configureInternal (const std::map< std::string, std::string > &_config)
virtual void start ()
virtual void startInternal ()
virtual void runComponent ()
void sleepProcess (unsigned long _millis) __attribute__((deprecated))
void sleepComponent (unsigned long _millis)
cast::CASTComponentPtr getComponentPointer ()

Protected Attributes

bool m_bLogOutput
 Controls log output.
bool m_bDebugOutput
 Controls debug output.
ComponentLoggerPtr m_logger

Friends

class ComponentRunThread


Detailed Description

A basic component in the CAST framework. This class provides some basic functionality useful for running, printing and debugging. The component is not associated with a subarchitecture, so could be used for components that run externally to a CAST architecture (e.g. sensor).

Author:
nah

Definition at line 74 of file CASTComponent.hpp.


Member Typedef Documentation

Definition at line 340 of file CASTComponent.hpp.


Constructor & Destructor Documentation

cast::CASTComponent::CASTComponent (  ) 

Construct a new component with the given ubnique ID.

Parameters:
_id The id used to identify this component.

Definition at line 112 of file CASTComponent.cpp.

cast::CASTComponent::~CASTComponent (  )  [virtual]

Empty virtual destructor;

Definition at line 125 of file CASTComponent.cpp.


Member Function Documentation

void cast::CASTComponent::_setComponentPointer ( cast::CASTComponentPtr  _ptr  )  [inline]

Set the component's smart pointer to itself. Internal use only.

Definition at line 283 of file CASTComponent.hpp.

void cast::CASTComponent::_setIceIdentity ( const Ice::Identity &  _id  )  [inline]

Definition at line 230 of file CASTComponent.hpp.

void cast::CASTComponent::_setObjectAdapter ( const Ice::ObjectAdapterPtr &  _adapter  )  [inline]

Definition at line 211 of file CASTComponent.hpp.

virtual void cast::CASTComponent::beat ( const Ice::Current &  _current  )  const [inline, virtual]

The following methods are from CDL.ice and implement the component contract

Definition at line 181 of file CASTComponent.hpp.

virtual void cast::CASTComponent::configure ( const std::map< std::string, std::string > &  _config  )  [protected, virtual]

Overrides the configure method from FrameworkProcess to use _config to set the subarchitecture ID.

Typically overloaded by the subclasses to do the configuration

Parameters:
_config A map of config values.

Reimplemented in AudienceMember, Director, FunnyMan, StraightMan, cast::AbstractTester, cast::BasicTester, and cast::LockTester.

void cast::CASTComponent::configure ( const cdl::StringMap _config,
const Ice::Current &  _current 
) [virtual]

Definition at line 392 of file CASTComponent.cpp.

virtual void cast::CASTComponent::configureInternal ( const std::map< std::string, std::string > &  _config  )  [protected, virtual]

Configures internal CAST stuff

Parameters:
_config A map of config values.
Typically overloaded by the subclasses to perform things that should be done once after configuration but before the components starts running, i.e. runComponent is called.

Reimplemented in cast::SubarchitectureWorkingMemory, cast::WorkingMemoryAttachedComponent, cast::WorkingMemoryWriterComponent, and cast::SubarchitectureComponent.

void cast::CASTComponent::debug ( const char *  format,
  ... 
) const [virtual]

printf-like method

Parameters:
format (in) printf-style format std::string

Definition at line 290 of file CASTComponent.cpp.

virtual void cast::CASTComponent::debug ( const std::string &  _s  )  const [virtual]

Use an stl std::string as debug output. Only does anything if the variable m_bDebugOuput is true.

Parameters:
_s The stl std::string to log.

virtual void cast::CASTComponent::destroy (  )  [inline, protected, virtual]

Definition at line 510 of file CASTComponent.hpp.

void cast::CASTComponent::destroy ( const Ice::Current &  _crt  )  [virtual]

Definition at line 593 of file CASTComponent.cpp.

void cast::CASTComponent::destroyInternal ( const Ice::Current &  _crt  )  [protected, virtual]

Definition at line 599 of file CASTComponent.cpp.

void cast::CASTComponent::error ( const char *  format,
  ... 
) const [virtual]

printf-like method for error log.

Parameters:
format (in) printf-style format std::string

Definition at line 254 of file CASTComponent.cpp.

virtual void cast::CASTComponent::error ( const std::string &  _s  )  const [virtual]

Print out the input in a formatted way to error log.

Parameters:
_s Std::String to print.

cdl::CASTTime cast::CASTComponent::getCASTTime (  )  const [inline]

Get the current CAST time. This is a monotomic timer that starts at 0 on startup.

Definition at line 377 of file CASTComponent.hpp.

const std::string& cast::CASTComponent::getColourEscape (  )  [inline, protected]

Definition at line 506 of file CASTComponent.hpp.

Ice::CommunicatorPtr cast::CASTComponent::getCommunicator (  )  const [inline]

Definition at line 223 of file CASTComponent.hpp.

const std::string& cast::CASTComponent::getComponentID (  )  const [inline]

Get the unique identifier associated with this component.

Definition at line 166 of file CASTComponent.hpp.

interfaces::ComponentManagerPrx cast::CASTComponent::getComponentManager (  )  const [inline]

Get the manager component used for this component.

Definition at line 199 of file CASTComponent.hpp.

cast::CASTComponentPtr cast::CASTComponent::getComponentPointer (  )  [inline, protected]

this is a smart pointer to the current component, as used by Ice's object adapter. using this allows you to pass around a pointer to this component safely to ice to be used as a servant for something else

Definition at line 605 of file CASTComponent.hpp.

const Ice::Identity& cast::CASTComponent::getIceIdentity (  )  const [inline]

Definition at line 236 of file CASTComponent.hpp.

template<typename InterfaceType >
InterfaceType::ProxyType cast::CASTComponent::getIceServer ( const std::string &  _componentID  )  const [inline]

Resolve an Ice server provided by the given component providing the supplied interface. This relies on the server being registered with a registerIceServer call.

Definition at line 474 of file CASTComponent.hpp.

Ice::ObjectPrx cast::CASTComponent::getIceServer ( const std::string &  _name,
const std::string &  _category,
const std::string &  _host,
unsigned int  _port 
) const

Resolve an Ice server using the given details.

Definition at line 613 of file CASTComponent.cpp.

virtual std::string cast::CASTComponent::getID ( const ::Ice::Current &  _crt  )  [inline, virtual]

Implements cast::interfaces::CASTComponent.

Definition at line 172 of file CASTComponent.hpp.

virtual const core::logging::LogAdditions& cast::CASTComponent::getLogAdditions (  )  [inline, virtual]

Reimplemented in cast::SubarchitectureComponent.

Definition at line 366 of file CASTComponent.hpp.

virtual ComponentLoggerPtr cast::CASTComponent::getLogger ( const std::string &  _postfix  )  [inline, virtual]

Get a logger with a name that extends the component logger name.

Parameters:
_postfix String to be directly appended to base logger name.

Definition at line 361 of file CASTComponent.hpp.

virtual ComponentLoggerPtr cast::CASTComponent::getLogger (  )  [inline, virtual]

Get the logger used by this component.

Definition at line 345 of file CASTComponent.hpp.

virtual std::string cast::CASTComponent::getLoggerName (  )  [inline, protected, virtual]

Reimplemented in cast::SubarchitectureComponent.

Definition at line 501 of file CASTComponent.hpp.

Ice::ObjectAdapterPtr cast::CASTComponent::getObjectAdapter (  )  const [inline]

Definition at line 217 of file CASTComponent.hpp.

const std::string& cast::CASTComponent::getProcessIdentifier (  )  const [inline]

Get the process identifier of this process.

Definition at line 159 of file CASTComponent.hpp.

const interfaces::TimeServerPrx cast::CASTComponent::getTimeServer (  )  const [inline]

Get the time server used by this component. Can be used to perform more advanced time calculations.

Definition at line 385 of file CASTComponent.hpp.

bool cast::CASTComponent::isRunning (  )  const [inline]

Returns true while the component is running (i.e. post start())

Definition at line 275 of file CASTComponent.hpp.

void cast::CASTComponent::lockComponent (  ) 

Definition at line 559 of file CASTComponent.cpp.

void cast::CASTComponent::lockProcess (  )  [inline]

Acquire the semaphore for access to this component. Use lockComponent instead.

Definition at line 324 of file CASTComponent.hpp.

void cast::CASTComponent::log ( const char *  format,
  ... 
) const [virtual]

printf-like method

Parameters:
format (in) printf-style format std::string

Definition at line 270 of file CASTComponent.cpp.

virtual void cast::CASTComponent::log ( const std::string &  _s  )  const [virtual]

Log a stl std::string. Only does anything if the variable m_bLogOutput is true.

Parameters:
_s The stl std::string to log.

void cast::CASTComponent::println ( const char *  format,
  ... 
) const [virtual]

printf-like method

Parameters:
format (in) printf-style format std::string

Definition at line 239 of file CASTComponent.cpp.

virtual void cast::CASTComponent::println ( const std::string &  _s  )  const [virtual]

Print out the input in a formatted way.

Parameters:
_s Std::String to print.

template<class PointerType , class InterfaceType >
void cast::CASTComponent::registerIceServer ( IceInternal::Handle< PointerType _servant  )  [inline]

Resolve an ice server provided by the given component providing the supplied interface.

Parameters:
<PointerType> 
_servant 

Definition at line 454 of file CASTComponent.hpp.

template<class PointerType >
void cast::CASTComponent::registerIceServer ( const std::string &  _name,
const std::string &  _category,
IceInternal::Handle< PointerType _servant 
) [inline]

Registers the provided servant as a Ice server that can offer the provided interface. Servants are automatically removed at shutdown.

Parameters:
<Type> 
name 
category 
_servant 

Definition at line 435 of file CASTComponent.hpp.

void cast::CASTComponent::run ( const Ice::Current &  _ctx  )  [virtual]

Definition at line 138 of file CASTComponent.cpp.

virtual void cast::CASTComponent::runComponent (  )  [inline, protected, virtual]

Method called in separate thread to run processing component. This method is called for each component when it is started by the framework process server.

Reimplemented in cast::SubarchitectureWorkingMemory, AssistantDirector, AudienceMember, Director, FunnyMan, StraightMan, ExampleComponent, ExampleManagedComponent, WordServerClient, cast::AbstractTester, and DirectAccessWriter.

Definition at line 565 of file CASTComponent.hpp.

virtual void cast::CASTComponent::setComponentManager ( const cast::interfaces::ComponentManagerPrx _man,
const ::Ice::Current &  _ctx 
) [inline, virtual]

Definition at line 190 of file CASTComponent.hpp.

void cast::CASTComponent::setID ( const std::string &  _id,
const Ice::Current &  _ctx 
) [virtual]

Definition at line 308 of file CASTComponent.cpp.

virtual void cast::CASTComponent::setTimeServer ( const cast::interfaces::TimeServerPrx _ts,
const ::Ice::Current &  _ctx 
) [inline, virtual]

Definition at line 205 of file CASTComponent.hpp.

void cast::CASTComponent::sleepComponent ( unsigned long  _millis  )  [protected]

Put the calling thread to sleep for a number of milliseconds.

Parameters:
_millis Number of milliseconds to sleep for.

Definition at line 587 of file CASTComponent.cpp.

void cast::CASTComponent::sleepProcess ( unsigned long  _millis  )  [inline, protected]

Wait until the unlockProcess is successfully called. Put the processes thread to sleep for a number of milliseconds. Use sleep component instead.

Parameters:
_millis Number of milliseconds to sleep for.

Definition at line 580 of file CASTComponent.hpp.

void cast::CASTComponent::start (  )  [protected, virtual]

Called on component start, after configure, before runComponent. At this stage all connections are complete.

Typically overloaded by the subclasses to perform things that should be done once after configuration but before the components starts running, i.e. runComponent is called.

Reimplemented in AssistantDirector, AudienceMember, Director, FunnyMan, ExampleManagedComponent, PriorityTester, SimpleAggregateServer, SimpleServer, and DirectAccessReader.

Definition at line 381 of file CASTComponent.cpp.

void cast::CASTComponent::start ( const Ice::Current &  _ctx  )  [virtual]

Definition at line 314 of file CASTComponent.cpp.

void cast::CASTComponent::startInternal (  )  [protected, virtual]

Reimplemented in cast::WorkingMemoryReaderComponent.

Definition at line 384 of file CASTComponent.cpp.

void cast::CASTComponent::stop (  )  [protected, virtual]

Called when component should be stopped. Makes isRunning() false.

Definition at line 224 of file CASTComponent.cpp.

void cast::CASTComponent::stop ( const Ice::Current &  _ctx  )  [virtual]

Definition at line 148 of file CASTComponent.cpp.

void cast::CASTComponent::stopInternal (  )  [protected, virtual]

Reimplemented in cast::ManagedComponent, and cast::WorkingMemoryReaderComponent.

Definition at line 227 of file CASTComponent.cpp.

template<class InterfaceType >
std::string cast::CASTComponent::toServantCategory (  )  const [inline]

Converts an Ice type to a string used for its category in in a server. some::type::Name becomes some.type.Name

Definition at line 396 of file CASTComponent.hpp.

void cast::CASTComponent::unlockComponent (  ) 

Release the semaphore for access to this component.

Definition at line 566 of file CASTComponent.cpp.

void cast::CASTComponent::unlockProcess (  )  [inline]

Release the semaphore for access to this component. Use unlockComponent instead.

Definition at line 334 of file CASTComponent.hpp.


Friends And Related Function Documentation

friend class ComponentRunThread [friend]

Definition at line 558 of file CASTComponent.hpp.


Member Data Documentation

Controls debug output.

Definition at line 597 of file CASTComponent.hpp.

Controls log output.

Definition at line 595 of file CASTComponent.hpp.

Definition at line 610 of file CASTComponent.hpp.


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

Generated on Mon Jun 13 15:55:25 2011 for CAST C++ by  doxygen 1.5.8