hpp-core
9.0.2
Implement basic classes for canonical path planning for kinematic chains.
Toggle main menu visibility
Loading...
Searching...
No Matches
roadmap.hh
Go to the documentation of this file.
1
// Copyright (c) 2020 CNRS
2
// Authors: Joseph Mirabel
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_CORE_PARSER_ROADMAP_HH
30
#define HPP_CORE_PARSER_ROADMAP_HH
31
32
#include <fstream>
33
#include <
hpp/core/roadmap.hh
>
34
#include <
hpp/pinocchio/serialization.hh
>
35
36
namespace
hpp
{
37
namespace
core
{
38
namespace
parser
{
39
namespace
internal
{
40
41
template
<
typename
Parent,
typename
Child>
42
struct
InsertChildClass
: std::pair<std::string, Child*> {
43
using
std::pair<std::string, Child>::pair;
44
};
45
46
template
<
class
Archive,
class
A>
47
inline
void
insert
(Archive& ar,
const
std::pair<std::string, A*>& a) {
48
ar.insert(a.first, a.second);
49
}
50
51
template
<
class
Archive,
class
Parent,
class
Child>
52
inline
void
insert
(Archive& ar,
const
InsertChildClass<Parent, Child>
& a) {
53
ar.template insertChildClass<Parent, Child>(a.first, a.second);
54
}
55
56
template
<
class
Archive>
57
inline
void
inserts
(Archive&) {}
58
template
<
class
Archive,
class
A,
class
... B>
59
inline
void
inserts
(Archive& ar, A& a, B&... b) {
60
insert
(ar, a);
61
inserts
(ar, b...);
62
}
63
}
// namespace internal
64
76
template
<
class
A>
77
std::pair<std::string, A*>
make_nvp
(
const
std::string& n, A* a) {
78
return
std::pair<std::string, A*>(n, a);
79
}
80
template
<
class
Parent,
class
Child>
81
internal::InsertChildClass<Parent, Child>
make_nvp_with_parent
(
82
const
std::string& n, Child* a) {
83
return
internal::InsertChildClass<Parent, Child>
(n, a);
84
}
85
86
template
<
class
Archive,
class
... Args>
87
void
serializeRoadmap
(
RoadmapPtr_t
& roadmap,
const
std::string& filename,
88
Args... args) {
89
typename
std::conditional<Archive::is_saving::value, std::ofstream,
90
std::ifstream>::type fs(filename);
91
Archive ar(fs);
92
internal::inserts
(ar, args...);
93
ar.initialize();
94
ar& hpp::serialization::make_nvp(
"roadmap"
, roadmap);
95
}
96
97
}
// namespace parser
98
}
// namespace core
99
}
// namespace hpp
100
#endif
// HPP_CORE_PARSER_ROADMAP_HH
hpp::core::parser::serializeRoadmap
void serializeRoadmap(RoadmapPtr_t &roadmap, const std::string &filename, Args... args)
Definition
roadmap.hh:87
hpp::core::parser::make_nvp_with_parent
internal::InsertChildClass< Parent, Child > make_nvp_with_parent(const std::string &n, Child *a)
Definition
roadmap.hh:81
hpp::core::parser::make_nvp
std::pair< std::string, A * > make_nvp(const std::string &n, A *a)
Definition
roadmap.hh:77
hpp
hpp::core::parser::internal
Definition
roadmap.hh:39
hpp::core::parser::internal::insert
void insert(Archive &ar, const std::pair< std::string, A * > &a)
Definition
roadmap.hh:47
hpp::core::parser::internal::inserts
void inserts(Archive &)
Definition
roadmap.hh:57
hpp::core::parser
Definition
roadmap.hh:38
hpp::core
Definition
bi-rrt-planner.hh:36
hpp::core::RoadmapPtr_t
shared_ptr< Roadmap > RoadmapPtr_t
Definition
fwd.hh:199
roadmap.hh
serialization.hh
hpp::core::parser::internal::InsertChildClass
Definition
roadmap.hh:42
include
hpp
core
parser
roadmap.hh
Generated by
1.17.0