Skip to content
Snippets Groups Projects
Commit abb8d5c7 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Change keywords (virtual, const) in declaration of GraphComponents

parent 5984007b
No related branches found
No related tags found
No related merge requests found
......@@ -45,27 +45,27 @@ namespace hpp {
NodeSelectorPtr_t createNodeSelector();
/// Returns the states of a configuration.
virtual Nodes_t getNode(const Configuration_t config);
Nodes_t getNode(const Configuration_t config) const;
/// Select randomly outgoing edges of the given nodes.
virtual Edges_t chooseEdge(const Nodes_t& node);
Edges_t chooseEdge(const Nodes_t& node) const;
/// Constraint to project onto the Nodes_t.
/// \param the Nodes_t on which to project.
/// \return The initialized projector.
virtual ConstraintSetPtr_t configConstraint (const Nodes_t& nodes);
ConstraintSetPtr_t configConstraint (const Nodes_t& nodes);
/// Constraint to project onto the same leaf as config.
/// \param edges a list of edges defining the foliation.
/// \param config Configuration that will initialize the projector.
/// \return The initialized projector.
virtual ConstraintSetPtr_t configConstraint (const Edges_t& edges, ConfigurationIn_t config);
ConstraintSetPtr_t configConstraint (const Edges_t& edges, ConfigurationIn_t config);
/// Constraint to project a path.
/// \param edges a list of edges defining the foliation.
/// \param config Configuration that will initialize the constraint.
/// \return The initialized constraint.
virtual ConstraintSetPtr_t pathConstraint (const Edges_t& edges, ConfigurationIn_t config);
ConstraintSetPtr_t pathConstraint (const Edges_t& edges, ConfigurationIn_t config);
/// Return the NodeSelector with the given name if any,
/// NULL pointer if not found.
......
......@@ -37,22 +37,22 @@ namespace hpp {
NodePtr_t createNode ();
/// Returns the state of a configuration.
virtual NodePtr_t getNode(const Configuration_t config);
NodePtr_t getNode(const Configuration_t config) const;
/// Select randomly an outgoing edge of the given node.
virtual EdgePtr_t chooseEdge(const NodePtr_t& node);
virtual EdgePtr_t chooseEdge(const NodePtr_t& node) const;
/// Print the object in a stream.
std::ostream& print (std::ostream& os) const;
/// Should never be called.
virtual void addNumericalConstraint (const core::DifferentiableFunctionPtr_t& /* function */)
void addNumericalConstraint (const core::DifferentiableFunctionPtr_t& /* function */)
{
HPP_THROW_EXCEPTION (Bad_function_call, "This component does not have constraints.");
}
/// Should never be called.
virtual void addLockedDofConstraint (const core::LockedDof& /* constraint */)
void addLockedDofConstraint (const core::LockedDof& /* constraint */)
{
HPP_THROW_EXCEPTION (Bad_function_call, "This component does not have constraints.");
}
......
......@@ -52,7 +52,7 @@ namespace hpp {
virtual bool contains (const Configuration_t config);
/// Get the parent NodeSelector.
NodeSelectorWkPtr_t nodeSelector ()
NodeSelectorWkPtr_t nodeSelector () const
{
return selector_;
}
......
......@@ -73,16 +73,16 @@ namespace hpp {
return robot_;
}
Nodes_t Graph::getNode(const Configuration_t config)
Nodes_t Graph::getNode(const Configuration_t config) const
{
Nodes_t nodes;
for (NodeSelectors_t::iterator it = nodeSelectors_.begin();
for (NodeSelectors_t::const_iterator it = nodeSelectors_.begin();
it != nodeSelectors_.end(); it++)
nodes.push_back( (*it)->getNode(config) );
return nodes;
}
Edges_t Graph::chooseEdge(const Nodes_t& nodes)
Edges_t Graph::chooseEdge(const Nodes_t& nodes) const
{
Edges_t edges;
for (Nodes_t::const_iterator it = nodes.begin();
......
......@@ -44,16 +44,16 @@ namespace hpp {
return newNode;
}
NodePtr_t NodeSelector::getNode(const Configuration_t config)
NodePtr_t NodeSelector::getNode(const Configuration_t config) const
{
for (Nodes_t::iterator it = orderedStates_.begin();
for (Nodes_t::const_iterator it = orderedStates_.begin();
orderedStates_.end() != it; it++)
if ((*it)->contains(config))
return *it;
return NodePtr_t ();
}
EdgePtr_t NodeSelector::chooseEdge(const NodePtr_t& node)
EdgePtr_t NodeSelector::chooseEdge(const NodePtr_t& node) const
{
const Edges_t neighbors = node->neighbors();
size_t n = rand() % neighbors.size();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment