Stack of I3SubIdentifier, implementing the "identifier stack" proposed in Internet Indirection Infrastructure. More...
#include <I3IdentifierStack.h>
Public Member Functions | |
void | push (const I3Identifier &id) |
Pushes an I3Identifier. | |
void | push (const I3IPAddress &ip) |
Pushes an I3IPAddress. | |
void | push (const IPvXAddress &add, int port) |
Pushes an IP address with port. | |
void | push (const I3IdentifierStack &stack) |
Appends an I3IdentifierStack at the end. | |
I3SubIdentifier & | peek () |
Returns a reference to the top of the stack. | |
const I3SubIdentifier & | peek () const |
Returns a const reference to the top of the stack. | |
void | pop () |
Pops a subidentifier from the top of the stack. | |
void | clear () |
uint32_t | size () const |
Returns the size of the stack. | |
int | compareTo (const I3IdentifierStack &s) const |
Comparation function. | |
int | length () const |
void | replaceAddress (const I3IPAddress &source, const I3IPAddress &dest) |
Protected Attributes | |
std::list< I3SubIdentifier > | stack |
Stack of subidentifiers. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const I3IdentifierStack &t) |
Stack of I3SubIdentifier, implementing the "identifier stack" proposed in Internet Indirection Infrastructure.
Definition at line 33 of file I3IdentifierStack.h.
void I3IdentifierStack::clear | ( | ) |
Definition at line 99 of file I3IdentifierStack.cc.
Referenced by I3Trigger::clear().
00100 { 00101 stack.clear(); 00102 }
int I3IdentifierStack::compareTo | ( | const I3IdentifierStack & | s | ) | const |
Comparation function.
s | Stack to be compared against |
Definition at line 78 of file I3IdentifierStack.cc.
Referenced by I3Trigger::compareTo().
00079 { 00080 int cmp; 00081 00082 if (stack.size() != s.size()) { 00083 return stack.size() - s.size(); 00084 } 00085 00086 list<I3SubIdentifier>::const_iterator it0 = stack.begin(); 00087 list<I3SubIdentifier>::const_iterator it1 = s.stack.begin(); 00088 00089 for (; it0 != stack.end(); it0++, it1++) { 00090 //for (uint i = 0; i < stack.size(); i++) { 00091 cmp = it0->compareTo(*it1); 00092 //cmp = stack[i].compareTo(s.stack[i]); 00093 if (cmp != 0) return cmp; 00094 } 00095 return 0; 00096 }
int I3IdentifierStack::length | ( | ) | const |
Definition at line 109 of file I3IdentifierStack.cc.
Referenced by I3Trigger::length().
const I3SubIdentifier & I3IdentifierStack::peek | ( | ) | const |
Returns a const reference to the top of the stack.
Definition at line 67 of file I3IdentifierStack.cc.
00068 { 00069 return stack.back(); 00070 }
I3SubIdentifier & I3IdentifierStack::peek | ( | ) |
Returns a reference to the top of the stack.
Definition at line 62 of file I3IdentifierStack.cc.
Referenced by I3BaseApp::sendPacket(), and I3::sendPacket().
00063 { 00064 return stack.back(); 00065 }
void I3IdentifierStack::pop | ( | ) |
Pops a subidentifier from the top of the stack.
Definition at line 72 of file I3IdentifierStack.cc.
Referenced by I3::sendPacket().
00073 { 00074 stack.pop_back(); 00075 }
void I3IdentifierStack::push | ( | const I3IdentifierStack & | stack | ) |
Appends an I3IdentifierStack at the end.
stack | Identifier stack to be appended |
Definition at line 53 of file I3IdentifierStack.cc.
void I3IdentifierStack::push | ( | const IPvXAddress & | add, | |
int | port | |||
) |
Pushes an IP address with port.
add | IP address to be pushed | |
port | Address port to be pushed |
Definition at line 36 of file I3IdentifierStack.cc.
00037 { 00038 I3IPAddress ipAddress; 00039 00040 ipAddress.setAddress(ip); 00041 ipAddress.setPort(port); 00042 push(ipAddress); 00043 }
void I3IdentifierStack::push | ( | const I3IPAddress & | ip | ) |
Pushes an I3IPAddress.
ip | IP address to be pushed |
Definition at line 45 of file I3IdentifierStack.cc.
00046 { 00047 I3SubIdentifier id; 00048 00049 id.setIPAddress(ip); 00050 stack.push_back(id); 00051 }
void I3IdentifierStack::push | ( | const I3Identifier & | id | ) |
Pushes an I3Identifier.
id | Identifier to be pushed |
Definition at line 28 of file I3IdentifierStack.cc.
Referenced by I3Composite::createMessage(), I3TRTClient::handleTimerEvent(), I3BaseApp::insertTrigger(), push(), and I3BaseApp::sendPacket().
00029 { 00030 I3SubIdentifier id; 00031 00032 id.setIdentifier(identifier); 00033 stack.push_back(id); 00034 }
void I3IdentifierStack::replaceAddress | ( | const I3IPAddress & | source, | |
const I3IPAddress & | dest | |||
) |
Definition at line 119 of file I3IdentifierStack.cc.
00119 { 00120 list<I3SubIdentifier>::iterator it; 00121 00122 for (it = stack.begin(); it != stack.end(); it++) { 00123 if (it->getType() == I3SubIdentifier::IPAddress && it->getIPAddress() == source) { 00124 it->setIPAddress(dest); 00125 } 00126 } 00127 00128 }
uint32_t I3IdentifierStack::size | ( | ) | const |
Returns the size of the stack.
Definition at line 104 of file I3IdentifierStack.cc.
Referenced by compareTo(), I3::insertTrigger(), and I3::sendPacket().
00105 { 00106 return stack.size(); 00107 }
std::ostream& operator<< | ( | std::ostream & | os, | |
const I3IdentifierStack & | t | |||
) | [friend] |
Definition at line 130 of file I3IdentifierStack.cc.
std::list<I3SubIdentifier> I3IdentifierStack::stack [protected] |
Stack of subidentifiers.
Definition at line 83 of file I3IdentifierStack.h.
Referenced by clear(), compareTo(), length(), operator<<(), peek(), pop(), push(), replaceAddress(), and size().