I3Trigger.cc

Go to the documentation of this file.
00001 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
00002 //
00003 // This program is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU General Public License
00005 // as published by the Free Software Foundation; either version 2
00006 // of the License, or (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00016 //
00017 
00023 #include "I3Trigger.h"
00024 
00025 I3Trigger::I3Trigger() :
00026         insertionTime(0)
00027 {
00028 }
00029 
00030 int I3Trigger::compareTo(const I3Trigger &t) const
00031 {
00032     int cmp = identifier.compareTo(t.identifier);
00033     return (cmp != 0) ? cmp : identifierStack.compareTo(t.identifierStack);
00034 }
00035 
00036 bool I3Trigger::operator <(const I3Trigger &t) const
00037 {
00038     return compareTo(t) < 0;
00039 }
00040 
00041 bool I3Trigger::operator >(const I3Trigger &t) const
00042 {
00043     return compareTo(t) > 0;
00044 }
00045 
00046 bool I3Trigger::operator ==(const I3Trigger &t) const
00047 {
00048     return compareTo(t) == 0;
00049 }
00050 
00051 
00052 void I3Trigger::setIdentifier(const I3Identifier &id)
00053 {
00054     identifier = id;
00055 }
00056 
00057 void I3Trigger::setInsertionTime(simtime_t time)
00058 {
00059     insertionTime = time;
00060 }
00061 
00062 void I3Trigger::setIdentifierStack(I3IdentifierStack &stack)
00063 {
00064     identifierStack = stack;
00065 }
00066 
00067 I3Identifier &I3Trigger::getIdentifier()
00068 {
00069     return identifier;
00070 }
00071 
00072 const I3Identifier &I3Trigger::getIdentifier() const
00073 {
00074     return identifier;
00075 }
00076 
00077 simtime_t I3Trigger::getInsertionTime() const
00078 {
00079     return insertionTime;
00080 }
00081 
00082 void I3Trigger::clear()
00083 {
00084     identifier.clear();
00085     identifierStack.clear();
00086 }
00087 
00088 I3IdentifierStack &I3Trigger::getIdentifierStack()
00089 {
00090     return identifierStack;
00091 }
00092 
00093 const I3IdentifierStack &I3Trigger::getIdentifierStack() const
00094 {
00095     return identifierStack;
00096 }
00097 
00098 int I3Trigger::length() const {
00099     /* insertionTime is an internal variable and doesn't count as part of the message */
00100     return identifier.length() + identifierStack.length();
00101 }
00102 
00103 std::ostream& operator<<(std::ostream& os, const I3Trigger &t)
00104 {
00105     os << "(" << t.identifier << ", {" << t.identifierStack << "})";
00106     return os;
00107 }
00108 
Generated on Wed May 26 16:21:14 2010 for OverSim by  doxygen 1.6.3