Implementation of an Internet Indirection Infrastructure trigger. More...
#include <I3Trigger.h>
Public Member Functions | |
I3Trigger () | |
Constructor. | |
int | compareTo (const I3Trigger &t) const |
Comparison function. | |
bool | operator< (const I3Trigger &t) const |
"Less than" comparison function | |
bool | operator> (const I3Trigger &t) const |
"Greater than" comparison function | |
bool | operator== (const I3Trigger &t) const |
"Equals" comparison function | |
void | setIdentifier (const I3Identifier &id) |
Sets the identifier. | |
void | setInsertionTime (simtime_t time) |
Sets the insertion time. | |
void | setIdentifierStack (I3IdentifierStack &stack) |
Sets the identifier stack. | |
I3Identifier & | getIdentifier () |
Returns the identifier. | |
const I3Identifier & | getIdentifier () const |
Returns the identifier. | |
simtime_t | getInsertionTime () const |
Returns the insertion time. | |
void | clear () |
I3IdentifierStack & | getIdentifierStack () |
Returns the insertion time. | |
const I3IdentifierStack & | getIdentifierStack () const |
Returns the identifier stack. | |
int | length () const |
Protected Attributes | |
I3Identifier | identifier |
Identifier to be matched. | |
I3IdentifierStack | identifierStack |
Identifier stack. | |
simtime_t | insertionTime |
Time in which the trigger was inserted into I3. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const I3Trigger &t) |
String stream operator <<. |
Implementation of an Internet Indirection Infrastructure trigger.
An I3Trigger is composed of an I3Identifier and a I3IdentifierStack (a stack of I3SubIdentifier). In the most basic case, the subidentifier stack contains a single I3IPAddress. When a packet is matched to a trigger, it is sent to the first valid subidentifier found - the rest is passed to the application. If none is found, the packet is dropped.
Definition at line 43 of file I3Trigger.h.
I3Trigger::I3Trigger | ( | ) |
void I3Trigger::clear | ( | ) |
Definition at line 82 of file I3Trigger.cc.
00083 { 00084 identifier.clear(); 00085 identifierStack.clear(); 00086 }
int I3Trigger::compareTo | ( | const I3Trigger & | t | ) | const |
Comparison function.
t | Trigger to compare to |
Definition at line 30 of file I3Trigger.cc.
Referenced by operator<(), operator==(), and operator>().
00031 { 00032 int cmp = identifier.compareTo(t.identifier); 00033 return (cmp != 0) ? cmp : identifierStack.compareTo(t.identifierStack); 00034 }
const I3Identifier & I3Trigger::getIdentifier | ( | ) | const |
Returns the identifier.
Definition at line 72 of file I3Trigger.cc.
00073 { 00074 return identifier; 00075 }
I3Identifier & I3Trigger::getIdentifier | ( | ) |
Returns the identifier.
Definition at line 67 of file I3Trigger.cc.
Referenced by I3Triggers::deliver(), I3::insertTrigger(), and I3::removeTrigger().
00068 { 00069 return identifier; 00070 }
const I3IdentifierStack & I3Trigger::getIdentifierStack | ( | ) | const |
Returns the identifier stack.
Definition at line 93 of file I3Trigger.cc.
00094 { 00095 return identifierStack; 00096 }
I3IdentifierStack & I3Trigger::getIdentifierStack | ( | ) |
Returns the insertion time.
Definition at line 88 of file I3Trigger.cc.
Referenced by I3TRTClient::handleTimerEvent(), I3BaseApp::insertTrigger(), and I3::insertTrigger().
00089 { 00090 return identifierStack; 00091 }
simtime_t I3Trigger::getInsertionTime | ( | ) | const |
Returns the insertion time.
Definition at line 77 of file I3Trigger.cc.
00078 { 00079 return insertionTime; 00080 }
int I3Trigger::length | ( | ) | const |
Definition at line 98 of file I3Trigger.cc.
00098 { 00099 /* insertionTime is an internal variable and doesn't count as part of the message */ 00100 return identifier.length() + identifierStack.length(); 00101 }
bool I3Trigger::operator< | ( | const I3Trigger & | t | ) | const |
"Less than" comparison function
t | Trigger to compare to |
Definition at line 36 of file I3Trigger.cc.
00037 { 00038 return compareTo(t) < 0; 00039 }
bool I3Trigger::operator== | ( | const I3Trigger & | t | ) | const |
"Equals" comparison function
t | Trigger to compare to |
Definition at line 46 of file I3Trigger.cc.
00047 { 00048 return compareTo(t) == 0; 00049 }
bool I3Trigger::operator> | ( | const I3Trigger & | t | ) | const |
"Greater than" comparison function
t | Trigger to compare to |
Definition at line 41 of file I3Trigger.cc.
00042 { 00043 return compareTo(t) > 0; 00044 }
void I3Trigger::setIdentifier | ( | const I3Identifier & | id | ) |
Sets the identifier.
id | Identifier to set. |
Definition at line 52 of file I3Trigger.cc.
Referenced by I3TRTClient::handleTimerEvent(), I3BaseApp::insertTrigger(), and I3BaseApp::removeTrigger().
00053 { 00054 identifier = id; 00055 }
void I3Trigger::setIdentifierStack | ( | I3IdentifierStack & | stack | ) |
Sets the identifier stack.
stack | Insertion time |
Definition at line 62 of file I3Trigger.cc.
00063 { 00064 identifierStack = stack; 00065 }
void I3Trigger::setInsertionTime | ( | simtime_t | time | ) |
Sets the insertion time.
time | Insertion time |
Definition at line 57 of file I3Trigger.cc.
Referenced by I3::insertTrigger().
00058 { 00059 insertionTime = time; 00060 }
std::ostream& operator<< | ( | std::ostream & | os, | |
const I3Trigger & | t | |||
) | [friend] |
String stream operator <<.
os | Output string stream | |
t | Trigger to be output |
Definition at line 103 of file I3Trigger.cc.
00104 { 00105 os << "(" << t.identifier << ", {" << t.identifierStack << "})"; 00106 return os; 00107 }
I3Identifier I3Trigger::identifier [protected] |
Identifier to be matched.
Definition at line 148 of file I3Trigger.h.
Referenced by clear(), compareTo(), getIdentifier(), length(), operator<<(), and setIdentifier().
I3IdentifierStack I3Trigger::identifierStack [protected] |
Identifier stack.
Definition at line 151 of file I3Trigger.h.
Referenced by clear(), compareTo(), getIdentifierStack(), length(), operator<<(), and setIdentifierStack().
simtime_t I3Trigger::insertionTime [protected] |
Time in which the trigger was inserted into I3.
Definition at line 154 of file I3Trigger.h.
Referenced by getInsertionTime(), and setInsertionTime().