hpp-corbaserver: include/hpp/corbaserver/core_idl/problem.hh Source File

hpp-corbaserver 9.0.2 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
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // 1. Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27 // DAMAGE.
28 //
29 // This software is provided "as is" without warranty of any kind,
30 // either expressed or implied, including but not limited to the
31 // implied warranties of fitness for a particular purpose.
32 //
33 // See the COPYING file for more information.
34
35 #ifndef HPP_CORE_IDL_PROBLEM_HH
36 #define HPP_CORE_IDL_PROBLEM_HH
37 #include <stdlib.h>
38
39 #include <hpp/corbaserver/conversions.hh>
40 #include <hpp/corbaserver/core_idl/distances.hh>
41 #include <hpp/corbaserver/core_idl/path-validations.hh>
42 #include <hpp/corbaserver/core_idl/steering-methods.hh>
43 #include <hpp/corbaserver/fwd.hh>
44 #include <hpp/corbaserver/servant-base.hh>
45 #include <hpp/core/problem.hh>
46 #include <hpp/core_idl/_problem-idl.hh>
47 #include <vector>
48
49 namespace hpp {
50 namespace corbaServer {
51 namespace core_idl {
52 template <typename _Base, typename _Storage>
53 class ProblemServant : public ServantBase<core::Problem, _Storage>,
54 public virtual _Base {
55 SERVANT_BASE_TYPEDEFS(hpp::core_idl::Problem, core::Problem);
56
57 public:
58 ProblemServant(Server* server, const Storage& p) : _ServantBase(server, p) {}
59
60 virtual ~ProblemServant() {}
61
62 hpp::core_idl::Distance_ptr getDistance() {
63 core::DistancePtr_t distance = get()->distance();
64 DevicePtr_t robot = get()->robot();
65
66 hpp::core_idl::Distance_var d = makeServantDownCast<Distance>(
67 server_, Distance::Storage(robot, distance));
68 return d._retn();
69 }
70
71 void setDistance(hpp::core_idl::Distance_ptr distance) {
72 core::DistancePtr_t d;
73 try {
74 d = reference_to_servant_base<core::Distance>(server_, distance)->get();
75 } catch (const Error& e) {
76 // TODO in this case, we should define a distance from the CORBA type.
77 // This would allow to implement a distance class in Python.
78 throw;
79 }
80
81 get()->distance(d);
82 }
83
84 hpp::core_idl::SteeringMethod_ptr getSteeringMethod() {
85 core::SteeringMethodPtr_t steeringMethod = get()->steeringMethod();
86 DevicePtr_t robot = get()->robot();
87
88 hpp::core_idl::SteeringMethod_var d = makeServantDownCast<SteeringMethod>(
89 server_, SteeringMethod::Storage(robot, steeringMethod));
90 return d._retn();
91 }
92
93 void setSteeringMethod(hpp::core_idl::SteeringMethod_ptr steeringMethod) {
94 core::SteeringMethodPtr_t d;
95 try {
96 d = reference_to_servant_base<core::SteeringMethod>(server_,
97 steeringMethod)
98 ->get();
99 } catch (const Error& e) {
100 // TODO in this case, we should define a steeringMethod from the CORBA
101 // type. This would allow to implement a steeringMethod class in Python.
102 throw;
103 }
104
105 get()->steeringMethod(d);
106 }
107
108 hpp::core_idl::PathValidation_ptr getPathValidation() {
109 core::PathValidationPtr_t pathValidation = get()->pathValidation();
110
111 hpp::core_idl::PathValidation_var d = makeServantDownCast<PathValidation>(
112 server_, PathValidation::Storage(pathValidation));
113 return d._retn();
114 }
115
116 void setPathValidation(hpp::core_idl::PathValidation_ptr pathValidation) {
117 core::PathValidationPtr_t d;
118 try {
119 d = reference_to_servant_base<core::PathValidation>(server_,
120 pathValidation)
121 ->get();
122 } catch (const Error& e) {
123 // TODO in this case, we should define a pathValidation from the CORBA
124 // type. This would allow to implement a pathValidation class in Python.
125 throw;
126 }
127
128 get()->pathValidation(d);
129 }
130 };
131
132 typedef ProblemServant<POA_hpp::core_idl::Problem, core::ProblemPtr_t> Problem;
133 } // namespace core_idl
134 } // end of namespace corbaServer.
135 } // end of namespace hpp.
136
137 #endif // HPP_CORE_IDL_PROBLEM_HH
_problem-idl.hh
Distance_ptr
_objref_Distance * Distance_ptr
Definition: _problem-idl.hh:165
SteeringMethod_var
_CORBA_ObjRef_Var< _objref_SteeringMethod, SteeringMethod_Helper > SteeringMethod_var
Definition: _problem-idl.hh:208
PathValidation_ptr
_objref_PathValidation * PathValidation_ptr
Definition: _problem-idl.hh:269
PathValidation_var
_CORBA_ObjRef_Var< _objref_PathValidation, PathValidation_Helper > PathValidation_var
Definition: _problem-idl.hh:286
SteeringMethod_ptr
_objref_SteeringMethod * SteeringMethod_ptr
Definition: _problem-idl.hh:191
Distance_var
_CORBA_ObjRef_Var< _objref_Distance, Distance_Helper > Distance_var
Definition: _problem-idl.hh:182
hpp::corbaServer::AbstractServantBase::server_
Server * server_
Definition: servant-base.hh:118
hpp::corbaServer::ServantBase
Definition: servant-base.hh:122
hpp::corbaServer::ServantBase< core::Problem, _Storage >::Storage
_Storage Storage
Definition: servant-base.hh:124
hpp::corbaServer::ServantBase< core::Problem, _Storage >::get
virtual TShPtr_t get() const
Definition: servant-base.hh:132
hpp::corbaServer::Server
Implementation of Hpp module Corba server.
Definition: server.hh:78
hpp::corbaServer::core_idl::ProblemServant
Definition: problem.hh:54
hpp::corbaServer::core_idl::ProblemServant::setSteeringMethod
void setSteeringMethod(hpp::core_idl::SteeringMethod_ptr steeringMethod)
Definition: problem.hh:93
hpp::corbaServer::core_idl::ProblemServant::getPathValidation
hpp::core_idl::PathValidation_ptr getPathValidation()
Definition: problem.hh:108
hpp::corbaServer::core_idl::ProblemServant::ProblemServant
ProblemServant(Server *server, const Storage &p)
Definition: problem.hh:58
hpp::corbaServer::core_idl::ProblemServant::setPathValidation
void setPathValidation(hpp::core_idl::PathValidation_ptr pathValidation)
Definition: problem.hh:116
hpp::corbaServer::core_idl::ProblemServant::setDistance
void setDistance(hpp::core_idl::Distance_ptr distance)
Definition: problem.hh:71
hpp::corbaServer::core_idl::ProblemServant::~ProblemServant
virtual ~ProblemServant()
Definition: problem.hh:60
hpp::corbaServer::core_idl::ProblemServant::getSteeringMethod
hpp::core_idl::SteeringMethod_ptr getSteeringMethod()
Definition: problem.hh:84
hpp::corbaServer::core_idl::ProblemServant::getDistance
hpp::core_idl::Distance_ptr getDistance()
Definition: problem.hh:62
hpp::core::Problem
conversions.hh
hpp::Error
Corba exception travelling through the Corba channel.
Definition: common.idl:27
fwd.hh
distances.hh
hpp::core_idl::Problem
Definition: _problem.idl:33
d
const Derived & d
hpp::corbaServer::core_idl::Problem
ProblemServant< POA_hpp::core_idl::Problem, core::ProblemPtr_t > Problem
Definition: problem.hh:132
hpp::corbaServer::DevicePtr_t
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:72
hpp::core::PathValidationPtr_t
shared_ptr< PathValidation > PathValidationPtr_t
hpp::core::DistancePtr_t
shared_ptr< Distance > DistancePtr_t
hpp::core::SteeringMethodPtr_t
shared_ptr< SteeringMethod > SteeringMethodPtr_t
distance
value_type distance(const DevicePtr_t &robot, ConfigurationIn_t q1, ConfigurationIn_t q2)
hpp
Implement CORBA interface `‘Obstacle’'.
path-validations.hh
problem.hh
servant-base.hh
steering-methods.hh