Line |
Branch |
Exec |
Source |
1 |
|
|
// |
2 |
|
|
// Copyright (c) 2015 CNRS |
3 |
|
|
// Authors: Anna Seppala (seppala@laas.fr) |
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_MANIPULATION_CONNECTED_COMPONENT_HH |
31 |
|
|
#define HPP_MANIPULATION_CONNECTED_COMPONENT_HH |
32 |
|
|
|
33 |
|
|
#include <hpp/core/connected-component.hh> |
34 |
|
|
#include <hpp/manipulation/config.hh> |
35 |
|
|
#include <hpp/manipulation/fwd.hh> |
36 |
|
|
#include <hpp/manipulation/graph/fwd.hh> |
37 |
|
|
|
38 |
|
|
namespace hpp { |
39 |
|
|
namespace manipulation { |
40 |
|
|
/// Extension of hpp::core::connected-component. Adds a list of roadmap nodes |
41 |
|
|
/// for every contraint graph state within the connected component. Thus every |
42 |
|
|
/// roadmap node is assigned to a grahp state, which minimises computation time. |
43 |
|
|
class HPP_MANIPULATION_DLLAPI ConnectedComponent |
44 |
|
|
: public core::ConnectedComponent { |
45 |
|
|
public: |
46 |
|
|
/// Map of graph states within the connected component |
47 |
|
|
typedef std::map<graph::StatePtr_t, RoadmapNodes_t> GraphStates_t; |
48 |
|
|
|
49 |
|
✗ |
ConnectedComponent() {} |
50 |
|
|
|
51 |
|
|
/// return a shared pointer to new instance of |
52 |
|
|
/// manipulation::ConnectedComponent |
53 |
|
|
static ConnectedComponentPtr_t create(const RoadmapWkPtr_t& roadmap); |
54 |
|
|
|
55 |
|
|
/// Merge two connected components (extension of |
56 |
|
|
/// core::ConnectedComponent::merge) \param other manipulation connected |
57 |
|
|
/// component to merge into this one. \note other will be empty after calling |
58 |
|
|
/// this method. |
59 |
|
|
void merge(const core::ConnectedComponentPtr_t& otherCC); |
60 |
|
|
|
61 |
|
|
/// Add roadmap node to connected component |
62 |
|
|
/// \param roadmap node to be added |
63 |
|
|
void addNode(const core::NodePtr_t& node); |
64 |
|
|
|
65 |
|
|
const RoadmapNodes_t& getRoadmapNodes( |
66 |
|
|
const graph::StatePtr_t graphState) const; |
67 |
|
|
|
68 |
|
|
protected: |
69 |
|
|
private: |
70 |
|
|
bool check() const; |
71 |
|
|
GraphStates_t graphStateMap_; |
72 |
|
|
// a RoadmapWkPtr_t so that memory can be released ? |
73 |
|
|
RoadmapWkPtr_t roadmap_; |
74 |
|
|
static RoadmapNodes_t empty_; |
75 |
|
|
|
76 |
|
|
HPP_SERIALIZABLE(); |
77 |
|
|
}; // class ConnectedComponent |
78 |
|
|
} // namespace manipulation |
79 |
|
|
} // namespace hpp |
80 |
|
|
#endif // HPP_MANIPULATION_CONNECTED_COMPONENT_HH |
81 |
|
|
|