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 
26 namespace fawkes
27 {
28 #if 0 /* just to make Emacs auto-indent happy */
29 }
30 #endif
31 
32 /** @class AStarState <plugins/colli/search/astar_state.h>
33  * This is the class for an A* State.
34  */
35 class AStarState
36 {
37  public:
38  AStarState( );
39  AStarState( int x, int y, int past_cost, AStarState * father );
40  ~AStarState();
41 
42  int x_; /**< x coordinate of the state */
43  int y_; /**< y coordinate of the state */
44 
45  AStarState * father_; /**< The predecessor state */
46 
47  int past_cost_; /**< The past cost */
48  int total_cost_; /**< The total cost */
49 };
50 
51 
52 /* ************************************************************************** */
53 /* *********************** IMPLEMENTATION DETAILS ************************* */
54 /* ************************************************************************** */
55 
56 /** This is the standard constructor. */
57 inline
59 {
60  father_ = 0;
61  x_ = y_ = 0;
62  total_cost_ = 0;
63  past_cost_ = 0;
64 }
65 
66 /** This is another standard constuctor, this time parametrized.
67  * @param x is the x coordinate.
68  * @param y is the y coordinate.
69  * @param past_cost is the total left cost.
70  * @param father is a pointer to the predecessor of this AStarState.
71  */
72 inline
73 AStarState::AStarState( int x, int y, int past_cost, AStarState * father )
74 {
75  x_ = x;
76  y_ = y;
77  past_cost_ = past_cost;
78  father_ = father;
79 }
80 
81 /** Standard Destructor */
82 inline
84 {
85 }
86 
87 } // namespace fawkes
88 
89 #endif
This is the abstract(!) class for an A* State.
Definition: astar_state.h:38
int total_cost_
The total cost.
Definition: astar_state.h:48
AStarState()
This is the standard constructor.
Definition: astar_state.h:58
Fawkes library namespace.
int past_cost_
The past cost.
Definition: astar_state.h:47
int x_
x coordinate of the state
Definition: astar_state.h:42
virtual ~AStarState()
Destructor.
Definition: astar_state.h:51
int y_
y coordinate of the state
Definition: astar_state.h:43
AStarState * father_
The predecessor state.
Definition: astar_state.h:45