MicroMouse Maze Library  3703225
公開メンバ関数 | 公開変数類 | フレンド | 全メンバ一覧
MazeLib::Pose 構造体

PositionDirection をまとめた型。位置姿勢。 [詳解]

#include <Maze.h>

MazeLib::Pose 連携図
Collaboration graph
[凡例]

公開メンバ関数

 Pose ()
 
 Pose (const Position p, const Direction d)
 
Pose next (const Direction nextDirection) const
 隣接姿勢の取得 [詳解]
 
const char * toString () const
 表示用文字列に変換する [詳解]
 

公開変数類

Position p
 位置 [詳解]
 
Direction d
 姿勢 [詳解]
 

フレンド

std::ostream & operator<< (std::ostream &os, const Pose &pose)
 ostream での表示 [詳解]
 

詳解

PositionDirection をまとめた型。位置姿勢。

アライメント制約により実体は 4Bytes。 位置姿勢は、区画とそこに向かう方向で特定する。 現在区画から出る方向ではないことに注意する。

+---+---+---+ 例:
| < | <--- (0, 2, West)
+ +---+ ^ + <--- (2, 2, North)
| > | <--- (1, 1, East)
+ +---+ v + <--- (2, 0, South)
| S | | <--- (0, 0)
+---+---+---+

構築子と解体子

◆ Pose() [1/2]

MazeLib::Pose::Pose ( )
inline
399 {}

◆ Pose() [2/2]

MazeLib::Pose::Pose ( const Position  p,
const Direction  d 
)
inline
400 : p(p), d(d) {}
Position p
位置
Definition: Maze.h:395
Direction d
姿勢
Definition: Maze.h:396

関数詳解

◆ next()

Pose MazeLib::Pose::next ( const Direction  nextDirection) const
inline

隣接姿勢の取得

引数
nextDirection隣接方向
戻り値
Pose 隣接姿勢
406  {
407  return Pose(p.next(nextDirection), nextDirection);
408  }
Pose()
Definition: Maze.h:399
Position next(const Direction d) const
自分の引数方向に隣接した区画の Position を返す
Definition: Maze.cpp:22
呼び出し関係図:

◆ toString()

const char* MazeLib::Pose::toString ( ) const
inline

表示用文字列に変換する

416  {
417  static char str[32];
418  snprintf(str, sizeof(str), "(%02d, %02d, %c)", p.x, p.y, d.toChar());
419  return str;
420  }
char toChar() const
表示用char型へのキャスト
Definition: Maze.h:206
int8_t x
迷路区画のx座標成分
Definition: Maze.h:276
int8_t y
迷路区画のy座標成分
Definition: Maze.h:277
呼び出し関係図:

フレンドと関連関数の詳解

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Pose pose 
)
friend

ostream での表示

66  {
67  return os << "( " << std::setw(2) << +pose.p.x << ", " << std::setw(2)
68  << +pose.p.y << ", " << pose.d.toChar() << ")";
69 }

メンバ詳解

◆ d

Direction MazeLib::Pose::d

姿勢

◆ p

Position MazeLib::Pose::p

位置


この構造体詳解は次のファイルから抽出されました: