hpp-manipulation 4.14.0
Classes for manipulation planning.
Loading...
Searching...
No Matches
graph-component.hh
Go to the documentation of this file.
1// Copyright (c) 2014, LAAS-CNRS
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_MANIPULATION_GRAPH_GRAPHCOMPONENT_HH
30#define HPP_MANIPULATION_GRAPH_GRAPHCOMPONENT_HH
31
32#include <ostream>
33#include <string>
34
40
41namespace hpp {
42namespace manipulation {
43typedef constraints::ImplicitPtr_t ImplicitPtr_t;
44namespace graph {
46
49
52 public:
53 virtual ~GraphComponent(){};
54
56 const std::string& name() const;
57
59 const std::size_t& id() const { return id_; }
60
62 virtual void addNumericalConstraint(const ImplicitPtr_t& numConstraint);
63
65 virtual void addNumericalCost(const ImplicitPtr_t& numCost);
66
69
73
76
79
81 void parentGraph(const GraphWkPtr_t& parent);
82
85
87 virtual std::ostream& dotPrint(
88 std::ostream& os,
90
93 virtual void invalidate() { isInit_ = false; }
94
98
101 void solveLevelByLevel(bool solveLevelByLevel) {
102 solveLevelByLevel_ = solveLevelByLevel;
103 }
104
107 bool solveLevelByLevel() const { return solveLevelByLevel_; }
108
109 protected:
111 void init(const GraphComponentWkPtr_t& weak);
112
113 GraphComponent(const std::string& name)
114 : isInit_(false), name_(name), id_(-1), solveLevelByLevel_(false) {}
115
121 GraphWkPtr_t graph_;
122
124
126
128 virtual std::ostream& print(std::ostream& os) const;
129 friend std::ostream& operator<<(std::ostream&, const GraphComponent&);
130
132 virtual void populateTooltip(dot::Tooltip& tp) const;
133
134 virtual void initialize() = 0;
135
136 private:
138 std::string name_;
140 GraphComponentWkPtr_t wkPtr_;
142 std::size_t id_;
144 bool solveLevelByLevel_;
145 friend class Graph;
146};
147
148std::ostream& operator<<(std::ostream& os, const GraphComponent& graphComp);
149
151} // namespace graph
152} // namespace manipulation
153
154} // namespace hpp
155
156#endif // HPP_MANIPULATION_GRAPH_GRAPHCOMPONENT_HH
Define common methods of the graph components.
Definition: graph-component.hh:51
const std::size_t & id() const
Return the component id.
Definition: graph-component.hh:59
bool solveLevelByLevel() const
Definition: graph-component.hh:107
NumericalConstraints_t numericalCosts_
Stores the numerical costs.
Definition: graph-component.hh:119
void init(const GraphComponentWkPtr_t &weak)
Initialize the component.
const NumericalConstraints_t & numericalCosts() const
Get a reference to the NumericalConstraints_t.
GraphPtr_t parentGraph() const
Set the parent graph.
GraphComponent(const std::string &name)
Definition: graph-component.hh:113
virtual void populateTooltip(dot::Tooltip &tp) const
Populate DrawingAttributes tooltip.
NumericalConstraints_t numericalConstraints_
Stores the numerical constraints.
Definition: graph-component.hh:117
const std::string & name() const
Get the component name.
void setDirty() HPP_MANIPULATION_DEPRECATED
GraphWkPtr_t graph_
A weak pointer to the parent graph.
Definition: graph-component.hh:121
virtual ~GraphComponent()
Definition: graph-component.hh:53
bool insertNumericalConstraints(ConfigProjectorPtr_t &proj) const
friend std::ostream & operator<<(std::ostream &, const GraphComponent &)
virtual void invalidate()
Definition: graph-component.hh:93
virtual void addNumericalCost(const ImplicitPtr_t &numCost)
Add a cost function Implicit to the component.
virtual std::ostream & dotPrint(std::ostream &os, dot::DrawingAttributes da=dot::DrawingAttributes()) const
Print the component in DOT language.
void parentGraph(const GraphWkPtr_t &parent)
Set the parent graph.
virtual void addNumericalConstraint(const ImplicitPtr_t &numConstraint)
Add constraint to the component.
virtual std::ostream & print(std::ostream &os) const
Print the object in a stream.
const NumericalConstraints_t & numericalConstraints() const
Get a reference to the NumericalConstraints_t.
bool isInit_
Definition: graph-component.hh:123
virtual void resetNumericalConstraints()
Reset the numerical constraints stored in the component.
Definition: graph.hh:58
#define HPP_MANIPULATION_DLLAPI
Definition: config.hh:64
std::ostream & operator<<(std::ostream &os, const GraphComponent &graphComp)
hpp::core::NumericalConstraints_t NumericalConstraints_t
Definition: fwd.hh:64
StateHistogram NodeHistogram HPP_MANIPULATION_DEPRECATED
Definition: statistics.hh:206
shared_ptr< Graph > GraphPtr_t
Definition: fwd.hh:47
constraints::ImplicitPtr_t ImplicitPtr_t
Definition: fwd.hh:116
core::ConfigProjectorPtr_t ConfigProjectorPtr_t
Definition: fwd.hh:121
Definition: main.hh:1