#include <GiaKeyList.h>
Public Member Functions | |
void | addKeyItem (const OverlayKey &item) |
Add key-item to keyList. | |
void | removeKeyItem (const OverlayKey &item) |
Removes key-item from keyList. | |
bool | contains (const OverlayKey &item) |
const std::vector< OverlayKey > & | getVector () |
uint | getSize () |
const OverlayKey & | get (uint i) |
Protected Member Functions | |
int | getPosition (const OverlayKey &item) |
Protected Attributes | |
std::vector< OverlayKey > | keyList |
contains all search keys | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const GiaKeyList &k) |
void GiaKeyList::addKeyItem | ( | const OverlayKey & | item | ) |
Add key-item to keyList.
item | to add |
Referenced by Gia::handleAppMessage(), and Gia::handleUDPMessage().
void GiaKeyList::removeKeyItem | ( | const OverlayKey & | item | ) |
Removes key-item from keyList.
item | to remove |
00036 { 00037 std::vector<OverlayKey>::iterator it = keyList.begin(); 00038 if(contains(item)) 00039 keyList.erase(it + getPosition(item)); 00040 }
bool GiaKeyList::contains | ( | const OverlayKey & | item | ) |
item | to check |
Referenced by addKeyItem(), Gia::processSearchMessage(), and removeKeyItem().
00043 { 00044 if(getPosition(item) != -1) 00045 return true; 00046 return false; 00047 }
const std::vector< OverlayKey > & GiaKeyList::getVector | ( | ) |
uint GiaKeyList::getSize | ( | ) |
Referenced by Gia::addNeighbor(), Gia::handleTimerEvent(), and Gia::sendKeyListToNeighbor().
00063 { 00064 return keyList.size(); 00065 }
const OverlayKey & GiaKeyList::get | ( | uint | i | ) |
Referenced by Gia::sendKeyListToNeighbor().
00069 { 00070 return keyList[i]; 00071 }
int GiaKeyList::getPosition | ( | const OverlayKey & | item | ) | [protected] |
item | to get position |
Referenced by contains(), and removeKeyItem().
00050 { 00051 for(uint i = 0; i < keyList.size(); i++) 00052 if(keyList[i] == item) 00053 return i; 00054 return -1; 00055 }
std::ostream& operator<< | ( | std::ostream & | os, | |
const GiaKeyList & | k | |||
) | [friend] |
std::vector<OverlayKey> GiaKeyList::keyList [protected] |
contains all search keys
Referenced by addKeyItem(), get(), getPosition(), getSize(), getVector(), operator<<(), and removeKeyItem().