00001 /* ********* 00002 * 00003 * This file is part of: 00004 * NePSing, Network Protocol Simulator next generation 00005 * 00006 * Copyright (C) 2004 Tommaso Pecorella <tpecorella@mac.com> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 * 00022 ********* */ 00023 00031 #ifndef ___DEEVENT_H___ 00032 #define ___DEEVENT_H___ 00033 00034 #include "detime.h" 00035 00037 00097 class DEEvent 00098 { 00099 protected: 00100 // Event occurrence time 00101 DETime Time; 00102 00103 // prints the event on os 00104 virtual void print(ostream &os) const; 00105 00106 public: 00107 00109 00112 DEEvent(); 00113 virtual ~DEEvent() {}; 00114 00116 00139 virtual void Handler() {}; 00140 00142 DETime getTime() { return Time; }; 00143 00145 void setTime(const DETime& T) { Time = T; }; 00146 00148 void addTime(const DETime& T) { Time += T; }; 00149 00151 bool IsInOverFlow() const { return Time.IsInOverFlow(); }; 00152 00154 virtual const char *Type() const; 00155 00157 00158 friend ostream& operator<< ( ostream& os, const DEEvent& ev ) 00159 { 00160 ev.print(os); 00161 return os; 00162 }; 00163 00164 // Returns true if A is happening before B 00165 /* 00166 \internal 00167 \relates DEEvent 00168 */ 00169 friend int EvBefore(const DEEvent *A, const DEEvent *B) { return B->Time < A->Time; }; 00170 00172 00191 virtual bool EvCompareTarget(void *target); 00192 00193 // bool operator < (const DEEvent &A) const 00194 // { 00195 // return Time < A.Time; 00196 // }; 00197 // friend int operator == (const DEEvent &A, const DEEvent &B) 00198 // { 00199 // return B.Time == A.Time; 00200 // }; 00201 }; 00202 00203 #endif 00204 00205 00206 /* 00207 00208 $Log: deevent.h,v $ 00209 Revision 1.4 2004/12/17 10:10:27 pecos 00210 No log message. 00211 00212 Revision 1.3 2004/12/12 23:44:44 pecos 00213 Added Copyright message - LGPL 00214 00215 Revision 1.2 2004/12/11 23:53:24 pecos 00216 Added DoxyGen comments 00217 00218 Revision 1.1.1.1 2004/07/08 16:59:33 pecos 00219 NePSing framework 00220 00221 Revision 1.2 2000/10/22 19:46:14 pecos 00222 virual destructor 00223 00224 Revision 1.1.1.1 1999/05/24 15:59:57 inesis 00225 INeSiS Project 00226 00227 Revision 1.1.1.1 1999/05/24 15:17:20 inesis 00228 INeSiS Project 00229 00230 Revision 1.2 1999/02/12 14:12:22 pecos 00231 *** empty log message *** 00232 00233 Revision 1.1 1999/01/02 09:09:22 nanni 00234 *** empty log message *** 00235 00236 00237 */