RoadmapNode.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef __ROADMAP_NODE_H__
00003 #define __ROADMAP_NODE_H__
00004 
00005 #include <vector>
00006 #include <boost/shared_ptr.hpp>
00007 #include "Configuration.h"
00008 #include "exportdef.h"
00009 
00010 namespace PathEngine {
00011   class RoadmapNode;
00012   typedef boost::shared_ptr<RoadmapNode> RoadmapNodePtr;
00013 
00017   class HRPPLANNER_API RoadmapNode {
00018   public:
00023     RoadmapNode(const Configuration& pos) : pos_(pos) {}
00024 
00028     ~RoadmapNode() {}
00029 
00034     void addParent(RoadmapNodePtr node) { parents_.push_back(node); }
00035 
00040     void addChild(RoadmapNodePtr node) { children_.push_back(node); }
00041 
00047     bool removeParent(RoadmapNodePtr node);
00048 
00054     bool removeChild(RoadmapNodePtr node);
00055 
00060     Configuration& position() { return pos_; }
00061 
00067     RoadmapNodePtr parent(unsigned int index);
00068 
00074     RoadmapNodePtr child(unsigned int index);
00075 
00080     unsigned int nParents() const { return parents_.size(); }
00081 
00086     unsigned int nChildren() const { return children_.size(); }
00087 
00092     void visited(bool flag) { visited_ = flag; }
00093 
00098     bool visited() const { return visited_; } 
00099   private:
00103     std::vector<RoadmapNodePtr> parents_;
00104 
00108     std::vector<RoadmapNodePtr> children_;
00109 
00113     Configuration pos_;
00114 
00118     bool visited_;
00119 
00120     friend std::ostream& operator<< (std::ostream& out, const RoadmapNode& r) {  return out << r.pos_ << " - (" << r.children_.size() << ")";}
00121   };
00122 };
00123 
00124 #endif // __ROADMAP_NODE_H__


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Apr 11 2019 03:30:19