Fawkes API Fawkes Development Version
astar_state.h
1
2/***************************************************************************
3 * astar_state.h - Representation of a state in the A* search
4 *
5 * Created: Fri Oct 18 15:16:23 2013
6 * Copyright 2002 Stefan Jacobs
7 * 2013-2014 Bahram Maleki-Fard
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#ifndef _PLUGINS_COLLI_SEARCH_ASTAR_STATE_H_
24#define _PLUGINS_COLLI_SEARCH_ASTAR_STATE_H_
25
26namespace fawkes {
27
28/** @class AStarState <plugins/colli/search/astar_state.h>
29 * This is the class for an A* State.
30 */
31class AStarState
32{
33public:
34 AStarState();
35 AStarState(int x, int y, int past_cost, AStarState *father);
37
38 int x_; /**< x coordinate of the state */
39 int y_; /**< y coordinate of the state */
40
41 AStarState *father_; /**< The predecessor state */
42
43 int past_cost_; /**< The past cost */
44 int total_cost_; /**< The total cost */
45};
46
47/* ************************************************************************** */
48/* *********************** IMPLEMENTATION DETAILS ************************* */
49/* ************************************************************************** */
50
51/** This is the standard constructor. */
53{
54 father_ = 0;
55 x_ = y_ = 0;
56 total_cost_ = 0;
57 past_cost_ = 0;
58}
59
60/** This is another standard constuctor, this time parametrized.
61 * @param x is the x coordinate.
62 * @param y is the y coordinate.
63 * @param past_cost is the total left cost.
64 * @param father is a pointer to the predecessor of this AStarState.
65 */
66inline AStarState::AStarState(int x, int y, int past_cost, AStarState *father)
67{
68 x_ = x;
69 y_ = y;
70 past_cost_ = past_cost;
71 father_ = father;
72}
73
74/** Standard Destructor */
76{
77}
78
79} // namespace fawkes
80
81#endif
This is the abstract(!) class for an A* State.
Definition: astar_state.h:39
int y_
y coordinate of the state
Definition: astar_state.h:39
int x_
x coordinate of the state
Definition: astar_state.h:38
AStarState * father_
The predecessor state.
Definition: astar_state.h:41
int total_cost_
The total cost.
Definition: astar_state.h:44
int past_cost_
The past cost.
Definition: astar_state.h:43
virtual ~AStarState()
Destructor.
Definition: astar_state.h:48
AStarState()
This is the standard constructor.
Definition: astar_state.h:52
Fawkes library namespace.