client.py 1.63 KB
Newer Older
Steve Tonneau's avatar
Steve Tonneau committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python
#
# Copyright (c) 2014 CNRS
# Author: Steve Tonneau
#
# This file is part of hpp-rbprm-corba.
# hpp-rbprm-corba is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
#
# hpp-rbprm-corba is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Lesser Public License for more details.  You should have
# received a copy of the GNU Lesser General Public License along with
# hpp-manipulation-corba.  If not, see
# <http://www.gnu.org/licenses/>.

20
21
from hpp.corbaserver.client import Client as _Parent
from hpp_idl.hpp.corbaserver.rbprm import RbprmBuilder
Steve Tonneau's avatar
Steve Tonneau committed
22

Guilhem Saurel's avatar
Guilhem Saurel committed
23
24
25

class Client(_Parent):
    """
Steve Tonneau's avatar
Steve Tonneau committed
26
27
  Connect and create clients for hpp-rbprm library.
  """
28

Guilhem Saurel's avatar
Guilhem Saurel committed
29
    defaultClients = {
30
        'builder': RbprmBuilder,
Guilhem Saurel's avatar
Guilhem Saurel committed
31
    }
32

Guilhem Saurel's avatar
Guilhem Saurel committed
33
    def __init__(self, url=None, context="corbaserver", port=None):
Guilhem Saurel's avatar
Guilhem Saurel committed
34
        """
Steve Tonneau's avatar
Steve Tonneau committed
35
    Initialize CORBA and create default clients.
36
37
38
    :param url: URL in the IOR, corbaloc, corbalocs, and corbanames formats.
                For a remote corba server, use
                url = "corbaloc:iiop:<host>:<port>/NameService"
Steve Tonneau's avatar
Steve Tonneau committed
39
    """
Guilhem Saurel's avatar
Guilhem Saurel committed
40
        self._initOrb(url, port=port)
Guilhem Saurel's avatar
Guilhem Saurel committed
41
        self._makeClients("rbprm", self.defaultClients, context)
Steve Tonneau's avatar
Steve Tonneau committed
42

43
        # self.builder is created by self._makeClients
Guilhem Saurel's avatar
Guilhem Saurel committed
44
45
        # The old code stored the object as self.rbprm
        # Make it backward compatible.
46
        self.rbprm = self.builder