#include <mapnode.h>
Public Methods | |
| MapNode (void) | |
| ~MapNode () | |
| void | get_name (char *, int) |
| void | get_link (int, mode) |
| void | get_join (int join) |
| bool | is_link (mode) |
| bool | is_link (int, mode) |
| vect | find_vector (int) |
| int | find_link (int) |
| int | find_join (int link, int join) |
| char * | find_name (int link) |
| int | num_joins (int link) |
| void | show_node (void) |
Public Attributes | |
| int | x |
| int | y |
| int | numLinks |
| int | numJoins |
Private Attributes | |
| Route * | links |
| char * | name |
|
|
Definition at line 34 of file mapnode.h. References name, and numLinks.
|
|
|
Definition at line 35 of file mapnode.h. References name.
|
|
||||||||||||
|
Definition at line 46 of file mapnode.h. References Route::find_join(). Referenced by Map::connected_to().
|
|
|
Definition at line 54 of file mapnode.c. References between(), Route::destination, links, and numLinks. Referenced by Map::connected_to().
00054 {
00055 if ( between(linkNum, 0, numLinks) ) return links[linkNum].destination;
00056 else {
00057 cerr << "Link " << linkNum << " out of range ("
00058 << 0 << ".." << numLinks << ")\n";
00059 return 0; // node 0 points to NULL
00060 }
00061 }
|
|
|
Definition at line 47 of file mapnode.h. References name. Referenced by Map::get_name().
00047 { return name; }
|
|
|
Definition at line 42 of file mapnode.c. References Route::destination, links, Route::type, and vect. Referenced by Map::vehicle().
00042 {
00043 // Return the bit vector of a given link
00044
00045 int i= 0;
00046
00047 while (link != links[i].destination) i++; // find the link...
00048 // ...and return its bit vector
00049 return links[i].type;
00050 }
|
|
|
Definition at line 39 of file mapnode.h. References numLinks. Referenced by Map::get_field().
|
|
||||||||||||
|
Definition at line 77 of file mapnode.c. References Route::destination, links, mode, numLinks, On, and Route::type. Referenced by Map::get_field().
00077 {
00078 // Input a link and establish its "transportation" type in the bit
00079 // vector
00080
00081 Route *oldLinks= links;
00082 int num= 0;
00083
00084 if (numLinks > 0)
00085 while ((node != links[num].destination) && (num < numLinks)) num++;
00086
00087 if (num >= numLinks) {
00088 num= numLinks;
00089
00090 links= new Route[++numLinks];
00091 assert( links != 0 );
00092
00093 for (int i= 0; i < num; i++)
00094 links[i]= oldLinks[i]; // copy the array
00095
00096 links[num].destination= node;
00097 }
00098 // turn transportation bit on
00099 links[num].type |= On << transportation;
00100 }
|
|
||||||||||||
|
Definition at line 66 of file mapnode.c. References name. Referenced by Map::load_map().
|
|
||||||||||||
|
Definition at line 30 of file mapnode.c. References Route::destination, links, mode, On, and Route::type.
00030 {
00031 // Determine if node is a taxi link
00032
00033 int i= 0;
00034
00035 while (link != links[i].destination) i++; // find the link...
00036 // ...and return whether its transportation bit is on or off
00037 return (links[i].type & On << transportation);
00038 }
|
|
|
Definition at line 18 of file mapnode.c. References False, links, mode, numLinks, On, True, and Route::type. Referenced by Map::bus(), Map::subway(), and Map::taxi().
|
|
|
Definition at line 49 of file mapnode.h. References Route::numJoins. Referenced by Map::num_connections().
|
|
|
Definition at line 104 of file mapnode.c. References Bus, Route::destination, links, name, numLinks, On, Subway, Taxi, Route::type, x, and y. Referenced by Map::show_map().
00104 {
00105 // Output a node in a tabular (sort of) format for debugging purposes
00106
00107 int i;
00108
00109 cout << "\nTaxi: ";
00110 for (i= 0; i < numLinks; i++) // find all taxi routes
00111 if (links[i].type & On << Taxi) cout << ' ' << links[i].destination;
00112 cout << "\nBus: ";
00113 for (i= 0; i < numLinks; i++) // find all bus routes
00114 if (links[i].type & On << Bus) cout << ' ' << links[i].destination;
00115 cout << "\nSubway: ";
00116 for (i= 0; i < numLinks; i++) // find all subway routes
00117 if (links[i].type & On << Subway) cout << ' ' << links[i].destination;
00118 cout << "\nAll: ";
00119 for (i= 0; i < numLinks; i++) // show all routes and (bit vector)s
00120 cout << links[i].destination << " (" << links[i].type << ") ";
00121 cout << "\nName: ``";
00122 if (name == NULL) cout << "(null)";
00123 else cout << name;
00124 cout << "''\n";
00125 cout << "x: " << x << " y: " << y << "\n";
00126 }
|
|
|
Definition at line 26 of file mapnode.h. Referenced by find_link(), find_vector(), get_link(), is_link(), and show_node(). |
|
|
Definition at line 27 of file mapnode.h. Referenced by find_name(), get_name(), MapNode(), show_node(), and ~MapNode(). |
|
|
|
|
|
Definition at line 30 of file mapnode.h. Referenced by find_link(), get_join(), get_link(), is_link(), MapNode(), Map::num_connections(), and show_node(). |
|
|
Definition at line 30 of file mapnode.h. Referenced by Map::load_map(), show_node(), and Map::x(). |
|
|
Definition at line 30 of file mapnode.h. Referenced by Map::load_map(), show_node(), and Map::y(). |
1.2.15