hpp-corbaserver  6.0.0
Corba server for Humanoid Path Planner applications
path-validations.hh
Go to the documentation of this file.
1 // Copyright (C) 2019 by Joseph Mirabel, LAAS-CNRS.
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_CORE_IDL_PATH_VALIATIONS_HH
35 #define HPP_CORE_IDL_PATH_VALIATIONS_HH
36 
37 #include <stdlib.h>
38 
41 #include <hpp/corbaserver/fwd.hh>
42 #include <vector>
43 
45 #include "hpp/core/path-validation-report.hh"
46 #include "hpp/core/path-validation.hh"
48 
49 namespace hpp {
50 namespace corbaServer {
51 namespace core_idl {
52 template <typename _Base, typename _Storage>
54  : public ServantBase<core::PathValidation, _Storage>,
55  public virtual _Base {
57 
58  public:
60  : _ServantBase(server, s) {}
61 
63 
64  CORBA::Boolean validate(hpp::core_idl::Path_ptr path, CORBA::Boolean reverse,
65  hpp::core_idl::Path_out validPart,
68  reference_to_servant_base<core::Path>(server_, path)->get());
69  core::PathPtr_t vp;
71 
72  bool res = get()->validate(p, reverse, vp, pvr);
73 
74  if (pvr) {
75  std::ostringstream oss;
76  oss << *pvr;
77  std::string res = oss.str();
78  report = CORBA::string_dup(res.c_str());
79  } else {
80  report = CORBA::string_dup("");
81  }
82 
83  validPart =
84  makeServant<hpp::core_idl::Path_ptr>(server_, new Path(server_, vp));
85  return res;
86  }
87 };
88 
89 typedef PathValidationServant<POA_hpp::core_idl::PathValidation,
90  core::PathValidationPtr_t>
92 
93 } // namespace core_idl
94 } // end of namespace corbaServer.
95 } // end of namespace hpp.
96 
97 #endif // HPP_CORE_IDL_PATH_VALIATIONS_HH
Server * server_
Definition: servant-base.hh:118
Definition: servant-base.hh:122
virtual TShPtr_t get() const
Definition: servant-base.hh:132
Implementation of Hpp module Corba server.
Definition: server.hh:78
Definition: path-validations.hh:55
virtual ~PathValidationServant()
Definition: path-validations.hh:62
PathValidationServant(Server *server, const Storage &s)
Definition: path-validations.hh:59
CORBA::Boolean validate(hpp::core_idl::Path_ptr path, CORBA::Boolean reverse, hpp::core_idl::Path_out validPart, hpp::core_idl::PathValidationReport_out report)
Definition: path-validations.hh:64
Definition: path_validations.idl:66
PathValidationServant< POA_hpp::core_idl::PathValidation, core::PathValidationPtr_t > PathValidation
Definition: path-validations.hh:91
PathServant< POA_hpp::core_idl::Path, core::PathPtr_t > Path
Definition: paths.hh:93
core::PathValidationReportPtr_t PathValidationReportPtr_t
Definition: fwd.hh:97
core::PathPtr_t PathPtr_t
Definition: fwd.hh:96
Implement CORBA interface `‘Obstacle’'.
Definition: client.hh:46
_objref_Path * Path_ptr
Definition: path_planners-idl.hh:83
_CORBA_ObjRef_OUT_arg< _objref_Path, Path_Helper > Path_out
Definition: path_planners-idl.hh:101
::CORBA::String_out PathValidationReport_out
Definition: path_validations-idl.hh:85