Commit 8109e6b1 authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

Update to changes in hpp-corbaserver.

parent b6743b0e
......@@ -18,7 +18,7 @@
#ifndef HPP_RBPRM_CORBA_BUILDER_IDL
# define HPP_RBPRM_CORBA_BUILDER_IDL
# include <hpp/corbaserver/common.idl>
# include <hpp/common.idl>
module hpp
{
......
......@@ -20,10 +20,6 @@ SET(IDL_SOURCES
rbprmbuilder
)
SET(HPP_CORBASERVER_IDL_SOURCES
common
)
OMNIIDL_INCLUDE_DIRECTORIES(
${HPP_CORBASERVER_DATAROOTDIR}/idl ${CMAKE_SOURCE_DIR}/idl
)
......@@ -33,46 +29,33 @@ FINDPYTHON(2.7 EXACT REQUIRED)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/src)
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/hpp/corbaserver/rbprm)
FOREACH(IDL ${IDL_SOURCES})
GENERATE_IDL_CPP (${IDL}
${CMAKE_SOURCE_DIR}/idl/hpp/corbaserver/rbprm
)
GENERATE_IDL_PYTHON (${IDL}
${CMAKE_SOURCE_DIR}/idl/hpp/corbaserver/rbprm
)
ENDFOREACH()
FOREACH(IDL ${IDL_SOURCES})
GENERATE_IDL_CPP (hpp/corbaserver/rbprm/${IDL}
${CMAKE_SOURCE_DIR}/idl/hpp/corbaserver/rbprm)
GENERATE_IDL_PYTHON (hpp/corbaserver/rbprm/${IDL}
${CMAKE_SOURCE_DIR}/idl/hpp/corbaserver/rbprm)
${CMAKE_SOURCE_DIR}/idl/hpp/corbaserver/rbprm
HEADER_SUFFIX -idl.hh)
GENERATE_IDL_PYTHON (${IDL}
${CMAKE_SOURCE_DIR}/idl/hpp/corbaserver/rbprm
ENABLE_DOCSTRING
STUBS hpp_stubs.rbprm
ARGUMENTS
-Wbmodules=hpp_idl
-Wbextern=common:hpp_stubs
)
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/hpp/corbaserver/rbprm/${IDL}.hh
FILES ${CMAKE_CURRENT_BINARY_DIR}/hpp/corbaserver/rbprm/${IDL}-idl.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hpp/corbaserver/rbprm)
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/hpp/corbaserver/rbprm/${IDL}_idl.py
DESTINATION ${PYTHON_SITELIB}/hpp/corbaserver/rbprm)
ENDFOREACH()
FOREACH(IDL ${HPP_CORBASERVER_IDL_SOURCES})
GENERATE_IDL_CPP (${IDL}
${HPP_CORBASERVER_DATAROOTDIR}/idl/hpp/corbaserver
)
GENERATE_IDL_PYTHON (${IDL}
${HPP_CORBASERVER_DATAROOTDIR}/idl/hpp/corbaserver
)
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/${IDL}_idl.py
DESTINATION ${PYTHON_SITELIB}/hpp/corbaserver/rbprm)
ENDFOREACH()
INSTALL(
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/hpp_idl/hpp/corbaserver/rbprm
DESTINATION ${PYTHON_SITELIB}/hpp_idl/hpp/corbaserver)
INSTALL(
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/hpp_stubs/rbprm
DESTINATION ${PYTHON_SITELIB}/hpp_stubs)
ADD_LIBRARY(${LIBRARY_NAME} SHARED
common.hh
commonSK.cc
${CMAKE_CURRENT_BINARY_DIR}/hpp/corbaserver/rbprm/rbprmbuilder.hh
${CMAKE_CURRENT_BINARY_DIR}/hpp/corbaserver/rbprm/rbprmbuilderSK.cc
${ALL_IDL_CPP_STUBS}
rbprmbuilder.impl.cc
rbprmbuilder.impl.hh
server.cc
......
import omniORB
omniORB.updateModule("hpp.corbaserver.rbprm")
import rbprmbuilder_idl
from client import Client
......@@ -17,51 +17,29 @@
# hpp-manipulation-corba. If not, see
# <http://www.gnu.org/licenses/>.
from omniORB import CORBA
import CosNaming
from hpp.corbaserver.client import Client as _Parent
from hpp_idl.hpp.corbaserver.rbprm import RbprmBuilder
from hpp.corbaserver.rbprm import RbprmBuilder
class CorbaError(Exception):
"""
Raised when a CORBA error occurs.
"""
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class Client:
class Client (_Parent):
"""
Connect and create clients for hpp-rbprm library.
"""
def __init__(self):
defaultClients = {
'rbprmbuilder' : RbprmBuilder,
}
def __init__(self, url = None, context = "corbaserver"):
"""
Initialize CORBA and create default clients.
:param url: URL in the IOR, corbaloc, corbalocs, and corbanames formats.
For a remote corba server, use
url = "corbaloc:iiop:<host>:<port>/NameService"
"""
import sys
self.orb = CORBA.ORB_init (sys.argv, CORBA.ORB_ID)
obj = self.orb.resolve_initial_references("NameService")
self.rootContext = obj._narrow(CosNaming.NamingContext)
if self.rootContext is None:
raise CorbaError ('failed to narrow the root context')
# client of Rbprm interface
name = [CosNaming.NameComponent ("hpp", "corbaserver"),
CosNaming.NameComponent ("rbprm", "rbprmbuilder")]
try:
obj = self.rootContext.resolve (name)
except CosNaming.NamingContext.NotFound, ex:
raise CorbaError ('failed to find rbprm service.')
try:
client = obj._narrow (RbprmBuilder)
except KeyError:
raise CorbaError ('invalid service name rbprm')
if client is None:
# This happens when stubs from client and server are not synchronized.
raise CorbaError (
'failed to narrow client for service rbprm')
self.rbprm = client
self._initOrb (url)
self._makeClients ("rbprm", self.defaultClients, context)
# self.rbprmbuilder is created by self._makeClients
# The old code stored the object as self.rbprm
# Make it backward compatible.
self.rbprm = self.rbprmbuilder
......@@ -17,7 +17,7 @@
//#include <hpp/fcl/math/transform.h>
#include <hpp/util/debug.hh>
#include <hpp/corbaserver/rbprm/rbprmbuilder.hh>
#include <hpp/corbaserver/rbprm/rbprmbuilder-idl.hh>
#include "rbprmbuilder.impl.hh"
#include "hpp/rbprm/rbprm-device.hh"
#include "hpp/rbprm/rbprm-validation.hh"
......
......@@ -20,7 +20,7 @@
# include <hpp/core/problem-solver.hh>
# include <hpp/core/path.hh>
# include "rbprmbuilder.hh"
# include "hpp/corbaserver/rbprm/rbprmbuilder-idl.hh"
# include <hpp/rbprm/rbprm-device.hh>
# include <hpp/rbprm/rbprm-fullbody.hh>
# include <hpp/rbprm/rbprm-shooter.hh>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment