Skip to content
Snippets Groups Projects
Commit 47692c63 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Florent Lamiraux
Browse files

Add GraphComponent::components

Conflicts:
	include/hpp/manipulation/graph/graph-component.hh
	src/graph/graph-component.cc
parent b9d620e4
No related branches found
No related tags found
No related merge requests found
......@@ -41,16 +41,19 @@ namespace hpp {
class HPP_MANIPULATION_DLLAPI GraphComponent
{
public:
/// Get the component by its ID. The validity of the GraphComponent
/// is not checked.
static GraphComponentWkPtr_t get(int id);
/// The list of elements
static const std::vector < GraphComponentWkPtr_t >& components ();
/// Get the component name.
const std::string& name() const;
/// Set the component name.
void name(const std::string& name) HPP_MANIPULATION_DEPRECATED;
/// Get the component by its ID. The validity of the GraphComponent
/// is not checked.
static GraphComponentWkPtr_t get(std::size_t id);
/// Return the component id.
std::size_t id () const;
......@@ -116,7 +119,7 @@ namespace hpp {
private:
/// Keep track of the created components in order to retrieve them
/// easily.
static std::vector < GraphComponentWkPtr_t > components;
static std::vector < GraphComponentWkPtr_t > components_;
/// Name of the component.
std::string name_;
......
......@@ -25,7 +25,7 @@
namespace hpp {
namespace manipulation {
namespace graph {
std::vector < GraphComponentWkPtr_t > GraphComponent::components = std::vector < GraphComponentWkPtr_t >();
std::vector < GraphComponentWkPtr_t > GraphComponent::components_ = std::vector < GraphComponentWkPtr_t >();
const std::string& GraphComponent::name() const
{
......@@ -40,13 +40,19 @@ namespace hpp {
GraphComponentWkPtr_t GraphComponent::get(std::size_t id)
{
# ifdef HPP_DEBUG
if (id < 0 || id >= components.size())
if (id < 0 || id >= (int)components_.size())
throw std::out_of_range ("ID out of range.");
# endif // HPP_DEBUG
return components[id];
return components_[id];
}
std::size_t GraphComponent::id () const
const std::vector <GraphComponentWkPtr_t>& GraphComponent::components ()
{
return components_;
}
int GraphComponent::id () const
{
return id_;
}
......@@ -119,8 +125,8 @@ namespace hpp {
void GraphComponent::init (const GraphComponentWkPtr_t& weak)
{
wkPtr_ = weak;
id_ = components.size();
components.push_back (wkPtr_);
id_ = components_.size();
components_.push_back (wkPtr_);
}
std::ostream& operator<< (std::ostream& os,
......
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