hpp-corbaserver: hpp::corbaServer::Server Class Reference

hpp-corbaserver 9.0.2 Corba server for Humanoid Path Planner applications

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
hpp::corbaServer::Server Class Reference

Implementation of Hpp module Corba server. More...

`#include <hpp/corbaserver/server.hh>`

## Public Types
typedef void * | ServantKey

## Public Member Functions
| Server (core::ProblemSolverPtr_t problemSolver, int argc, const char *argv[], bool multiThread=false)
| Server (core::ProblemSolverPtr_t problemSolver, bool multiThread=false)
| ~Server ()
| Shutdown CORBA server.
PortableServer::POA_var | poa ()
CORBA::ORB_var | orb ()
void | startCorbaServer ()
| Initialize CORBA server to process requests from clients.
const std::string & | mainContextId () const
| Get main context ID.
const bool & | multiThread () const
const bool & | nameService () const
int | processRequest (bool loop)
| If ORB work is pending, process it.
void | requestShutdown (bool wait)
bool | createContext (const std::string &contextName)
std::vector< std::string > | getContexts () const
bool | deleteContext (const std::string &contextName)
CORBA::Object_ptr | getServer (const std::string &contextName, const std::string &pluginName, const std::string &objectName)
bool | loadPlugin (const std::string &contextName, const std::string &libFilename)
ProblemSolverMapPtr_t | problemSolverMap ()
core::ProblemSolverPtr_t | problemSolver ()
PortableServer::Servant | getServant (ServantKey servantKey) const
void | addServantKeyAndServant (ServantKey servantKey, PortableServer::Servant servant)
void | removeServant (PortableServer::Servant servant)
void | clearServantsMap ()
std::vector< std::string > | getAllObjectIds ()
CORBA server initialization
bool | parseArguments (int argc, const char *argv[])
| Configure using command line argument.
void | initialize ()
| Initialize ORB and CORBA servers.

## Detailed Description

Implementation of Hpp module Corba server.

This class initializes the Corba server and starts the following Corba interface implementations.

- hpp::corbaserver::Robot: to build a hpp::model::Device and to insert it in a hpp::core::ProblemSolver object,
- hpp::corbaserver::Obstacle: to build obstacles and insert them in a hpp::core::ProblemSolver object,
- hpp::corbaserver::Problem: to define a path planning problem and solve it. To use this object, call the constructor
  int argc=1;
  char *argv[1] = {"program"};
  core::ProblemSolverPtr_t problemSolver = new core::ProblemSolver;
  Server server(problemSolver, argc, argv, isMultiThread);
  hpp::corbaServer::Server
  Implementation of Hpp module Corba server.
  Definition server.hh:78
  hpp::corbaServer::Server::problemSolver
  core::ProblemSolverPtr_t problemSolver()
  hpp::core::ProblemSolver
  hpp::corbaServer::makeServantDownCast
  ReturnType::Object_var makeServantDownCast(Server *server, const typename ServantBaseType::Storage &t)
  Definition servant-base.hh:407
  where `isMultiThread` specifies whether the server should process requests using multi-thread policy of not. After starting a name server and configuring your Corba implementation, start the servers.
  server.startCorbaServer();
  Then, enter in the loop that handle the Corba requests
  server.processRequest(true);
  You can then send request to the servers.

## Member Typedef Documentation

## ◆ ServantKey

typedef void* hpp::corbaServer::Server::ServantKey

## Constructor & Destructor Documentation

## ◆ Server() [1/2]

hpp::corbaServer::Server::Server | ( | core::ProblemSolverPtr_t | problemSolver,
|  | int | argc,
|  | const char * | argv[],
|  | bool | multiThread = `false`
| ) |  |

Constructor

Parameters

  problemSolver | the object that will handle Corba requests.
  argc,argv | parameter to feed ORB initialization.
  multiThread | whether the server may process request using multithred policy.

Note
  It is recommended to configure your Corba implementation through environment variables and to set argc to 1 and argv to any string.
  It is highly recommended not to enable multi-thread policy in CORBA request processing if this library is run from an openGL based GUI, since OpenGL does not support multithreading.

## ◆ Server() [2/2]

hpp::corbaServer::Server::Server | ( | core::ProblemSolverPtr_t | problemSolver,
|  | bool | multiThread = `false`
| ) |  |

Constructor

Parameters

  problemSolver | the object that will handle Corba requests.
  multiThread | whether the server may process request using multithred policy.

## ◆ ~Server()

hpp::corbaServer::Server::~Server | ( |  | ) |

Shutdown CORBA server.

## Member Function Documentation

## ◆ addServantKeyAndServant()

void hpp::corbaServer::Server::addServantKeyAndServant | ( | ServantKey | servantKey,
|  | PortableServer::Servant | servant
| ) |  |

## ◆ clearServantsMap()

void hpp::corbaServer::Server::clearServantsMap | ( |  | ) |

## ◆ createContext()

bool hpp::corbaServer::Server::createContext | ( | const std::string & | contextName | ) |

## ◆ deleteContext()

bool hpp::corbaServer::Server::deleteContext | ( | const std::string & | contextName | ) |

## ◆ getAllObjectIds()

std::vector< std::string > hpp::corbaServer::Server::getAllObjectIds | ( |  | ) |

## ◆ getContexts()

std::vector< std::string > hpp::corbaServer::Server::getContexts | ( |  | ) | const

## ◆ getServant()

PortableServer::Servant hpp::corbaServer::Server::getServant | ( | ServantKey | servantKey | ) | const

## ◆ getServer()

CORBA::Object_ptr hpp::corbaServer::Server::getServer | ( | const std::string & | contextName,
|  | const std::string & | pluginName,
|  | const std::string & | objectName
| ) |  |

## ◆ initialize()

void hpp::corbaServer::Server::initialize | ( |  | ) |

Initialize ORB and CORBA servers.

## ◆ loadPlugin()

bool hpp::corbaServer::Server::loadPlugin | ( | const std::string & | contextName,
|  | const std::string & | libFilename
| ) |  |

Load a plugin if not already loaded.

Returns
  true if the plugin is correctly loaded, false otherwise (which includes the case where the plugin was already loaded).

## ◆ mainContextId()

const std::string & hpp::corbaServer::Server::mainContextId | ( |  | ) | const
| inline

Get main context ID.

## ◆ multiThread()

const bool & hpp::corbaServer::Server::multiThread | ( |  | ) | const
| inline

## ◆ nameService()

const bool & hpp::corbaServer::Server::nameService | ( |  | ) | const
| inline

## ◆ orb()

CORBA::ORB_var hpp::corbaServer::Server::orb | ( |  | ) |
| inline

## ◆ parseArguments()

bool hpp::corbaServer::Server::parseArguments | ( | int | argc,
|  | const char * | argv[]
| ) |  |

Configure using command line argument.

## ◆ poa()

PortableServer::POA_var hpp::corbaServer::Server::poa | ( |  | ) |
| inline

## ◆ problemSolver()

core::ProblemSolverPtr_t hpp::corbaServer::Server::problemSolver | ( |  | ) |

## ◆ problemSolverMap()

ProblemSolverMapPtr_t hpp::corbaServer::Server::problemSolverMap | ( |  | ) |

## ◆ processRequest()

int hpp::corbaServer::Server::processRequest | ( | bool | loop | ) |

If ORB work is pending, process it.

Parameters

  loop | if true, the function never returns, if false, the function processes pending requests and returns.

## ◆ removeServant()

void hpp::corbaServer::Server::removeServant | ( | PortableServer::Servant | servant | ) |

## ◆ requestShutdown()

void hpp::corbaServer::Server::requestShutdown | ( | bool | wait | ) |

Request a shutdown

Parameters

  wait | if true, the method waits for the server to be shut down.

Warning
  From a servant method, set wait to false. Otherwise the application will be deadlocked.

## ◆ startCorbaServer()

void hpp::corbaServer::Server::startCorbaServer | ( |  | ) |

Initialize CORBA server to process requests from clients.

Returns
  0 if success, -1 if failure.

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

- include/hpp/corbaserver/server.hh