hpp-corbaserver  4.9.0
Corba server for Humanoid Path Planner applications
problem.hh
Go to the documentation of this file.
1 
2 // Copyright (C) 2019 by Joseph Mirabel, LAAS-CNRS.
3 //
4 // This file is part of the hpp-corbaserver.
5 //
6 // This software is provided "as is" without warranty of any kind,
7 // either expressed or implied, including but not limited to the
8 // implied warranties of fitness for a particular purpose.
9 //
10 // See the COPYING file for more information.
11 
12 #ifndef HPP_CORE_IDL_PROBLEM_HH
13 # define HPP_CORE_IDL_PROBLEM_HH
14 # include <vector>
15 # include <stdlib.h>
16 
17 # include <hpp/core/problem.hh>
18 
19 # include <hpp/corbaserver/fwd.hh>
21 # include <hpp/core_idl/_problem-idl.hh>
22 
27 
28 namespace hpp
29 {
30  namespace corbaServer
31  {
32  namespace core_idl
33  {
34  template <typename _Base, typename _Storage>
35  class ProblemServant : public ServantBase<core::Problem, _Storage >, public virtual _Base
36  {
37  SERVANT_BASE_TYPEDEFS(hpp::core_idl::Problem, core::Problem);
38  public:
39  ProblemServant (Server* server, const Storage& p)
40  : _ServantBase (server, p) {}
41 
42  virtual ~ProblemServant () {}
43 
44  hpp::core_idl::Distance_ptr getDistance ()
45  {
47  DevicePtr_t robot = get()->robot();
48 
49  hpp::core_idl::Distance_var d = makeServantDownCast<Distance>
50  (server_, Distance::Storage (robot, distance));
51  return d._retn();
52  }
53 
54  void setDistance (hpp::core_idl::Distance_ptr distance)
55  {
57  try {
58  d = reference_to_servant_base<core::Distance>(server_, distance)->get();
59  } catch (const Error& e) {
60  // TODO in this case, we should define a distance from the CORBA type.
61  // This would allow to implement a distance class in Python.
62  throw;
63  }
64 
65  get()->distance (d);
66  }
67 
68  hpp::core_idl::SteeringMethod_ptr getSteeringMethod ()
69  {
70  core::SteeringMethodPtr_t steeringMethod = get()->steeringMethod();
71  DevicePtr_t robot = get()->robot();
72 
73  hpp::core_idl::SteeringMethod_var d = makeServantDownCast<SteeringMethod>
74  (server_, SteeringMethod::Storage (robot, steeringMethod));
75  return d._retn();
76  }
77 
78  void setSteeringMethod (hpp::core_idl::SteeringMethod_ptr steeringMethod)
79  {
81  try {
82  d = reference_to_servant_base<core::SteeringMethod>(server_, steeringMethod)->get();
83  } catch (const Error& e) {
84  // TODO in this case, we should define a steeringMethod from the CORBA type.
85  // This would allow to implement a steeringMethod class in Python.
86  throw;
87  }
88 
89  get()->steeringMethod (d);
90  }
91 
92  hpp::core_idl::PathValidation_ptr getPathValidation ()
93  {
94  core::PathValidationPtr_t pathValidation = get()->pathValidation();
95 
96  hpp::core_idl::PathValidation_var d = makeServantDownCast<PathValidation>
97  (server_, PathValidation::Storage (pathValidation));
98  return d._retn();
99  }
100 
101  void setPathValidation (hpp::core_idl::PathValidation_ptr pathValidation)
102  {
104  try {
105  d = reference_to_servant_base<core::PathValidation>(server_, pathValidation)->get();
106  } catch (const Error& e) {
107  // TODO in this case, we should define a pathValidation from the CORBA type.
108  // This would allow to implement a pathValidation class in Python.
109  throw;
110  }
111 
112  get()->pathValidation (d);
113  }
114  };
115 
117  } // end of namespace core.
118  } // end of namespace corbaServer.
119 } // end of namespace hpp.
120 
121 #endif // HPP_CORE_IDL_PROBLEM_HH
Definition: servant-base.hh:100
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:51
hpp::core_idl::SteeringMethod_ptr getSteeringMethod()
Definition: problem.hh:68
Implement CORBA interface ``Obstacle&#39;&#39;.
void setPathValidation(hpp::core_idl::PathValidation_ptr pathValidation)
Definition: problem.hh:101
Server * server_
Definition: servant-base.hh:97
Corba exception travelling through the Corba channel.
Definition: common.idl:24
void setDistance(hpp::core_idl::Distance_ptr distance)
Definition: problem.hh:54
boost::shared_ptr< PathValidation > PathValidationPtr_t
ProblemServant< POA_hpp::core_idl::Problem, core::ProblemPtr_t > Problem
Definition: problem.hh:116
FCL_REAL d
void setSteeringMethod(hpp::core_idl::SteeringMethod_ptr steeringMethod)
Definition: problem.hh:78
Definition: _problem.idl:28
Implementation of Hpp module Corba server.
Definition: server.hh:54
hpp::core_idl::PathValidation_ptr getPathValidation()
Definition: problem.hh:92
boost::shared_ptr< SteeringMethod > SteeringMethodPtr_t
virtual ~ProblemServant()
Definition: problem.hh:42
boost::shared_ptr< Distance > DistancePtr_t
_Storage Storage
Definition: servant-base.hh:103
hpp::core_idl::Distance_ptr getDistance()
Definition: problem.hh:44
ProblemServant(Server *server, const Storage &p)
Definition: problem.hh:39
FCL_REAL distance(const KDOP< N > &other, Vec3f *P=NULL, Vec3f *Q=NULL) const