RoadmapNode.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 #ifndef __ROADMAP_NODE_H__
3 #define __ROADMAP_NODE_H__
4 
5 #include <vector>
6 #include <boost/shared_ptr.hpp>
7 #include "Configuration.h"
8 #include "exportdef.h"
9 
10 namespace PathEngine {
11  class RoadmapNode;
12  typedef boost::shared_ptr<RoadmapNode> RoadmapNodePtr;
13 
18  public:
23  RoadmapNode(const Configuration& pos) : pos_(pos) {}
24 
29 
34  void addParent(RoadmapNodePtr node) { parents_.push_back(node); }
35 
40  void addChild(RoadmapNodePtr node) { children_.push_back(node); }
41 
47  bool removeParent(RoadmapNodePtr node);
48 
54  bool removeChild(RoadmapNodePtr node);
55 
60  Configuration& position() { return pos_; }
61 
67  RoadmapNodePtr parent(unsigned int index);
68 
74  RoadmapNodePtr child(unsigned int index);
75 
80  unsigned int nParents() const { return parents_.size(); }
81 
86  unsigned int nChildren() const { return children_.size(); }
87 
92  void visited(bool flag) { visited_ = flag; }
93 
98  bool visited() const { return visited_; }
99  private:
103  std::vector<RoadmapNodePtr> parents_;
104 
108  std::vector<RoadmapNodePtr> children_;
109 
114 
118  bool visited_;
119 
120  friend std::ostream& operator<< (std::ostream& out, const RoadmapNode& r) { return out << r.pos_ << " - (" << r.children_.size() << ")";}
121  };
122 };
123 
124 #endif // __ROADMAP_NODE_H__
ロードマップのノード
Definition: RoadmapNode.h:17
unsigned int nParents() const
親ノードの数を取得
Definition: RoadmapNode.h:80
unsigned int nChildren() const
子ノードの数を取得
Definition: RoadmapNode.h:86
RoadmapNode(const Configuration &pos)
コンストラクタ
Definition: RoadmapNode.h:23
void addParent(RoadmapNodePtr node)
親ノードの追加
Definition: RoadmapNode.h:34
boost::shared_ptr< RoadmapNode > RoadmapNodePtr
Definition: RoadmapNode.h:11
bool visited() const
探索用フラグの値を取得する
Definition: RoadmapNode.h:98
list index
std::vector< RoadmapNodePtr > children_
子ノードリスト
Definition: RoadmapNode.h:108
std::vector< RoadmapNodePtr > parents_
親ノードリスト
Definition: RoadmapNode.h:103
bool visited_
探索アルゴリズム用フラグ
Definition: RoadmapNode.h:118
std::ostream & operator<<(std::ostream &out, const Configuration &cfg)
void visited(bool flag)
探索用フラグを設定する
Definition: RoadmapNode.h:92
void addChild(RoadmapNodePtr node)
子ノードの追加
Definition: RoadmapNode.h:40
Configuration & position()
位置の取得
Definition: RoadmapNode.h:60
~RoadmapNode()
デストラクタ
Definition: RoadmapNode.h:28
#define HRPPLANNER_API
Definition: exportdef.h:22
png_infop png_uint_32 flag
Definition: png.h:2159
Configuration pos_
このノードの座標
Definition: RoadmapNode.h:113


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:05