etrobocon2018 feat.KatLab  770af34cce41ae9c30c41303275e1add2daae0c3 (with uncommitted changes)
 全て クラス 名前空間 ファイル 関数 変数 列挙型 列挙値 フレンド マクロ定義 ページ
Node.h
[詳解]
1 
6 #ifndef __NODE__
7 #define __NODE__
8 
9 #include <vector>
10 #include <memory>
11 #include <cstdlib>
12 #include <cstdint>
13 
142 class Node{
146  struct Position {
150  std::int8_t x;
154  std::int8_t y;
155  Position()
156  : x(0), y(0) {}
157  };
158 
159  public:
168  : nodeID(0), blockExists(false), neighbors(nullptr), parentNode(nullptr), score(99), closed(false) {}
169 
173  explicit Node(std::int8_t id)
174  : nodeID(id), blockExists(false), neighbors(nullptr), parentNode(nullptr), score(99), closed(false) {}
175 
179  explicit Node(std::vector<Node*>* nodes)
180  : nodeID(0), blockExists(false), neighbors(nodes), parentNode(nullptr), score(99), closed(false) {}
181 
185  bool operator==(Node& obj)
186  {
187  return this == &obj;
188  }
189 
193  bool operator!=(Node& obj)
194  {
195  return this != &obj;
196  }
197 
198 
199 
205  void setNeighbors(std::vector<Node*>* nodes);
206 
212  std::vector<Node*>* getNeighbors();
213 
224  void setNodeID(std::int8_t nodeNumber);
225 
236  std::int8_t getNodeID();
237 
243  void setHasBlock(bool exists);
244 
250  bool hasBlock();
251 
263  void setPosition(std::int8_t x, std::int8_t y);
264 
275  std::int8_t getPositionX();
276 
287  std::int8_t getPositionY();
288 
298  void setParentNode(Node* parent);
299 
309  Node* getParentNode();
310 
320  void setScore(std::int32_t score_);
321 
331  std::int32_t getScore();
332 
342  void setRealCost(std::int32_t cost);
343 
353  std::int32_t getRealCost();
354 
364  void setBeClosed(bool closed_);
365 
375  bool isClosed();
376 
377  private:
381  std::int8_t nodeID;
382 
386  bool blockExists;
387 
391  std::vector<Node*>* neighbors;
392 
396  Position position;
397 
405  Node* parentNode;
406 
414  std::int32_t score;
415 
423  std::int32_t realCost;
424 
432  bool closed;
433 };
434 
435 #endif // NODE
void setPosition(std::int8_t x, std::int8_t y)
Definition: Node.cpp:33
bool operator!=(Node &obj)
Definition: Node.h:193
void setNodeID(std::int8_t nodeNumber)
Definition: Node.cpp:13
std::int8_t getPositionX()
Definition: Node.cpp:39
Node * getParentNode()
Definition: Node.cpp:54
Definition: Node.h:142
std::vector< Node * > * getNeighbors()
Definition: Node.cpp:8
Node(std::int8_t id)
Definition: Node.h:173
void setNeighbors(std::vector< Node * > *nodes)
Definition: Node.cpp:3
void setHasBlock(bool exists)
Definition: Node.cpp:23
void setBeClosed(bool closed_)
Definition: Node.cpp:79
bool isClosed()
Definition: Node.cpp:84
void setRealCost(std::int32_t cost)
Definition: Node.cpp:69
std::int32_t getRealCost()
Definition: Node.cpp:74
void setParentNode(Node *parent)
Definition: Node.cpp:49
Node(std::vector< Node * > *nodes)
Definition: Node.h:179
bool hasBlock()
Definition: Node.cpp:28
std::int8_t getNodeID()
Definition: Node.cpp:18
std::int8_t getPositionY()
Definition: Node.cpp:44
void setScore(std::int32_t score_)
Definition: Node.cpp:59
std::int32_t getScore()
Definition: Node.cpp:64
bool operator==(Node &obj)
Definition: Node.h:185
Node()
Definition: Node.h:167