hpp-corbaserver: include/hpp/corbaserver/object-map.hh Source File

hpp-corbaserver 9.0.2 Corba server for Humanoid Path Planner applications

Loading...
Searching...
No Matches
object-map.hh
Go to the documentation of this file.
1// Copyright (c) 2018, Joseph Mirabel
2// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
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#ifndef HPP_CORBASERVER_OBJECT_MAP_HH
30#define HPP_CORBASERVER_OBJECT_MAP_HH
31
32#include <coal/BVH/BVH_model.h>
33#include <coal/shape/geometric_shapes.h>
34
35#include <hpp/common-idl.hh>
36#include <hpp/corbaserver/fwd.hh>
37#include <pinocchio/fwd.hpp>
38
39 namespace hpp {
40 namespace corbaServer {
41 class ObjectMap {
42 public:
43 void createBox(const std::string boxName, value_type x, value_type y,
44 value_type z);
45 void createSphere(const std::string name, value_type radius);
46 void createCylinder(const std::string name, value_type radius,
47 value_type length);
48
49 void createPolyhedron(const std::string polyhedronName);
50 std::size_t addPoint(const std::string polyhedronName, value_type x,
51 value_type y, value_type z);
52 std::size_t addTriangle(const std::string polyhedronName, std::size_t pt1,
53 std::size_t pt2, std::size_t pt3);
54
55 CollisionGeometryPtr_t geometry(const std::string name) /*const*/;
56
57 protected:
58 struct PolyhedronData {
59 std::vector<coal::Vec3f> pts;
60 std::vector<coal::Triangle> tris;
61 };
62 typedef std::map<std::string, PolyhedronData> PolyhedronMap_t;
63 typedef std::map<std::string, CollisionGeometryPtr_t> ShapeMap_t;
64
65 enum GeomType { Shape = 1, Polyhedron = 2, BothGeomType = 3 };
66
67 enum ThrowType { NoThrow, ThrowIfItExists, ThrowIfItDoesNotExist };
68
69 template <GeomType geomType, ThrowType throwType>
70 bool nameExists(const std::string& name) const;
71
73 ShapeMap_t shapeMap_;
75 PolyhedronMap_t polyhedronMap_;
76};
77} // end of namespace corbaServer.
78} // end of namespace hpp.
79
80#endif // HPP_CORBASERVER_OBJECT_MAP_HH
hpp::corbaServer::ObjectMap
Definition object-map.hh:41
hpp::corbaServer::ObjectMap::PolyhedronMap_t
std::map< std::string, PolyhedronData > PolyhedronMap_t
Definition object-map.hh:62
hpp::corbaServer::ObjectMap::geometry
CollisionGeometryPtr_t geometry(const std::string name)
hpp::corbaServer::ObjectMap::ShapeMap_t
std::map< std::string, CollisionGeometryPtr_t > ShapeMap_t
Definition object-map.hh:63
hpp::corbaServer::ObjectMap::createPolyhedron
void createPolyhedron(const std::string polyhedronName)
hpp::corbaServer::ObjectMap::nameExists
bool nameExists(const std::string &name) const
hpp::corbaServer::ObjectMap::createCylinder
void createCylinder(const std::string name, value_type radius, value_type length)
hpp::corbaServer::ObjectMap::addTriangle
std::size_t addTriangle(const std::string polyhedronName, std::size_t pt1, std::size_t pt2, std::size_t pt3)
hpp::corbaServer::ObjectMap::createBox
void createBox(const std::string boxName, value_type x, value_type y, value_type z)
hpp::corbaServer::ObjectMap::GeomType
GeomType
Definition object-map.hh:65
hpp::corbaServer::ObjectMap::Polyhedron
@ Polyhedron
Definition object-map.hh:65
hpp::corbaServer::ObjectMap::BothGeomType
@ BothGeomType
Definition object-map.hh:65
hpp::corbaServer::ObjectMap::Shape
@ Shape
Definition object-map.hh:65
hpp::corbaServer::ObjectMap::polyhedronMap_
PolyhedronMap_t polyhedronMap_
Map of polyhedra in construction.
Definition object-map.hh:75
hpp::corbaServer::ObjectMap::shapeMap_
ShapeMap_t shapeMap_
Map of basic shapes.
Definition object-map.hh:73
hpp::corbaServer::ObjectMap::ThrowType
ThrowType
Definition object-map.hh:67
hpp::corbaServer::ObjectMap::ThrowIfItDoesNotExist
@ ThrowIfItDoesNotExist
Definition object-map.hh:67
hpp::corbaServer::ObjectMap::ThrowIfItExists
@ ThrowIfItExists
Definition object-map.hh:67
hpp::corbaServer::ObjectMap::NoThrow
@ NoThrow
Definition object-map.hh:67
hpp::corbaServer::ObjectMap::createSphere
void createSphere(const std::string name, value_type radius)
hpp::corbaServer::ObjectMap::addPoint
std::size_t addPoint(const std::string polyhedronName, value_type x, value_type y, value_type z)
common-idl.hh
fwd.hh
hpp::corbaServer::makeServantDownCast
ReturnType::Object_var makeServantDownCast(Server *server, const typename ServantBaseType::Storage &t)
Definition servant-base.hh:407
hpp::corbaServer::value_type
pinocchio::value_type value_type
Definition fwd.hh:104
hpp
Implement CORBA interface `‘Obstacle’'.
hpp::corbaServer::ObjectMap::PolyhedronData
Definition object-map.hh:58
hpp::corbaServer::ObjectMap::PolyhedronData::tris
std::vector< coal::Triangle > tris
Definition object-map.hh:60
hpp::corbaServer::ObjectMap::PolyhedronData::pts
std::vector< coal::Vec3f > pts
Definition object-map.hh:59