FineKernelToolKit 4.2.13
読み取り中…
検索中…
一致する文字列を見つけられません
Graph.h
[詳解]
1#if !defined(__FK_GRAPH_HEADER__)
2#define __FK_GRAPH_HEADER__
3
4#include <FK/CostTable.hh>
5#include <FK/IDAdmin.hh>
6
7namespace FK {
8
10 enum class fk_CostStatus {
11 CONTINUE,
12 FINISH,
13 ERROR
14 };
15
17
42 class fk_Graph : public fk_Shape {
43
44#if !defined(FK_DOXYGEN_USER_PROCESS)
45 class Member {
46 public:
47 fk_Point nodeShape;
48 fk_Line edgeShape;
49 std::unique_ptr<fk_IDAdmin> edgeAdmin;
50
51 std::vector<std::unique_ptr<fk_GraphNode>> nodeArray;
52 std::vector<std::unique_ptr<fk_GraphEdge>> edgeArray;
53 std::vector<std::unique_ptr<fk_CostTable>> tableArray;
54
55 std::list<fk_GraphNode *> nodeList;
56 std::list<fk_GraphEdge *> edgeList;
57
58 unsigned int intCostMax, doubleCostMax;
59
60 Member(void);
61 };
62#endif
63
64 public:
65
67
74 fk_Graph(unsigned int num);
75
78
81
83
88 unsigned int getNodeSize(void);
89
91
96 unsigned int getMaxEdgeID(void);
97
99
106 fk_GraphNode * getNode(unsigned int ID);
107
109
116 std::list<fk_GraphNode *> * getAllNode(void);
117
119
126 fk_GraphEdge * getEdge(unsigned int ID);
127
129
136 std::list<fk_GraphEdge *> * getAllEdge(void);
137
139
149
151
154
156
170
172
180
182
185
187
204 bool makeCostTable(unsigned int tableID, fk_CostType type);
205
207
219 bool setCostDirection(unsigned int tableID, fk_CostDirection direction);
220
222
232 bool setEdgeCostID(unsigned int tableID, unsigned int edgeCostID);
233
235
242 unsigned int getNodeCostID(unsigned int tableID);
243
245
252 void setStart(unsigned int tableID, fk_GraphNode *node);
253
255
262 void addGoal(unsigned int tableID, fk_GraphNode *node);
263
265
271 void removeGoal(unsigned int tableID, fk_GraphNode* node);
272
274
279 void clearGoal(unsigned int tableID);
280
282
291 bool initCostTable(unsigned int tableID);
292
294
309 fk_CostStatus updateCostTable(unsigned int tableID);
310
312
327 fk_CostStatus getCostStatus(unsigned int tableID);
328
330
349 std::list<fk_GraphNode *> getOnePath(unsigned int tableID);
350
352
365 void getOnePath(unsigned int tableID, std::list<fk_GraphNode *> *nodeList);
366
368
369#if !defined(FK_DOXYGEN_USER_PROCESS)
370 fk_Point * GetVertexShape(void);
371 fk_Line * GetEdgeShape(void);
372 void TablePrint(void);
373 void CostPrint(unsigned int);
374 void CostPrint(fk_CostType, unsigned int);
375#endif
376
377 private:
378
379 std::unique_ptr<Member> _m;
380
381 void NodeResize(unsigned int);
382 bool TableReady(unsigned int);
383 void DoubleUpdate(fk_CostTable *, fk_GraphEdge *, fk_GraphNode *);
384 void IntUpdate(fk_CostTable *, fk_GraphEdge *, fk_GraphNode *);
385
386 void GetForwardPath(fk_CostType, unsigned unt, fk_GraphNode *,
387 std::list<fk_GraphNode *> *, std::list<fk_GraphNode *> *);
388
389 void GetBackPath(fk_CostType, unsigned int, fk_GraphNode *,
390 std::list<fk_GraphNode *> *, std::list<fk_GraphNode *> *);
391
392 fk_GraphNode * GetTrueGoal(fk_CostType, unsigned int, std::list<fk_GraphNode *> *);
393
394 };
395}
396
397
398#endif
399
400/****************************************************************************
401 *
402 * Copyright (c) 1999-2024, Fine Kernel Project, All rights reserved.
403 *
404 * Redistribution and use in source and binary forms,
405 * with or without modification, are permitted provided that the
406 * following conditions are met:
407 *
408 * - Redistributions of source code must retain the above
409 * copyright notice, this list of conditions and the
410 * following disclaimer.
411 *
412 * - Redistributions in binary form must reproduce the above
413 * copyright notice, this list of conditions and the
414 * following disclaimer in the documentation and/or
415 * other materials provided with the distribution.
416 *
417 * - Neither the name of the copyright holders nor the names
418 * of its contributors may be used to endorse or promote
419 * products derived from this software without specific
420 * prior written permission.
421 *
422 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
423 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
424 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
425 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
426 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
427 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
428 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
429 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
430 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
431 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
432 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
433 * POSSIBILITY OF SUCH DAMAGE.
434 *
435 ****************************************************************************/
436/****************************************************************************
437 *
438 * Copyright (c) 1999-2024, Fine Kernel Project, All rights reserved.
439 *
440 * 本ソフトウェアおよびソースコードのライセンスは、基本的に
441 * 「修正 BSD ライセンス」に従います。以下にその詳細を記します。
442 *
443 * ソースコード形式かバイナリ形式か、変更するかしないかを問わず、
444 * 以下の条件を満たす場合に限り、再頒布および使用が許可されます。
445 *
446 * - ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、
447 * および下記免責条項を含めること。
448 *
449 * - バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の
450 * 資料に、上記の著作権表示、本条件一覧、および下記免責条項を
451 * 含めること。
452 *
453 * - 書面による特別の許可なしに、本ソフトウェアから派生した製品の
454 * 宣伝または販売促進に、本ソフトウェアの著作権者の名前または
455 * コントリビューターの名前を使用してはならない。
456 *
457 * 本ソフトウェアは、著作権者およびコントリビューターによって「現
458 * 状のまま」提供されており、明示黙示を問わず、商業的な使用可能性、
459 * および特定の目的に対する適合性に関す暗黙の保証も含め、またそれ
460 * に限定されない、いかなる保証もないものとします。著作権者もコン
461 * トリビューターも、事由のいかんを問わず、損害発生の原因いかんを
462 * 問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その
463 * 他の)不法行為であるかを問わず、仮にそのような損害が発生する可
464 * 能性を知らされていたとしても、本ソフトウェアの使用によって発生
465 * した(代替品または代用サービスの調達、使用の喪失、データの喪失、
466 * 利益の喪失、業務の中断も含め、またそれに限定されない)直接損害、
467 * 間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害に
468 * ついて、一切責任を負わないものとします。
469 *
470 ****************************************************************************/
グラフ構造の辺を制御するクラス
Definition GraphEdge.h:37
グラフ構造のノードを制御するクラス
Definition GraphNode.h:27
グラフ構造を制御するクラス
Definition Graph.h:42
void clearGoal(unsigned int tableID)
目標ノード初期化関数
fk_Graph(unsigned int num)
コンストラクタ
void setStart(unsigned int tableID, fk_GraphNode *node)
出発ノード設定関数
fk_GraphNode * getNode(unsigned int ID)
ノード取得関数
fk_CostStatus updateCostTable(unsigned int tableID)
コストテーブル更新関数
bool deleteEdge(fk_GraphEdge *e)
辺削除関数
bool makeCostTable(unsigned int tableID, fk_CostType type)
コストテーブル生成関数
unsigned int getNodeSize(void)
ノード数取得関数
void getOnePath(unsigned int tableID, std::list< fk_GraphNode * > *nodeList)
最短経路取得関数2
fk_GraphEdge * makeEdge(bool mode, fk_GraphNode *v1, fk_GraphNode *v2)
辺生成関数
fk_CostStatus getCostStatus(unsigned int tableID)
コストテーブル状態取得関数
unsigned int getMaxEdgeID(void)
辺ID最大値取得関数
fk_GraphEdge * getEdge(unsigned int ID)
辺情報取得関数
std::list< fk_GraphEdge * > * getAllEdge(void)
全辺取得関数
~fk_Graph()
デストラクタ
std::list< fk_GraphNode * > * getAllNode(void)
全ノード取得関数
void addGoal(unsigned int tableID, fk_GraphNode *node)
目標ノード追加関数
unsigned int getNodeCostID(unsigned int tableID)
ノード内コストID参照関数
std::list< fk_GraphNode * > getOnePath(unsigned int tableID)
最短経路取得関数1
void removeGoal(unsigned int tableID, fk_GraphNode *node)
目標ノード除外関数
bool setCostDirection(unsigned int tableID, fk_CostDirection direction)
コスト算出方向指定関数
bool setEdgeCostID(unsigned int tableID, unsigned int edgeCostID)
辺コストID対応指定関数
bool initCostTable(unsigned int tableID)
コストテーブル初期化関数
bool isConnect(fk_GraphNode *v1, fk_GraphNode *v2)
辺存在確認関数
有向線分を生成、管理するクラス
Definition Line.h:22
点群を生成、管理するクラス
Definition Point.h:29
形状用基底クラス
Definition Shape.h:44
Fine Kernel Toolkit 名前空間
Definition Angle.h:6
fk_CostType
グラフ内コスト値の型を表す列挙型
Definition GraphEdge.h:12
fk_CostDirection
グラフ内コスト算出方向を表す列挙型
Definition GraphEdge.h:19
fk_CostStatus
グラフのコスト算出状況を表す列挙型
Definition Graph.h:10
@ CONTINUE
途中段階状態
@ ERROR
エラー
@ FINISH
完了状態