| Line |
Branch |
Exec |
Source |
| 1 |
|
|
// Copyright (C) 2015 by Joseph Mirabel |
| 2 |
|
|
// |
| 3 |
|
|
|
| 4 |
|
|
// Redistribution and use in source and binary forms, with or without |
| 5 |
|
|
// modification, are permitted provided that the following conditions are |
| 6 |
|
|
// met: |
| 7 |
|
|
// |
| 8 |
|
|
// 1. Redistributions of source code must retain the above copyright |
| 9 |
|
|
// notice, this list of conditions and the following disclaimer. |
| 10 |
|
|
// |
| 11 |
|
|
// 2. Redistributions in binary form must reproduce the above copyright |
| 12 |
|
|
// notice, this list of conditions and the following disclaimer in the |
| 13 |
|
|
// documentation and/or other materials provided with the distribution. |
| 14 |
|
|
// |
| 15 |
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 16 |
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 17 |
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 18 |
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 19 |
|
|
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 20 |
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 21 |
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 22 |
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 23 |
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 |
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 25 |
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
| 26 |
|
|
// DAMAGE. |
| 27 |
|
|
// |
| 28 |
|
|
// This software is provided "as is" without warranty of any kind, |
| 29 |
|
|
// either expressed or implied, including but not limited to the |
| 30 |
|
|
// implied warranties of fitness for a particular purpose. |
| 31 |
|
|
// |
| 32 |
|
|
// See the COPYING file for more information. |
| 33 |
|
|
|
| 34 |
|
|
#ifndef HPP_CORBASERVER_CLIENT_HH |
| 35 |
|
|
#define HPP_CORBASERVER_CLIENT_HH |
| 36 |
|
|
|
| 37 |
|
|
#include <omniORB4/CORBA.h> |
| 38 |
|
|
|
| 39 |
|
|
#include <hpp/corbaserver/config.hh> |
| 40 |
|
|
#include <hpp/corbaserver/obstacle-idl.hh> |
| 41 |
|
|
#include <hpp/corbaserver/problem-idl.hh> |
| 42 |
|
|
#include <hpp/corbaserver/robot-idl.hh> |
| 43 |
|
|
#include <hpp/corbaserver/tools-idl.hh> |
| 44 |
|
|
#include <string> |
| 45 |
|
|
|
| 46 |
|
|
namespace hpp { |
| 47 |
|
|
namespace corbaServer { |
| 48 |
|
|
class HPP_CORBASERVER_DLLAPI ClientBase { |
| 49 |
|
|
public: |
| 50 |
|
|
ClientBase(int argc, char* argv[]); |
| 51 |
|
|
|
| 52 |
|
|
virtual ~ClientBase(); |
| 53 |
|
|
|
| 54 |
|
|
/// Connect to hpp object. |
| 55 |
|
|
/// \param iiop address to the server (either the NameService or hpp |
| 56 |
|
|
/// directly). |
| 57 |
|
|
void connect(const std::string& iiop = "corbaloc:iiop:"); |
| 58 |
|
|
|
| 59 |
|
✗ |
hpp::Tools_var& tools() { return tools_; } |
| 60 |
|
|
|
| 61 |
|
|
private: |
| 62 |
|
|
bool createFromDirectLink(const std::string& iiop); |
| 63 |
|
|
bool createFromNameService(const std::string& iiop); |
| 64 |
|
|
|
| 65 |
|
|
hpp::Tools_var tools_; |
| 66 |
|
|
CORBA::ORB_var orb_; |
| 67 |
|
|
}; |
| 68 |
|
|
|
| 69 |
|
|
class HPP_CORBASERVER_DLLAPI Client : public ClientBase { |
| 70 |
|
|
public: |
| 71 |
|
|
Client(int argc, char* argv[]); |
| 72 |
|
|
|
| 73 |
|
|
~Client(); |
| 74 |
|
|
|
| 75 |
|
|
/// \copydoc ClientBase::connect |
| 76 |
|
|
/// \param context the hpp context name (passed to the server) |
| 77 |
|
|
void connect(const char* iiop = "corbaloc:iiop:", |
| 78 |
|
|
const char* context = "corbaserver"); |
| 79 |
|
|
|
| 80 |
|
|
hpp::corbaserver::Robot_var& robot() { return robot_; } |
| 81 |
|
|
|
| 82 |
|
|
hpp::corbaserver::Problem_var& problem() { return problem_; } |
| 83 |
|
|
|
| 84 |
|
|
hpp::corbaserver::Obstacle_var& obstacle() { return obstacle_; } |
| 85 |
|
|
|
| 86 |
|
|
private: |
| 87 |
|
|
void createClientsFromTools(); |
| 88 |
|
|
|
| 89 |
|
|
hpp::corbaserver::Robot_var robot_; |
| 90 |
|
|
hpp::corbaserver::Problem_var problem_; |
| 91 |
|
|
hpp::corbaserver::Obstacle_var obstacle_; |
| 92 |
|
|
|
| 93 |
|
|
CORBA::ORB_var orb_; |
| 94 |
|
|
}; |
| 95 |
|
|
|
| 96 |
|
|
} // end of namespace corbaServer. |
| 97 |
|
|
} // end of namespace hpp. |
| 98 |
|
|
#endif |
| 99 |
|
|
|