#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) |
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().
00109 { 00110 int len = 0; 00111 list<I3SubIdentifier>::const_iterator it; 00112 00113 for (it = stack.begin(); it != stack.end(); it++) { 00114 len += it->length(); 00115 } 00116 return len + 16; /* the size variable */ 00117 }
| 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 I3::handleUDPMessage(), I3BaseApp::sendPacket(), I3::sendPacket(), and I3::sendToNode().
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 I3BaseApp::sendPacket(), I3::sendPacket(), and I3::sendToNode().
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.
00054 { 00055 list<I3SubIdentifier>::const_iterator it; 00056 00057 for (it = s.stack.begin(); it != s.stack.end(); it++) { 00058 stack.push_back(*it); 00059 } 00060 }
| 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(), I3BaseApp::sendPacket(), and I3::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::handleUDPMessage(), 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.
00130 { 00131 list<I3SubIdentifier>::const_iterator it; 00132 00133 for (it = s.stack.begin(); it != s.stack.end(); it++) { 00134 os << *it << ", "; 00135 } 00136 return os; 00137 }
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().
1.5.8