hpp-corbaserver: include/hpp/corbaserver/core_idl/path-validations.hh Source File

hpp-corbaserver 9.0.2 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
39 #include <hpp/corbaserver/conversions.hh>
40 #include <hpp/corbaserver/core_idl/paths.hh>
41 #include <hpp/corbaserver/fwd.hh>
42 #include <vector>
43
44 #include "hpp/corbaserver/servant-base.hh"
45 #include "hpp/core/path-validation-report.hh"
46 #include "hpp/core/path-validation.hh"
47 #include "hpp/core_idl/path_validations-idl.hh"
48
49 namespace hpp {
50 namespace corbaServer {
51 namespace core_idl {
52 template <typename _Base, typename _Storage>
53 class PathValidationServant
54 : public ServantBase<core::PathValidation, _Storage>,
55 public virtual _Base {
56 SERVANT_BASE_TYPEDEFS(hpp::core_idl::PathValidation, core::PathValidation);
57
58 public:
59 PathValidationServant(Server* server, const Storage& s)
60 : _ServantBase(server, s) {}
61
62 virtual ~PathValidationServant() {}
63
64 CORBA::Boolean validate(hpp::core_idl::Path_ptr path, CORBA::Boolean reverse,
65 hpp::core_idl::Path_out validPart,
66 hpp::core_idl::PathValidationReport_out report) {
67 core::PathPtr_t p(
68 reference_to_servant_base<core::Path>(server_, path)->get());
69 core::PathPtr_t vp;
70 core::PathValidationReportPtr_t pvr;
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>
91 PathValidation;
92
93 } // namespace core_idl
94 } // end of namespace corbaServer.
95 } // end of namespace hpp.
96
97 #endif // HPP_CORE_IDL_PATH_VALIATIONS_HH
hpp::corbaServer::AbstractServantBase::server_
Server * server_
Definition: servant-base.hh:118
hpp::corbaServer::ServantBase
Definition: servant-base.hh:122
hpp::corbaServer::ServantBase< core::PathValidation, _Storage >::Storage
_Storage Storage
Definition: servant-base.hh:124
hpp::corbaServer::ServantBase< core::PathValidation, _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::PathValidationServant
Definition: path-validations.hh:55
hpp::corbaServer::core_idl::PathValidationServant::~PathValidationServant
virtual ~PathValidationServant()
Definition: path-validations.hh:62
hpp::corbaServer::core_idl::PathValidationServant::PathValidationServant
PathValidationServant(Server *server, const Storage &s)
Definition: path-validations.hh:59
hpp::corbaServer::core_idl::PathValidationServant::validate
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
hpp::core::PathValidation
conversions.hh
fwd.hh
paths.hh
hpp::core_idl::PathValidation
Definition: path_validations.idl:66
hpp::corbaServer::core_idl::PathValidation
PathValidationServant< POA_hpp::core_idl::PathValidation, core::PathValidationPtr_t > PathValidation
Definition: path-validations.hh:91
hpp::corbaServer::core_idl::Path
PathServant< POA_hpp::core_idl::Path, core::PathPtr_t > Path
Definition: paths.hh:93
hpp::core::PathValidationPtr_t
shared_ptr< PathValidation > PathValidationPtr_t
hpp::core::PathPtr_t
shared_ptr< Path > PathPtr_t
hpp::core::PathValidationReportPtr_t
shared_ptr< PathValidationReport > PathValidationReportPtr_t
hpp
Implement CORBA interface `‘Obstacle’'.
path-validation-report.hh
path-validation.hh
Path_ptr
_objref_Path * Path_ptr
Definition: path_planners-idl.hh:83
Path_out
_CORBA_ObjRef_OUT_arg< _objref_Path, Path_Helper > Path_out
Definition: path_planners-idl.hh:101
path_validations-idl.hh
PathValidationReport_out
::CORBA::String_out PathValidationReport_out
Definition: path_validations-idl.hh:85
servant-base.hh