00001 /*************************************************************************** 00002 collection.h - Definition of Stack template class. 00003 ------------------- 00004 begin : June 21 2002 00005 copyright : (C) 2003 by Vojtìch Toman 00006 email : vtoman@lit.cz 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00026 #ifndef COLLECTION_H 00027 #define COLLECTION_H 00028 00029 #include "defs.h" 00030 00036 template<class T_> class Collection 00037 { 00038 public: 00044 Collection(void) { init_(); } 00045 00053 virtual void clear(void) = 0; 00054 00060 virtual size_t count(void) { return cnt_; } 00061 00068 virtual bool isEmpty(void) { return cnt_ == 0; } 00069 00079 virtual void setAutoDelete(bool ad) { autoDelete_ = ad; } 00080 00081 00082 00083 00084 protected: 00086 size_t cnt_; 00087 00089 bool autoDelete_; 00090 00091 00093 virtual void init_(void) 00094 { 00095 cnt_ = 0; 00096 autoDelete_ = false; 00097 } 00098 00099 }; //Collection 00100 00101 #endif //COLLECTION_H