hpp-corbaserver 6.0.0
Corba server for Humanoid Path Planner applications
Loading...
Searching...
No Matches
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
45#include <hpp/core/problem.hh>
47#include <vector>
48
49namespace hpp {
50namespace corbaServer {
51namespace core_idl {
52template <typename _Base, typename _Storage>
53class ProblemServant : public ServantBase<core::Problem, _Storage>,
54 public virtual _Base {
56
57 public:
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>(
68 return d._retn();
69 }
70
71 void setDistance(hpp::core_idl::Distance_ptr distance) {
72 core::DistancePtr_t d;
73 try {
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 {
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>(
113 return d._retn();
114 }
115
116 void setPathValidation(hpp::core_idl::PathValidation_ptr pathValidation) {
117 core::PathValidationPtr_t d;
118 try {
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
133} // namespace core_idl
134} // end of namespace corbaServer.
135} // end of namespace hpp.
136
137#endif // HPP_CORE_IDL_PROBLEM_HH
Server * server_
Definition servant-base.hh:118
Definition servant-base.hh:122
_Storage Storage
Definition servant-base.hh:124
virtual TShPtr_t get() const
Definition servant-base.hh:132
Implementation of Hpp module Corba server.
Definition server.hh:78
void setSteeringMethod(hpp::core_idl::SteeringMethod_ptr steeringMethod)
Definition problem.hh:93
hpp::core_idl::PathValidation_ptr getPathValidation()
Definition problem.hh:108
ProblemServant(Server *server, const Storage &p)
Definition problem.hh:58
void setPathValidation(hpp::core_idl::PathValidation_ptr pathValidation)
Definition problem.hh:116
void setDistance(hpp::core_idl::Distance_ptr distance)
Definition problem.hh:71
virtual ~ProblemServant()
Definition problem.hh:60
hpp::core_idl::SteeringMethod_ptr getSteeringMethod()
Definition problem.hh:84
hpp::core_idl::Distance_ptr getDistance()
Definition problem.hh:62
Corba exception travelling through the Corba channel.
Definition common.idl:27
ReturnType::Object_var makeServantDownCast(Server *server, const typename ServantBaseType::Storage &t)
Definition servant-base.hh:407
#define SERVANT_BASE_TYPEDEFS(idlObj, hppObj)
Definition servant-base.hh:73
Definition _problem.idl:33
ProblemServant< POA_hpp::core_idl::Problem, core::ProblemPtr_t > Problem
Definition problem.hh:132
pinocchio::DevicePtr_t DevicePtr_t
Definition fwd.hh:72
Implement CORBA interface `‘Obstacle’'.
Definition client.hh:46