hpp-core
9.0.2
Implement basic classes for canonical path planning for kinematic chains.
Toggle main menu visibility
Loading...
Searching...
No Matches
connected-component.hh
Go to the documentation of this file.
1
//
2
// Copyright (c) 2014 CNRS
3
// Authors: Florent Lamiraux
4
//
5
6
// Redistribution and use in source and binary forms, with or without
7
// modification, are permitted provided that the following conditions are
8
// met:
9
//
10
// 1. Redistributions of source code must retain the above copyright
11
// notice, this list of conditions and the following disclaimer.
12
//
13
// 2. Redistributions in binary form must reproduce the above copyright
14
// notice, this list of conditions and the following disclaimer in the
15
// documentation and/or other materials provided with the distribution.
16
//
17
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
28
// DAMAGE.
29
30
#ifndef HPP_CORE_CONNECTED_COMPONENT_HH
31
#define HPP_CORE_CONNECTED_COMPONENT_HH
32
33
#include <
hpp/core/config.hh
>
34
#include <
hpp/core/fwd.hh
>
35
#include <
hpp/core/node.hh
>
36
#include <
hpp/util/serialization-fwd.hh
>
37
38
namespace
hpp
{
39
namespace
core
{
43
class
HPP_CORE_DLLAPI
ConnectedComponent
{
44
public
:
45
typedef
ConnectedComponent
*
RawPtr_t
;
46
typedef
std::set<RawPtr_t>
RawPtrs_t
;
47
48
// variable for ranking connected components
49
static
unsigned
int
globalFinishTime_
;
50
static
ConnectedComponentPtr_t
create
() {
51
ConnectedComponent
* ptr =
new
ConnectedComponent
();
52
ConnectedComponentPtr_t
shPtr(ptr);
53
ptr->
init
(shPtr);
54
return
shPtr;
55
}
56
60
virtual
void
merge
(
const
ConnectedComponentPtr_t
& other);
61
62
virtual
~ConnectedComponent
() {}
63
66
virtual
void
addNode
(
const
NodePtr_t
& node) { nodes_.push_back(node); }
68
const
NodeVector_t
&
nodes
()
const
{
return
nodes_; }
69
72
75
bool
canReach
(
const
ConnectedComponentPtr_t
& cc);
76
81
bool
canReach
(
const
ConnectedComponentPtr_t
& cc,
RawPtrs_t
& cc2Tocc1);
82
83
// Get connected components reachable from this
84
const
RawPtrs_t
&
reachableTo
()
const
{
return
reachableTo_; }
85
86
// Get connected components that can reach this
87
const
RawPtrs_t
&
reachableFrom
()
const
{
return
reachableFrom_; }
89
90
ConnectedComponentPtr_t
self
() {
return
weak_.lock(); }
91
92
bool
operator<
(
const
ConnectedComponent
& rhs)
const
{
93
return
this->current_id < rhs.current_id;
94
}
95
96
protected
:
98
ConnectedComponent
()
99
: nodes_(), explored_(false), weak_(), current_id(static_id++) {
100
nodes_.reserve(1000);
101
}
102
void
init
(
const
ConnectedComponentPtr_t
& shPtr) { weak_ = shPtr; }
103
104
private
:
105
static
void
clean(RawPtrs_t& set);
106
107
NodeVector_t
nodes_;
108
// List of CCs from which this connected component can be reached
109
RawPtrs_t reachableFrom_;
110
// List of CCs that can be reached from this connected component
111
RawPtrs_t reachableTo_;
112
// status variable to indicate whether or not CC has been visited
113
mutable
bool
explored_;
114
ConnectedComponentWkPtr_t weak_;
115
friend
class
Roadmap
;
116
117
static
int
static_id;
118
const
int
current_id;
119
120
HPP_SERIALIZABLE();
121
};
// class ConnectedComponent
122
}
// namespace core
123
}
// namespace hpp
124
#endif
// HPP_CORE_CONNECTED_COMPONENT_HH
hpp::core::ConnectedComponent::reachableTo
const RawPtrs_t & reachableTo() const
Definition
connected-component.hh:84
hpp::core::ConnectedComponent::Roadmap
friend class Roadmap
Definition
connected-component.hh:115
hpp::core::ConnectedComponent::canReach
bool canReach(const ConnectedComponentPtr_t &cc)
hpp::core::ConnectedComponent::init
void init(const ConnectedComponentPtr_t &shPtr)
Definition
connected-component.hh:102
hpp::core::ConnectedComponent::~ConnectedComponent
virtual ~ConnectedComponent()
Definition
connected-component.hh:62
hpp::core::ConnectedComponent::nodes
const NodeVector_t & nodes() const
Access to the nodes.
Definition
connected-component.hh:68
hpp::core::ConnectedComponent::self
ConnectedComponentPtr_t self()
Definition
connected-component.hh:90
hpp::core::ConnectedComponent::ConnectedComponent
ConnectedComponent()
Constructor.
Definition
connected-component.hh:98
hpp::core::ConnectedComponent::globalFinishTime_
static unsigned int globalFinishTime_
Definition
connected-component.hh:49
hpp::core::ConnectedComponent::addNode
virtual void addNode(const NodePtr_t &node)
Definition
connected-component.hh:66
hpp::core::ConnectedComponent::reachableFrom
const RawPtrs_t & reachableFrom() const
Definition
connected-component.hh:87
hpp::core::ConnectedComponent::operator<
bool operator<(const ConnectedComponent &rhs) const
Definition
connected-component.hh:92
hpp::core::ConnectedComponent::RawPtr_t
ConnectedComponent * RawPtr_t
Definition
connected-component.hh:45
hpp::core::ConnectedComponent::create
static ConnectedComponentPtr_t create()
Definition
connected-component.hh:50
hpp::core::ConnectedComponent::merge
virtual void merge(const ConnectedComponentPtr_t &other)
hpp::core::ConnectedComponent::RawPtrs_t
std::set< RawPtr_t > RawPtrs_t
Definition
connected-component.hh:46
hpp::core::ConnectedComponent::canReach
bool canReach(const ConnectedComponentPtr_t &cc, RawPtrs_t &cc2Tocc1)
config.hh
HPP_CORE_DLLAPI
#define HPP_CORE_DLLAPI
Definition
config.hh:88
fwd.hh
hpp
hpp::core
Definition
bi-rrt-planner.hh:36
hpp::core::NodeVector_t
std::vector< NodePtr_t > NodeVector_t
Definition
fwd.hh:182
hpp::core::NodePtr_t
Node * NodePtr_t
Definition
fwd.hh:180
hpp::core::ConnectedComponentPtr_t
shared_ptr< ConnectedComponent > ConnectedComponentPtr_t
Definition
fwd.hh:117
node.hh
serialization-fwd.hh
include
hpp
core
connected-component.hh
Generated by
1.17.0