hpp-manipulation 6.0.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
97 void solveLevelByLevel(bool solveLevelByLevel) {
98 solveLevelByLevel_ = solveLevelByLevel;
99 }
100
103 bool solveLevelByLevel() const { return solveLevelByLevel_; }
104
105 protected:
107 void init(const GraphComponentWkPtr_t& weak);
108
109 GraphComponent(const std::string& name)
110 : isInit_(false), name_(name), id_(-1), solveLevelByLevel_(false) {}
111
117 GraphWkPtr_t graph_;
118
120
122
124 virtual std::ostream& print(std::ostream& os) const;
125 friend std::ostream& operator<<(std::ostream&, const GraphComponent&);
126
128 virtual void populateTooltip(dot::Tooltip& tp) const;
129
130 virtual void initialize() = 0;
131
132 private:
134 std::string name_;
136 GraphComponentWkPtr_t wkPtr_;
138 std::size_t id_;
140 bool solveLevelByLevel_;
141 friend class Graph;
142};
143
144std::ostream& operator<<(std::ostream& os, const GraphComponent& graphComp);
145
147} // namespace graph
148} // namespace manipulation
149
150} // namespace hpp
151
152#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:103
NumericalConstraints_t numericalCosts_
Stores the numerical costs.
Definition graph-component.hh:115
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.
void solveLevelByLevel(bool solveLevelByLevel)
Definition graph-component.hh:97
GraphComponent(const std::string &name)
Definition graph-component.hh:109
virtual void populateTooltip(dot::Tooltip &tp) const
Populate DrawingAttributes tooltip.
NumericalConstraints_t numericalConstraints_
Stores the numerical constraints.
Definition graph-component.hh:113
const std::string & name() const
Get the component name.
GraphWkPtr_t graph_
A weak pointer to the parent graph.
Definition graph-component.hh:117
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:119
virtual void resetNumericalConstraints()
Reset the numerical constraints stored in the component.
Definition graph.hh:61
#define HPP_MANIPULATION_DLLAPI
Definition config.hh:88
std::ostream & operator<<(std::ostream &os, const GraphComponent &graphComp)
hpp::core::NumericalConstraints_t NumericalConstraints_t
Definition fwd.hh:64
shared_ptr< Graph > GraphPtr_t
Definition fwd.hh:47
constraints::ImplicitPtr_t ImplicitPtr_t
Definition fwd.hh:131
core::ConfigProjectorPtr_t ConfigProjectorPtr_t
Definition fwd.hh:136
Definition main.hh:1