#include <GlobalRoutingHashMap.h>
Public Types | |
typedef std::pair< IPvXAddress, SimpleNodeEntry > | RouteEntry |
Public Member Functions | |
void | insertNode (const IPvXAddress &addr, const SimpleNodeEntry &entry) |
void | removeNode (const IPvXAddress &addr) |
RouteEntry | getEntry (uint i) const |
SimpleNodeEntry * | findEntryForAddress (const IPvXAddress &addr) |
int | size () |
Private Types | |
typedef __gnu_cxx::hash_map< IPvXAddress, SimpleNodeEntry > | RouteHashMap |
Private Attributes | |
RouteHashMap | routeHashMap |
typedef std::pair<IPvXAddress, SimpleNodeEntry> GlobalRoutingHashMap::RouteEntry |
typedef __gnu_cxx::hash_map<IPvXAddress, SimpleNodeEntry> GlobalRoutingHashMap::RouteHashMap [private] |
SimpleNodeEntry * GlobalRoutingHashMap::findEntryForAddress | ( | const IPvXAddress & | addr | ) |
00070 { 00071 RouteHashMap::iterator r = routeHashMap.find(addr); 00072 if (r == routeHashMap.end()) 00073 return NULL; // host not found 00074 return &(r->second); 00075 }
GlobalRoutingHashMap::RouteEntry GlobalRoutingHashMap::getEntry | ( | uint | i | ) | const |
00042 { 00043 if (i > routeHashMap.size()) 00044 error("GlobalRoutingHashMap::getEntry(): i > routeHashMap.size()!"); 00045 00046 // FIXME inefficient! is there a better way? 00047 RouteHashMap::const_iterator it = routeHashMap.begin(); 00048 while( i-- ) 00049 ++it; 00050 00051 return *it; 00052 }
void GlobalRoutingHashMap::insertNode | ( | const IPvXAddress & | addr, | |
const SimpleNodeEntry & | entry | |||
) |
void GlobalRoutingHashMap::removeNode | ( | const IPvXAddress & | addr | ) |
00061 { 00062 if (!routeHashMap.erase(addr)) { 00063 error(("Trying to remove Host " + addr.str() + 00064 ", which is not in the RoutingHashMap").c_str()); 00065 } 00066 }
int GlobalRoutingHashMap::size | ( | ) | [inline] |