Orocos Real-Time Toolkit  2.6.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
RTT::corba::TaskContextServer Class Reference

This class manages the creation of TaskContext Corba Servers and a Corba Object Request Broker (Orb) which executes the servers. More...

#include <rtt/transports/corba/TaskContextServer.hpp>

Inheritance diagram for RTT::corba::TaskContextServer:
RTT::corba::ApplicationServer

List of all members.

Public Member Functions

 ~TaskContextServer ()
 When a TaskContextServer is destroyed, the object reference is removed from the Naming Service and the servant is deleted.
CTaskContext_ptr server () const
 Get the Corba Object of this TaskContext.

Static Public Member Functions

static void ShutdownOrb (bool wait_for_completion=true)
 Invoke this method once to shutdown the Orb which is running the task servers in RunOrb().
static void CleanupServers ()
 Destroys all TaskContextServer objects.
static void RunOrb ()
 Invoke this method to run the orb and accept client requests.
static void ThreadOrb ()
 Invoke this method to run the orb in a separate thread and accept client requests from that thread.
static void DestroyOrb ()
 Invoke this method once to cleanup the orb.
static TaskContextServerCreate (TaskContext *tc, bool use_naming=true, bool require_name_service=false)
 Factory method: create a CORBA server for an existing TaskContext.
static CTaskContext_ptr CreateServer (TaskContext *tc, bool use_naming=true, bool require_name_service=false)
 Factory method: create a CORBA server for an existing TaskContext.
static void CleanupServer (TaskContext *tc)
 Deletes a TaskContext server for a given taskcontext.
static std::string getIOR (TaskContext *tc)
 Get the IOR of a given TaskContext.
static RTT_CORBA_API bool InitOrb (int argc, char *argv[], Seconds orb_timeout=0)
 Invoke this method once to initialise the Orb which will run the task servers.

Static Public Attributes

static CORBA::ORB_var orb
 The orb of this process.
static PortableServer::POA_var rootPOA
 The root POA of this process.

Protected Types

typedef std::map< TaskContext
*, TaskContextServer * > 
ServerMap
typedef std::map< TaskContext
*, std::string > 
IorMap

Protected Member Functions

 TaskContextServer (TaskContext *taskcontext, bool use_naming, bool require_name_service)
 Private constructor which creates a new servant.

Static Protected Member Functions

static void DoShutdownOrb (bool wait_for_completion=true)
 Internal shutdown function, used by both thread and ShutdownOrb.

Protected Attributes

PortableServer::POA_var mpoa
PortableServer::ServantBase_var mtask_i
corba::CTaskContext_var mtask
TaskContextmtaskcontext
bool muse_naming

Static Protected Attributes

static ServerMap servers
static base::ActivityInterfaceorbrunner = 0
static bool is_shutdown = false
static IorMap iors

Friends

class OrbRunner
class TaskContextProxy

Detailed Description

This class manages the creation of TaskContext Corba Servers and a Corba Object Request Broker (Orb) which executes the servers.

The Orb may be run from the main thread or in its own thread.

Definition at line 65 of file TaskContextServer.hpp.


Member Function Documentation

Deletes a TaskContext server for a given taskcontext.

If no such server exists, this method silently does nothing.

Definition at line 257 of file TaskContextServer.cpp.

References RTT::TaskContext::getName(), and RTT::corba::ApplicationServer::orb.

TaskContextServer * RTT::corba::TaskContextServer::Create ( TaskContext tc,
bool  use_naming = true,
bool  require_name_service = false 
) [static]

Factory method: create a CORBA server for an existing TaskContext.

Parameters:
tcThe TaskContext to serve.
use_namingSet to false in order not to use the Corba Naming Service.
require_namingSet to true to require that the Corba Naming Service be found.
Return values:
0if the ORB is not initialised, or if require_name_service==true and the name service was not found
Returns:
A new or previously created CORBA server for tc.

Definition at line 394 of file TaskContextServer.cpp.

References RTT::os::endl(), RTT::TaskContext::getName(), RTT::corba::ApplicationServer::orb, and TaskContextServer().

CTaskContext_ptr RTT::corba::TaskContextServer::CreateServer ( TaskContext tc,
bool  use_naming = true,
bool  require_name_service = false 
) [static]

Factory method: create a CORBA server for an existing TaskContext.

Same as above, but immediately return the Corba object. Also checks if tc is TaskContextProxy and returns the server of the proxy if so.

Parameters:
tcThe TaskContext to serve.
use_namingSet to false in order not to use the Corba Naming Service.
require_namingSet to true to require that the Corba Naming Service be found.
Return values:
0if the ORB is not initialised, or if require_name_service==true and the name service was not found
Returns:
A new or previously created CORBA server for tc. Since this is a factory function, you need to store the object in a _var and don't need to _duplicate it.

Definition at line 415 of file TaskContextServer.cpp.

References RTT::os::endl(), RTT::TaskContext::getName(), RTT::corba::ApplicationServer::orb, server(), and TaskContextServer().

std::string RTT::corba::TaskContextServer::getIOR ( TaskContext tc) [static]

Get the IOR of a given TaskContext.

Parameters:
tcThe TaskContext to find the IOR for
Returns:
IOR of the provided TaskContext or an empty string if the TaskContext is unknown

Definition at line 449 of file TaskContextServer.cpp.

RTT_CORBA_API bool RTT::corba::ApplicationServer::InitOrb ( int  argc,
char *  argv[],
Seconds  orb_timeout = 0 
) [static, inherited]

Invoke this method once to initialise the Orb which will run the task servers.

Parameters:
orb_timeouttimeout value for each remote call, expressed in seconds. The resolution is up to 100 nano seconds. Anything smaller will be interpreted as a zero.

Definition at line 55 of file ApplicationServer.cpp.

References RTT::Logger::log(), RTT::Logger::nl(), RTT::corba::ApplicationServer::orb, and RTT::corba::ApplicationServer::rootPOA.

Invoke this method to run the orb and accept client requests.

Use ShutdownOrb() to break out of this method.

Definition at line 302 of file TaskContextServer.cpp.

References RTT::corba::ApplicationServer::orb.

Referenced by RTT::corba::OrbRunner::loop().

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

Get the Corba Object of this TaskContext.

If you want to store this reference, you must _duplicate it. This object universally identifies the remote TaskContextServer and can be used to tell other (remote) objects where to find it.

Definition at line 443 of file TaskContextServer.cpp.

Referenced by RTT::corba::TaskContextProxy::addPeer(), RTT::corba::TaskContextProxy::connectPeers(), RTT::corba::TaskContextProxy::connectPorts(), RTT::corba::TaskContextProxy::connectServices(), and CreateServer().

void RTT::corba::TaskContextServer::ShutdownOrb ( bool  wait_for_completion = true) [static]

Invoke this method once to shutdown the Orb which is running the task servers in RunOrb().

When this function returns, no CORBA invocations are in progress, unless wait_for_completion is false.

Definition at line 268 of file TaskContextServer.cpp.

References DoShutdownOrb().

Invoke this method to run the orb in a separate thread and accept client requests from that thread.

Use ShutdownOrb() to break out of this method.

Definition at line 347 of file TaskContextServer.cpp.

References RTT::corba::ApplicationServer::orb, and RTT::base::ActivityInterface::start().


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