AI_AStar::Graph Class Reference
#include <AI_AStar.h>
Detailed Description
Graph as collection of nodes and links and operations over them.The nodes are indexed by so-called ID indices. The ID index is not same as index of node in array (is not in 0 and number returned by getNodesNumber()). Graph could be combinated (for example one from AI_AStar and one from AI_AStar::Session) and ID index serves for unique node identification in graph's combination.
- Version:
- 1.01 (18.8.2006)
- bug fixed in clear()
1.0 Initial release
Public Member Functions | |
Graph () | |
Constructor. | |
~Graph () | |
Destructor. | |
Node * | addNode (void *ptr_user_data=NULL) |
Add node into graph. | |
Link * | addLink (Node *ptr_node1, Node *ptr_node2, float f_lenght, float f_min, float f_max, Session *ptr_session=NULL) |
Add link into graph. | |
void | reset (void) |
Remove all nodes and links from graph and links between nodes of this graph and any other nodes. | |
void | clear (void) |
Free all allocated memory. | |
void | setBaseNodeIndex (const int i) |
Set base index of graph nodes. | |
const int | getBaseNodeIndex (void) const |
Get base index of graph nodes. | |
const int | getLinksNumber (void) const |
Get number of links in graph. | |
const int | getNodesNumber (void) const |
Get number of nodes in graph. | |
Node * | getNode (const int i) const |
Return node by its index in array (not by node's own id index). | |
Link * | getLink (const int i) const |
Return link by its index in array. | |
Protected Attributes | |
NodeArray | m_arr_nodes |
Nodes. | |
LinkArray | m_arr_links |
Links. | |
int | m_i_first_node_index |
Base index of node (from which the numbering of nodes will start). |
Constructor & Destructor Documentation
AI_AStar::Graph::Graph | ( | ) | [inline] |
Constructor.
AI_AStar::Graph::~Graph | ( | ) | [inline] |
Destructor.
Member Function Documentation
AI_AStar::Node * AI_AStar::Graph::addNode | ( | void * | ptr_user_data = NULL |
) |
Add node into graph.
AI_AStar::Link * AI_AStar::Graph::addLink | ( | AI_AStar::Node * | ptr_node1, | |
AI_AStar::Node * | ptr_node2, | |||
float | f_lenght, | |||
float | f_min, | |||
float | f_max, | |||
AI_AStar::Session * | ptr_session = NULL | |||
) |
Add link into graph.
- Parameters:
-
ptr_node1 First node of link. ptr_node2 Second node of link. f_lenght Lenght of link. f_min Minimum width of an agent that could go through this path. f_max Maximum width of an agent that could go through this path. ptr_session Session into which the link belongs (NULL means the link is in basic graph - not in session).
void AI_AStar::Graph::reset | ( | void | ) |
Remove all nodes and links from graph and links between nodes of this graph and any other nodes.
Do not free any memory. Should be used only within A* session.
void AI_AStar::Graph::clear | ( | void | ) |
Free all allocated memory.
Could be carefully used to clear memory outside destructor.
void AI_AStar::Graph::setBaseNodeIndex | ( | const int | i | ) | [inline] |
Set base index of graph nodes.
const int AI_AStar::Graph::getBaseNodeIndex | ( | void | ) | const [inline] |
Get base index of graph nodes.
const int AI_AStar::Graph::getLinksNumber | ( | void | ) | const [inline] |
Get number of links in graph.
const int AI_AStar::Graph::getNodesNumber | ( | void | ) | const [inline] |
Get number of nodes in graph.
AI_AStar::Node * AI_AStar::Graph::getNode | ( | const int | i | ) | const [inline] |
Return node by its index in array (not by node's own id index).
AI_AStar::Link * AI_AStar::Graph::getLink | ( | const int | i | ) | const [inline] |
Return link by its index in array.
Member Data Documentation
NodeArray AI_AStar::Graph::m_arr_nodes [protected] |
Nodes.
LinkArray AI_AStar::Graph::m_arr_links [protected] |
Links.
int AI_AStar::Graph::m_i_first_node_index [protected] |
Base index of node (from which the numbering of nodes will start).
The documentation for this class was generated from the following files: