Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
RTT::corba::TaskContextProxy Class Reference

#include <TaskContextProxy.hpp>

Inheritance diagram for RTT::corba::TaskContextProxy:
Inheritance graph
[legend]

Public Types

typedef std::map< TaskContextProxy *, corba::CTaskContext_ptr > PMap
 
- Public Types inherited from RTT::TaskContext
typedef std::vector< std::string > PeerList
 
typedef boost::function< void(base::PortInterface *)> SlotFunction
 
- Public Types inherited from RTT::base::TaskCore
enum  TaskState {
  Init, PreOperational, FatalError, Exception,
  Stopped, Running, RunTimeError
}
 

Public Member Functions

virtual bool activate ()
 
virtual bool addPeer (TaskContext *peer, std::string alias="")
 
virtual bool cleanup ()
 
virtual bool configure ()
 
virtual bool connectPeers (TaskContext *peer)
 
virtual bool connectPorts (TaskContext *peer)
 
virtual bool connectServices (TaskContext *peer)
 
virtual void disconnectPeers (const std::string &name)
 
virtual TaskContextgetPeer (const std::string &peer_name) const
 
virtual PeerList getPeerList () const
 
virtual TaskState getTaskState () const
 
virtual bool hasPeer (const std::string &peer_name) const
 
virtual bool inException () const
 
virtual bool inFatalError () const
 
virtual bool inRunTimeError () const
 
virtual bool isActive () const
 
virtual bool isConfigured () const
 
virtual bool isRunning () const
 
virtual bool ready ()
 
virtual bool recover ()
 
virtual void removePeer (const std::string &name)
 
virtual void removePeer (TaskContext *peer)
 
corba::CTaskContext_ptr server () const
 
virtual void setName (const std::string &n)
 
virtual bool start ()
 
virtual bool stop ()
 
 ~TaskContextProxy ()
 
- Public Member Functions inherited from RTT::TaskContext
virtual void clear ()
 
base::ActivityInterfacegetActivity ()
 
template<typename T >
T * getActivity ()
 
virtual const std::string & getName () const
 
bool setActivity (base::ActivityInterface *new_act)
 
 TaskContext (const std::string &name, TaskState initial_state=Stopped)
 
virtual ~TaskContext ()
 
virtual void disconnect ()
 
Service::shared_ptr provides ()
 
Service::shared_ptr provides (const std::string &service_name)
 
ServiceRequester::shared_ptr requires ()
 
ServiceRequester::shared_ptr requires (const std::string &service_name)
 
template<class ServiceType >
boost::shared_ptr< ServiceType > getProvider (const std::string &name)
 
bool loadService (const std::string &service_name)
 
template<class Signature >
Operation< Signature > & addOperation (Operation< Signature > &op)
 
template<class Func , class Service >
Operation< typename internal::GetSignature< Func >::Signature > & addOperation (const std::string name, Func func, Service *serv, ExecutionThread et=ClientThread)
 
template<class Signature >
Operation< Signature > & addOperation (const std::string name, Signature *func, ExecutionThread et=ClientThread)
 
OperationInterfacePartgetOperation (std::string name)
 
OperationInterfaceoperations ()
 
template<class T >
bool addAttribute (const std::string &name, T &attr)
 
template<class T >
bool addConstant (const std::string &name, const T &attr)
 
bool addAttribute (base::AttributeBase &a)
 
base::AttributeBasegetAttribute (const std::string &name) const
 
ConfigurationInterfaceattributes ()
 
template<class T >
Property< T > & addProperty (const std::string &name, T &attr)
 
bool addProperty (base::PropertyBase &pb)
 
base::PropertyBasegetProperty (const std::string &name) const
 
PropertyBagproperties ()
 
base::PortInterfaceaddPort (const std::string &name, base::PortInterface &port)
 
base::PortInterfaceaddPort (base::PortInterface &port)
 
base::InputPortInterfaceaddEventPort (const std::string &name, base::InputPortInterface &port, SlotFunction callback=SlotFunction())
 
base::InputPortInterfaceaddEventPort (base::InputPortInterface &port, SlotFunction callback=SlotFunction())
 
base::PortInterfacegetPort (const std::string &name) const
 
DataFlowInterfaceports ()
 
const DataFlowInterfaceports () const
 
- Public Member Functions inherited from RTT::base::TaskCore
const ExecutionEngineengine () const
 
ExecutionEngineengine ()
 
unsigned int getCycleCounter () const
 
unsigned int getIOCounter () const
 
virtual TaskState getTargetState () const
 
unsigned int getTimeOutCounter () const
 
unsigned int getTriggerCounter () const
 
 TaskCore (TaskState initial_state=Stopped, const std::string &name=std::string())
 
virtual ~TaskCore ()
 
virtual Seconds getPeriod () const
 
virtual bool setPeriod (Seconds s)
 
virtual unsigned getCpuAffinity () const
 
virtual bool setCpuAffinity (unsigned cpu)
 
virtual bool update ()
 
virtual bool trigger ()
 
virtual void error ()
 

Static Public Member Functions

static TaskContextProxyCreate (std::string name, bool is_ior=false)
 
static TaskContextCreate (::RTT::corba::CTaskContext_ptr task, bool force_remote=false)
 
static TaskContextProxyCreateFromFile (std::string filename)
 
static void DestroyOrb ()
 
static PortableServer::POA_ptr ProxyPOA ()
 
- Static Public Member Functions inherited from RTT::corba::ApplicationServer
static RTT_CORBA_API bool InitOrb (int argc, char *argv[], Seconds orb_timeout=0)
 

Static Public Attributes

static PMap proxies
 
- Static Public Attributes inherited from RTT::corba::ApplicationServer
static CORBA::ORB_var orb
 
static PortableServer::POA_var rootPOA
 

Protected Member Functions

void initFromURIOrTaskname (std::string location, bool is_ior)
 
void synchronize ()
 
void synchronizePorts (Service::shared_ptr parent, CDataFlowInterface_ptr dfact, const CServiceDescription &cdescription)
 
void synchronizeRequesters (ServiceRequester::shared_ptr parent, CServiceRequester_ptr csrq, const CServiceRequesterDescription &cdescription)
 
void synchronizeServices (Service::shared_ptr parent, CService_ptr serv, const CServiceDescription &cdescription)
 
 TaskContextProxy (std::string location, bool is_ior)
 
 TaskContextProxy ()
 
 TaskContextProxy (::RTT::corba::CTaskContext_ptr t)
 
- Protected Member Functions inherited from RTT::TaskContext
virtual void dataOnPortCallback (base::PortInterface *port)
 
virtual bool dataOnPortHook (base::PortInterface *port)
 
void forceActivity (base::ActivityInterface *new_act)
 
- Protected Member Functions inherited from RTT::base::TaskCore
virtual bool breakUpdateHook ()
 
virtual void cleanupHook ()
 
virtual bool configureHook ()
 
virtual void errorHook ()
 
virtual void exception ()
 
virtual void exceptionHook ()
 
virtual void fatal ()
 
virtual bool startHook ()
 
virtual void stopHook ()
 
virtual void updateHook ()
 

Protected Attributes

corba::CTaskContext_var mtask
 
std::list< base::PortInterface * > port_proxies
 
- Protected Attributes inherited from RTT::base::TaskCore
ExecutionEngineee
 
unsigned int mCycleCounter
 
unsigned int mIOCounter
 
std::string mName
 
TaskState mTaskState
 
unsigned int mTimeOutCounter
 
unsigned int mTriggerCounter
 
bool mTriggerOnStart
 

Static Protected Attributes

static PortableServer::POA_var proxy_poa
 

Detailed Description

This class manages the access of remote TaskContext Corba Servers and a Corba Object Request Broker (Orb) which connects to these servers.

Definition at line 82 of file TaskContextProxy.hpp.

Member Typedef Documentation

typedef std::map<TaskContextProxy*, corba::CTaskContext_ptr> RTT::corba::TaskContextProxy::PMap

Definition at line 87 of file TaskContextProxy.hpp.

Constructor & Destructor Documentation

RTT::corba::TaskContextProxy::TaskContextProxy ( std::string  location,
bool  is_ior 
)
protected

Private constructor which creates a new connection to a stringified ior or taskname in NameServer.

Definition at line 94 of file TaskContextProxy.cpp.

RTT::corba::TaskContextProxy::TaskContextProxy ( )
protected

A Private constructor which does nothing

Definition at line 100 of file TaskContextProxy.cpp.

RTT::corba::TaskContextProxy::TaskContextProxy ( ::RTT::corba::CTaskContext_ptr  t)
protected

Private constructor which creates a new connection to a corba object

Definition at line 172 of file TaskContextProxy.cpp.

RTT::corba::TaskContextProxy::~TaskContextProxy ( )

Definition at line 82 of file TaskContextProxy.cpp.

Member Function Documentation

bool RTT::corba::TaskContextProxy::activate ( void  )
virtual

This method starts the ExecutionEngine of this component in case it was not running. Normally, it is always running. There is no way to deactivate it from the public interface.

Returns
true if the ExecutionEngine is running (again) and false if it could not be started.

Reimplemented from RTT::base::TaskCore.

Definition at line 653 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::addPeer ( TaskContext peer,
std::string  alias = "" 
)
virtual

Add a one-way connection from this task to a peer task.

Parameters
peerThe peer to add.
aliasAn optional alias (another name) for the peer. defaults to peer->getName()

Reimplemented from RTT::TaskContext.

Definition at line 766 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::cleanup ( void  )
virtual

This method instructs a stopped component to enter the pre-operational state again. It calls cleanupHook().

Returns
true if the component was in the Stopped state.

Reimplemented from RTT::base::TaskCore.

Definition at line 697 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::configure ( void  )
virtual

This method instructs the component to (re-)read configuration data and try to enter the Stopped state. This can only succeed if the component is not running and configureHook() returns true.

Reimplemented from RTT::base::TaskCore.

Definition at line 685 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::connectPeers ( TaskContext peer)
virtual

Add a two-way connection from this task to a peer task.

Reimplemented from RTT::TaskContext.

Definition at line 821 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::connectPorts ( TaskContext peer)
virtual

Add a data flow connection from this task's ports to a peer's ports.

Reimplemented from RTT::TaskContext.

Definition at line 890 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::connectServices ( TaskContext peer)
virtual

Connects all requires/provides services of this component to these of a peer.

Reimplemented from RTT::TaskContext.

Definition at line 905 of file TaskContextProxy.cpp.

TaskContextProxy * RTT::corba::TaskContextProxy::Create ( std::string  name,
bool  is_ior = false 
)
static

Factory method: create a CORBA Proxy for an existing TaskContextServer.

Parameters
nameThe name of the TaskContextServer to connect to or the Object Reference of the object to connect to
is_iorset to true if name is an IOR. Defaults to false.
Return values
0if the ORB is not initialised
Returns
A new or previously created CORBA proxy for name.

Definition at line 530 of file TaskContextProxy.cpp.

TaskContext * RTT::corba::TaskContextProxy::Create ( ::RTT::corba::CTaskContext_ptr  task,
bool  force_remote = false 
)
static

Factory method: create a CORBA Proxy for an existing TaskContextServer. This method may in fact return the real TaskContext in case the servant of task is in the same process.

Parameters
taskThe Object to create a proxy for.
Return values
0if the ORB is not initialised
Returns
A new or previously created CORBA proxy for task, or the TaskContext itself.

Definition at line 570 of file TaskContextProxy.cpp.

TaskContextProxy * RTT::corba::TaskContextProxy::CreateFromFile ( std::string  filename)
static

Factory method: create a CORBA Proxy for an existing TaskContextServer.

Parameters
filenameA file containing an IOR which refers to the existing TaskContextServer.
Return values
0if the ORB is not initialised
Returns
A new or previously created CORBA proxy for filename.

Definition at line 553 of file TaskContextProxy.cpp.

void RTT::corba::TaskContextProxy::DestroyOrb ( )
static

Invoke this method once to cleanup the orb.

Definition at line 512 of file TaskContextProxy.cpp.

void RTT::corba::TaskContextProxy::disconnectPeers ( const std::string &  name)
virtual

Remove a two-way connection from this task to a peer task.

Reimplemented from RTT::TaskContext.

Definition at line 836 of file TaskContextProxy.cpp.

TaskContext * RTT::corba::TaskContextProxy::getPeer ( const std::string &  peer_name) const
virtual

Get a pointer to a peer of this task.

Returns
null if no such peer.

Reimplemented from RTT::TaskContext.

Definition at line 875 of file TaskContextProxy.cpp.

TaskContext::PeerList RTT::corba::TaskContextProxy::getPeerList ( void  ) const
virtual

Return a standard container which contains all the Peer names of this TaskContext.

Reimplemented from RTT::TaskContext.

Definition at line 848 of file TaskContextProxy.cpp.

TaskContext::TaskState RTT::corba::TaskContextProxy::getTaskState ( void  ) const
virtual

Returns the current state of the TaskCore. For example, before start(), this function returns Stopped. During startHook() it returns Stopped, and after start() it returns Running.

See also
getTargetState()

Reimplemented from RTT::base::TaskCore.

Definition at line 751 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::hasPeer ( const std::string &  peer_name) const
virtual

Return true if it knows a peer by that name.

Reimplemented from RTT::TaskContext.

Definition at line 864 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::inException ( void  ) const
virtual

Inspect if the component is in the Exception state.

Reimplemented from RTT::base::TaskCore.

Definition at line 739 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::inFatalError ( void  ) const
virtual

Inspect if the component is in the FatalError state. There is no possibility to recover from this state. You need to destroy and recreate your component.

Reimplemented from RTT::base::TaskCore.

Definition at line 719 of file TaskContextProxy.cpp.

void RTT::corba::TaskContextProxy::initFromURIOrTaskname ( std::string  location,
bool  is_ior 
)
protected

initializes the class from a stringified ior or taskname in NameServer.

Definition at line 105 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::inRunTimeError ( void  ) const
virtual

Inspect if the component is in the RunTimeError state.

Reimplemented from RTT::base::TaskCore.

Definition at line 729 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::isActive ( void  ) const
virtual

Inspect if the component's ExecutionEngine is processing requests. Normally this is always the case, but user code could stop the ExecutionEngine manually.

Reimplemented from RTT::base::TaskCore.

Definition at line 665 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::isConfigured ( void  ) const
virtual

Inspect if the component is configured, i.e. in the Stopped, Active or Running state.

Reimplemented from RTT::base::TaskCore.

Definition at line 709 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::isRunning ( void  ) const
virtual

Inspect if the component is in the Running or RunTimeError state. As RunTimeError is a substate of Running, this method also returns true when the component is in one of these states. See inRunTimeError() or testing the run-time error state.

Reimplemented from RTT::base::TaskCore.

Definition at line 675 of file TaskContextProxy.cpp.

PortableServer::POA_ptr RTT::corba::TaskContextProxy::ProxyPOA ( )
static

Returns the default POA for all proxies.

Definition at line 943 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::ready ( void  )
virtual

Checks the validity of this TaskContext. When this method returns false, the TaskContext should not be used and various methods may throw exceptions. Use this in case the TaskContext could be a remote object. Will always return true when this TaskContext is local.

Reimplemented from RTT::TaskContext.

Definition at line 920 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::recover ( void  )
virtual

Call this method in a RunTimeError or Exception state to indicate that the run-time error conditions are gone and nominal operation is resumed. Makes transition to Running or PreOperational, depending on the state it was in.

Returns
false if not applicable in the current state.

Reimplemented from RTT::base::TaskCore.

Definition at line 639 of file TaskContextProxy.cpp.

void RTT::corba::TaskContextProxy::removePeer ( const std::string &  name)
virtual

Remove a one-way connection from this task to a peer task.

Reimplemented from RTT::TaskContext.

Definition at line 795 of file TaskContextProxy.cpp.

void RTT::corba::TaskContextProxy::removePeer ( TaskContext peer)
virtual

Remove a one-way connection from this task to a peer task.

Reimplemented from RTT::TaskContext.

Definition at line 808 of file TaskContextProxy.cpp.

corba::CTaskContext_ptr RTT::corba::TaskContextProxy::server ( ) const

Get the Corba Object of the CTaskContext. You need to duplicate this object reference in case you wish to keep a reference to it. This object universally identifies the remote TaskContextServer and can be used to tell other (remote) objects where to find it.

Definition at line 937 of file TaskContextProxy.cpp.

void RTT::corba::TaskContextProxy::setName ( const std::string &  n)
virtual

Definition at line 761 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::start ( void  )
virtual

This method starts the execution of the updateHook() with each trigger or period. This function calls the user function startHook(), which must return true in order to allow this component to run.

Return values
false
  • if startHook() returned false
  • if the component was not Stopped
trueif the Running state was entered.

Reimplemented from RTT::TaskContext.

Definition at line 615 of file TaskContextProxy.cpp.

bool RTT::corba::TaskContextProxy::stop ( void  )
virtual

This method stops the execution of updateHook() of this component. You can override this method to do something else or in addition. This function calls stopHook() as well.

Returns
false if the component was not Running or not Active.

Reimplemented from RTT::TaskContext.

Definition at line 627 of file TaskContextProxy.cpp.

void RTT::corba::TaskContextProxy::synchronize ( )
protected

Definition at line 195 of file TaskContextProxy.cpp.

void RTT::corba::TaskContextProxy::synchronizePorts ( Service::shared_ptr  parent,
CDataFlowInterface_ptr  dfact,
const CServiceDescription &  cdescription 
)
protected

Definition at line 332 of file TaskContextProxy.cpp.

void RTT::corba::TaskContextProxy::synchronizeRequesters ( ServiceRequester::shared_ptr  parent,
CServiceRequester_ptr  csrq,
const CServiceRequesterDescription &  cdescription 
)
protected

Definition at line 213 of file TaskContextProxy.cpp.

void RTT::corba::TaskContextProxy::synchronizeServices ( Service::shared_ptr  parent,
CService_ptr  serv,
const CServiceDescription &  cdescription 
)
protected

Definition at line 232 of file TaskContextProxy.cpp.

Member Data Documentation

corba::CTaskContext_var RTT::corba::TaskContextProxy::mtask
mutableprotected

Definition at line 123 of file TaskContextProxy.hpp.

std::list<base::PortInterface*> RTT::corba::TaskContextProxy::port_proxies
protected

CDataFlowInterface does not delete ports automatically, because they can then be defined as members of the TaskContext classes.

We must therefore delete in the proxy destructor the ones we are adding through synchronization

Definition at line 114 of file TaskContextProxy.hpp.

std::map< TaskContextProxy *, corba::CTaskContext_ptr > RTT::corba::TaskContextProxy::proxies
static

Definition at line 88 of file TaskContextProxy.hpp.

PortableServer::POA_var RTT::corba::TaskContextProxy::proxy_poa
staticprotected

For now one POA handles all proxies.

Definition at line 128 of file TaskContextProxy.hpp.


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


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:46