
Public Member Functions | |
| AStarNode (UserState *state) | |
| ~AStarNode () | |
| void | createNeighbourNodes () |
| bool | operator== (AStarNode &rhs) const |
| bool | operator== (const AStarNode &rhs) const |
| float | getTotalCost () const |
| float | getEntryCost () const |
| float | getEstimatedGoalCost () const |
| float | getTraversalCost () const |
| AStarNode * | getNeighbour (int index) |
| void | setEntryCost (float entryCost) |
| void | setEstimatedGoalCost (float cost) |
| void | setSuccessor (AStarNode *parent) |
Public Attributes | |
| UserState * | mUserState |
| AStarNode * | mSuccessor |
Private Attributes | |
| float | mEntryCost |
| float | mEstimatedGoalCost |
| AStarNode * | mNeighbours [8] |
| unsigned int | mID |
Static Private Attributes | |
| static int | mNumNodes = 0 |
Definition at line 54 of file AStarSearch.h.
| AStarSearch< UserState >::AStarNode::AStarNode | ( | UserState * | state | ) | [inline] |
Definition at line 81 of file AStarSearch.h.
References AStarSearch< UserState >::AStarNode::mID, AStarSearch< UserState >::AStarNode::mNeighbours, AStarSearch< UserState >::AStarNode::mNumNodes, and AStarSearch< UserState >::AStarNode::mUserState.
Referenced by AStarSearch< UserState >::AStarNode::createNeighbourNodes().
00082 : mSuccessor ( NULL ), mUserState ( state), 00083 mEntryCost ( 0.0 ), mEstimatedGoalCost ( 0.0 ) 00084 { 00085 mID = mNumNodes++; 00086 00087 // Create new nodes for each of the neighbours of this one 00088 for ( int i = 0; i < mUserState->getNumNeighbours(); i++ ) 00089 mNeighbours[i] = NULL; 00090 00091 //cout << "Node Constructed: " << ++nodeCount << endl;\e 00092 }
| AStarSearch< UserState >::AStarNode::~AStarNode | ( | ) | [inline] |
Definition at line 96 of file AStarSearch.h.
References AStarSearch< UserState >::AStarNode::mNeighbours, and AStarSearch< UserState >::AStarNode::mUserState.
00097 { 00098 //cout << "Node released: " << --nodeCount << endl; 00099 // Our node may not have any neighbours created yet 00100 if ( mUserState == NULL ) 00101 return; 00102 00103 00104 for ( int i = 0; i < mUserState->getNumNeighbours(); i++ ) 00105 delete mNeighbours[i]; 00106 }
| void AStarSearch< UserState >::AStarNode::createNeighbourNodes | ( | ) | [inline] |
Definition at line 110 of file AStarSearch.h.
References AStarSearch< UserState >::AStarNode::AStarNode(), AStarSearch< UserState >::AStarNode::mNeighbours, and AStarSearch< UserState >::AStarNode::mUserState.
Referenced by AStarSearch< UserState >::setStartState().
00111 { 00112 for ( int i = 0; i < mUserState->getNumNeighbours(); i++ ) 00113 mNeighbours[i] = new AStarNode( mUserState->getNeighbour(i) ); 00114 }
| float AStarSearch< UserState >::AStarNode::getEntryCost | ( | ) | const [inline] |
Definition at line 140 of file AStarSearch.h.
References AStarSearch< UserState >::AStarNode::mEntryCost.
Referenced by AStarSearch< UserState >::_findBestOpenNode(), and AStarSearch< UserState >::advanceSearch().
00141 { 00142 return mEntryCost; 00143 }
| float AStarSearch< UserState >::AStarNode::getEstimatedGoalCost | ( | ) | const [inline] |
Definition at line 146 of file AStarSearch.h.
References AStarSearch< UserState >::AStarNode::mEstimatedGoalCost.
Referenced by AStarSearch< UserState >::_findBestOpenNode().
00147 { 00148 return mEstimatedGoalCost; 00149 }
| AStarNode* AStarSearch< UserState >::AStarNode::getNeighbour | ( | int | index | ) | [inline] |
Definition at line 158 of file AStarSearch.h.
References AStarSearch< UserState >::AStarNode::mNeighbours.
Referenced by AStarSearch< UserState >::advanceSearch().
00159 { 00160 assert ( index < 8 ); 00161 00162 return mNeighbours[index]; 00163 }
| float AStarSearch< UserState >::AStarNode::getTotalCost | ( | ) | const [inline] |
Definition at line 134 of file AStarSearch.h.
References AStarSearch< UserState >::AStarNode::mEntryCost, and AStarSearch< UserState >::AStarNode::mEstimatedGoalCost.
Referenced by AStarSearch< UserState >::_findBestOpenNode(), and AStarSearch< UserState >::HeapCompare::operator()().
00135 { 00136 return mEntryCost + mEstimatedGoalCost; 00137 }
| float AStarSearch< UserState >::AStarNode::getTraversalCost | ( | ) | const [inline] |
Definition at line 152 of file AStarSearch.h.
References AStarSearch< UserState >::AStarNode::mUserState.
00153 { 00154 return mUserState->getTraversalCost(); 00155 }
| bool AStarSearch< UserState >::AStarNode::operator== | ( | const AStarNode & | rhs | ) | const [inline] |
Definition at line 125 of file AStarSearch.h.
References AStarSearch< UserState >::AStarNode::mUserState.
00126 { 00127 return ( mUserState == rhs.mUserState ); 00128 }
| bool AStarSearch< UserState >::AStarNode::operator== | ( | AStarNode & | rhs | ) | const [inline] |
Definition at line 118 of file AStarSearch.h.
References AStarSearch< UserState >::AStarNode::mUserState.
00119 { 00120 return ( mUserState == rhs.mUserState ); 00121 }
| void AStarSearch< UserState >::AStarNode::setEntryCost | ( | float | entryCost | ) | [inline] |
Definition at line 169 of file AStarSearch.h.
References AStarSearch< UserState >::AStarNode::mEntryCost.
00170 { 00171 mEntryCost = entryCost; 00172 }
| void AStarSearch< UserState >::AStarNode::setEstimatedGoalCost | ( | float | cost | ) | [inline] |
Definition at line 175 of file AStarSearch.h.
References AStarSearch< UserState >::AStarNode::mEstimatedGoalCost.
Referenced by AStarSearch< UserState >::setStartState().
00176 { 00177 mEstimatedGoalCost = cost; 00178 }
| void AStarSearch< UserState >::AStarNode::setSuccessor | ( | AStarNode * | parent | ) | [inline] |
Definition at line 181 of file AStarSearch.h.
References AStarSearch< UserState >::AStarNode::mSuccessor.
00182 { 00183 mSuccessor = parent; 00184 }
float AStarSearch< UserState >::AStarNode::mEntryCost [private] |
Definition at line 67 of file AStarSearch.h.
Referenced by AStarSearch< UserState >::AStarNode::getEntryCost(), AStarSearch< UserState >::AStarNode::getTotalCost(), and AStarSearch< UserState >::AStarNode::setEntryCost().
float AStarSearch< UserState >::AStarNode::mEstimatedGoalCost [private] |
Definition at line 68 of file AStarSearch.h.
Referenced by AStarSearch< UserState >::AStarNode::getEstimatedGoalCost(), AStarSearch< UserState >::AStarNode::getTotalCost(), and AStarSearch< UserState >::AStarNode::setEstimatedGoalCost().
unsigned int AStarSearch< UserState >::AStarNode::mID [private] |
Definition at line 75 of file AStarSearch.h.
Referenced by AStarSearch< UserState >::AStarNode::AStarNode().
AStarNode* AStarSearch< UserState >::AStarNode::mNeighbours[8] [private] |
int AStarSearch< UserState >::AStarNode::mNumNodes = 0 [static, private] |
Definition at line 74 of file AStarSearch.h.
Referenced by AStarSearch< UserState >::AStarNode::AStarNode().
| AStarNode* AStarSearch< UserState >::AStarNode::mSuccessor |
Definition at line 62 of file AStarSearch.h.
Referenced by AStarSearch< UserState >::AStarNode::setSuccessor().
| UserState* AStarSearch< UserState >::AStarNode::mUserState |
Definition at line 59 of file AStarSearch.h.
Referenced by AStarSearch< UserState >::advanceSearch(), AStarSearch< UserState >::AStarNode::AStarNode(), AStarSearch< UserState >::AStarNode::createNeighbourNodes(), AStarSearch< UserState >::AStarNode::getTraversalCost(), AStarSearch< UserState >::AStarNode::operator==(), AStarSearch< UserState >::setStartState(), and AStarSearch< UserState >::AStarNode::~AStarNode().
1.4.7