00001 // -*- C++ -*- 00002 /***************************************************************************** 00003 * 00004 * |_|_|_ |_|_ |_ |_|_|_ |_ C O M M U N I C A T I O N 00005 * |_ |_ |_ |_ |_ |_ N E T W O R K S 00006 * |_ |_ |_ |_ |_ |_ C L A S S 00007 * |_|_|_ |_ |_|_ |_|_|_ |_|_|_|_ L I B R A R Y 00008 * 00009 * $Id: EventList.h,v 1.4 2002/02/01 08:46:04 spee Exp $ 00010 * 00011 * CNClass: CNEventList --- CNEvent list for scheduler 00012 * 00013 ***************************************************************************** 00014 * Copyright (C) 1992-2002 Communication Networks 00015 * Aachen University of Technology 00016 * D-52056 Aachen 00017 * Germany 00018 * Email: cncl-adm@comnets.rwth-aachen.de 00019 ***************************************************************************** 00020 * This file is part of the CN class library. All files marked with 00021 * this header are free software; you can redistribute it and/or modify 00022 * it under the terms of the GNU Library General Public License as 00023 * published by the Free Software Foundation; either version 2 of the 00024 * License, or (at your option) any later version. This library is 00025 * distributed in the hope that it will be useful, but WITHOUT ANY 00026 * WARRANTY; without even the implied warranty of MERCHANTABILITY or 00027 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00028 * License for more details. You should have received a copy of the GNU 00029 * Library General Public License along with this library; if not, write 00030 * to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, 00031 * USA. 00032 *****************************************************************************/ 00033 00034 #ifndef __EventList_h 00035 #define __EventList_h 00036 00037 00038 #include <CNCL/Class.h> 00039 #include <CNCL/Param.h> 00040 00041 #include <CNCL/Object.h> // Base class 00042 00043 #include <CNCL/DLList.h> 00044 #include <CNCL/Event.h> 00045 00046 extern CNClassDesc CN_EVENTLIST; // CNClass CNEventList description 00047 00048 00054 class CNEventList : public CNObject 00055 { 00056 friend class CNEventLIterator; 00057 00058 public: 00060 void add_event(CNEvent *ev); 00062 void delete_event(CNEventID id, bool with_obj=FALSE); 00066 void delete_events(CNEventHandler *evh, bool to, bool with_obj = FALSE); 00068 void delete_all(); 00070 CNEvent *next_event(); 00073 CNEvent *peek_event(); 00076 CNEvent *peek_event(CNEventID id); 00077 00078 private: 00079 CNDLList ev_list; 00080 00081 /****** Constructors ******************************************************/ 00082 public: 00084 CNEventList() {} 00086 CNEventList(CNParam *) {} 00087 00088 /****** Member functions required by CNCL *********************************/ 00089 public: 00090 virtual CNClassDesc class_desc() const // CNClass description 00091 { 00092 return CN_EVENTLIST; 00093 }; 00094 00096 virtual bool is_a(CNClassDesc desc) const // Type checking 00097 { 00098 return desc == CN_EVENTLIST ? TRUE : CNObject::is_a(desc); 00099 }; 00100 00102 static CNEventList *cast_from_object(CNObject *obj) 00103 { 00104 # ifdef NO_TYPE_CHECK 00105 return (CNEventList *)obj; 00106 # else 00107 return (CNEventList *)( !obj || obj->is_a(CN_EVENTLIST) 00108 ? obj : fatal_type(obj->class_desc(), CN_EVENTLIST) ); 00109 # endif 00110 } 00111 00113 static CNObject *new_object(CNParam *param = NIL) 00114 { return param ? new CNEventList(param) : new CNEventList; } 00115 00117 virtual void print(ostream &strm = cout) const; 00119 virtual void dump (ostream &strm = cout) const; 00120 }; 00121 00122 00123 #endif
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001