CARMA C++
carma::corba::Server Class Reference

Class for creating, managing and serving requests to CORBA servants. More...

#include <carma/corba/Server.h>

Public Member Functions

template<typename S , typename N >
void addNotificationServantFunctor (S &servant, const ::std::string &channelName, const ::std::string &proxyName)
 Add servant to process IDL defined notifications on given channel. More...
 
template<template< typename > class T, typename S >
void addServant (S &servant, const ::std::string &nameserverName)
 Add servant S, incarnate with IDL generated tie T and publish. More...
 
template<template< typename > class T, typename S >
void addServant (S &servant, typename T< S >::_stub_ptr_type &corbaClientPtr)
 Add servant S, incarnate with generated tie T and set client pointer. More...
 
void run (bool inSeparateThread=false)
 Service remote requests continuously (blocks). More...
 
 Server (int argc, char *argv[], int rrtt=60)
 Initialize CORBA server runtime. More...
 
void stop ()
 Stop serving remote requests permanently. More...
 
bool terminated () const
 Check if server has terminated, including via the IMR. More...
 
void work ()
 Service remote requests if pending (non blocking). More...
 
virtual ~Server ()
 Destructor. More...
 

Friends

Clientcarma::util::ProgramBase::getCorbaClient ()
 

Detailed Description

Class for creating, managing and serving requests to CORBA servants.

This class encapsulates all CORBA server functionality in CARMA. For examples ranging from trivial to complex, see the Test directory.

Author: Andrew Beard

Definition at line 22 of file Server.h.

Constructor & Destructor Documentation

carma::corba::Server::Server ( int  argc,
char *  argv[],
int  rrtt = 60 
)
explicit

Initialize CORBA server runtime.

Parameters
argcCommand line arguments to initialize ORB from.
argvCommand line arguments to initialized ORB from.
rrttRelative round-trip timeout for commands.
See Also
carma::util::Program::getCorbaServer()
virtual carma::corba::Server::~Server ( )
virtual

Destructor.

Member Function Documentation

template<typename S , typename N >
void carma::corba::Server::addNotificationServantFunctor ( S &  servant,
const ::std::string &  channelName,
const ::std::string &  proxyName 
)

Add servant to process IDL defined notifications on given channel.

Servant must define functor void S::operator()( N & notification ). Notifications are IDL defined structures. Multiple consumers on the same channel must have distinct proxy names.

Parameters
servantServant functor to process notifications of type N.
channeNameName of notification channel.
proxyNameNotification channel proxy name.
template<template< typename > class T, typename S >
void carma::corba::Server::addServant ( S &  servant,
const ::std::string &  nameserverName 
)

Add servant S, incarnate with IDL generated tie T and publish.

Parameters
servantInstance defining how to process requests.
nameserverNamePublished name in "context.object" form.
template<template< typename > class T, typename S >
void carma::corba::Server::addServant ( S &  servant,
typename T< S >::_stub_ptr_type &  corbaClientPtr 
)

Add servant S, incarnate with generated tie T and set client pointer.

Parameters
servantInstance defining how to process requests.
corbaClientPtrClient pointer to incarnated CORBA servant.
void carma::corba::Server::run ( bool  inSeparateThread = false)

Service remote requests continuously (blocks).

Parameters
inSeparateThreadRun in newly spawned separate thread.
void carma::corba::Server::stop ( )

Stop serving remote requests permanently.

bool carma::corba::Server::terminated ( ) const

Check if server has terminated, including via the IMR.

Postcondition
Servant instances no longer used and can be safely destructed.
void carma::corba::Server::work ( )

Service remote requests if pending (non blocking).


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