hpp-corbaserver  4.11.0
Corba server for Humanoid Path Planner applications
paths.hh
Go to the documentation of this file.
1 // Copyright (C) 2019 by Joseph Mirabel, LAAS-CNRS.
2 //
3 // This file is part of the hpp-corbaserver.
4 //
5 // This software is provided "as is" without warranty of any kind,
6 // either expressed or implied, including but not limited to the
7 // implied warranties of fitness for a particular purpose.
8 //
9 // See the COPYING file for more information.
10 
11 #ifndef HPP_CORE_IDL_PATHS_HH
12 # define HPP_CORE_IDL_PATHS_HH
13 # include <vector>
14 # include <stdlib.h>
15 
16 # include "hpp/core/path.hh"
17 # include "hpp/core/path-vector.hh"
18 
19 # include <hpp/corbaserver/fwd.hh>
21 # include "hpp/core_idl/paths-idl.hh"
22 
24 
25 namespace hpp
26 {
27  namespace corbaServer
28  {
29  namespace core_idl
30  {
31  hpp::core_idl::Path_ptr makePathServant (Server* server, const PathPtr_t& path);
32 
33  template <typename _Base, typename _Storage>
34  class PathServant : public ServantBase<core::Path, _Storage>, public virtual _Base
35  {
36  SERVANT_BASE_TYPEDEFS(hpp::core_idl::Path, core::Path);
37 
38  public:
39  PathServant (Server* server, const Storage& s)
40  : _ServantBase (server, s) {}
41 
42  virtual ~PathServant () {}
43 
45  {
46  return get()->outputSize();
47  }
48 
50  {
51  return get()->outputDerivativeSize();
52  }
53 
55  {
56  return get()->length ();
57  }
58 
59  char* str ()
60  {
61  std::ostringstream oss; oss << *get();
62  std::string res = oss.str();
63  return CORBA::string_dup(res.c_str());
64  }
65 
66  floatSeq* value (value_type t, CORBA::Boolean& success)
67  {
68  return vectorToFloatSeq (get()->operator() (t, success));
69  }
70 
71  floatSeq* derivative (value_type t, CORBA::Short order)
72  {
74  get()->derivative (res, t, order);
75  return vectorToFloatSeq (res);
76  }
77 
79  {
80  return makePathServant (server_, get()->extract(core::interval_t(tmin, tmax)));
81  }
82 
84  };
85 
87 
88  template <typename _Base, typename _Storage>
89  class PathVectorServant : public PathServant<_Base, _Storage>
90  {
91  SERVANT_BASE_TYPEDEFS(hpp::core_idl::PathVector, core::Path);
92 
93  public:
95 
96  PathVectorServant (Server* server, const Storage& s) : Parent (server, s) {}
97 
99  {
100  return getT()->numberPaths();
101  }
102 
104  {
105  return makePathServant (server_, getT()->pathAtRank(rank));
106  }
107 
109  {
110  getT()->appendPath(reference_to_servant_base<core::Path>(server_, path)->get());
111  }
112 
114  {
115  getT()->concatenate (reference_to_servant<PathVectorServant>(server_, path)->getT());
116  }
117  };
118 
120 
121 
122  template <typename _Base, typename _Storage>
124  {
125  PathPtr_t p = get();
126  PathVectorPtr_t pv =
127  core::PathVector::create (p->outputSize(), p->outputDerivativeSize());
128  pv->appendPath (p);
129 
130  return makeServant<hpp::core_idl::PathVector_ptr>
131  (server_, new PathVector (server_, pv));
132  }
133 
134  } // end of namespace core.
135  } // end of namespace corbaServer.
136 } // end of namespace hpp.
137 
138 #endif // HPP_CORE_IDL_PATHS_HH
hpp::corbaServer::core_idl::PathVectorServant::concatenate
void concatenate(hpp::core_idl::PathVector_ptr path)
Definition: paths.hh:113
floatSeq
Definition: common-idl.hh:575
hpp::corbaServer::core_idl::Path
PathServant< POA_hpp::core_idl::Path, core::PathPtr_t > Path
Definition: paths.hh:86
hpp::core_idl::PathVector
Definition: paths.idl:67
servant-base.hh
conversions.hh
hpp::core_idl::Path
Definition: paths.idl:22
hpp::corbaServer::ServantBase< core::Path, _Storage >::getT
StorageElementShPtr_t getT() const
Definition: servant-base.hh:121
hpp::corbaServer::core_idl::PathServant::length
value_type length()
Definition: paths.hh:54
hpp::corbaServer::core_idl::makePathServant
hpp::core_idl::Path_ptr makePathServant(Server *server, const PathPtr_t &path)
hpp::corbaServer::Server
Implementation of Hpp module Corba server.
Definition: server.hh:54
hpp::corbaServer::core_idl::PathServant::asVector
hpp::core_idl::PathVector_ptr asVector()
Definition: paths.hh:123
hpp::corbaServer::core_idl::PathVectorServant
Definition: paths.hh:89
hpp::corbaServer::core_idl::PathServant::str
char * str()
Definition: paths.hh:59
size_t
_CORBA_MODULE hpp _CORBA_MODULE_BEG _CORBA_MODULE core_idl _CORBA_MODULE_BEG typedef ::CORBA::ULongLong size_t
Definition: paths-idl.hh:75
hpp::corbaServer::value_type
pinocchio::value_type value_type
Definition: fwd.hh:86
hpp::corbaServer::core_idl::PathVectorServant::Parent
PathServant< Base, Storage > Parent
Definition: paths.hh:94
hpp::corbaServer::AbstractServantBase< core::Path >::server_
Server * server_
Definition: servant-base.hh:97
hpp::corbaServer::core_idl::PathVector
PathVectorServant< POA_hpp::core_idl::PathVector, core::PathVectorPtr_t > PathVector
Definition: paths.hh:119
hpp::corbaServer::core_idl::PathVectorServant::appendPath
void appendPath(hpp::core_idl::Path_ptr path)
Definition: paths.hh:108
hpp::corbaServer::core_idl::PathServant
Definition: paths.hh:34
hpp::corbaServer::core_idl::PathServant::outputSize
size_type outputSize()
Definition: paths.hh:44
paths-idl.hh
fwd.hh
hpp::corbaServer::vector_t
pinocchio::vector_t vector_t
Definition: fwd.hh:89
hpp
Implement CORBA interface `‘Obstacle’'.
Definition: basic-server.hh:27
hpp::corbaServer::core_idl::PathServant::PathServant
PathServant(Server *server, const Storage &s)
Definition: paths.hh:39
hpp::corbaServer::core_idl::PathVectorServant::numberPaths
std::size_t numberPaths()
Definition: paths.hh:98
hpp::corbaServer::core_idl::PathServant::value
floatSeq * value(value_type t, CORBA::Boolean &success)
Definition: paths.hh:66
hpp::corbaServer::core_idl::PathVectorServant::pathAtRank
hpp::core_idl::Path_ptr pathAtRank(std::size_t rank)
Definition: paths.hh:103
hpp::corbaServer::core_idl::PathVectorServant::PathVectorServant
PathVectorServant(Server *server, const Storage &s)
Definition: paths.hh:96
hpp::corbaServer::core_idl::PathServant::~PathServant
virtual ~PathServant()
Definition: paths.hh:42
hpp::corbaServer::PathVectorPtr_t
core::PathVectorPtr_t PathVectorPtr_t
Definition: fwd.hh:77
PathVector_ptr
_objref_PathVector * PathVector_ptr
Definition: paths-idl.hh:82
hpp::corbaServer::core_idl::PathServant::derivative
floatSeq * derivative(value_type t, CORBA::Short order)
Definition: paths.hh:71
hpp::corbaServer::size_type
pinocchio::size_type size_type
Definition: fwd.hh:92
hpp::corbaServer::ServantBase< core::Path, _Storage >::get
virtual TShPtr_t get() const
Definition: servant-base.hh:111
hpp::corbaServer::ServantBase< core::Path, _Storage >::Storage
_Storage Storage
Definition: servant-base.hh:103
hpp::corbaServer::vectorToFloatSeq
floatSeq * vectorToFloatSeq(core::vectorIn_t input)
hpp::corbaServer::core_idl::PathServant::outputDerivativeSize
size_type outputDerivativeSize()
Definition: paths.hh:49
hpp::corbaServer::core_idl::PathServant::extract
hpp::core_idl::Path_ptr extract(value_type tmin, value_type tmax)
Definition: paths.hh:78
hpp::corbaServer::PathPtr_t
core::PathPtr_t PathPtr_t
Definition: fwd.hh:74
hpp::corbaServer::ServantBase
Definition: servant-base.hh:100
Path_ptr
_objref_Path * Path_ptr
Definition: path_planners-idl.hh:83