00001 /* 00002 * Copyright (C) 2004 Andrew Sutton 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to: 00016 * 00017 * The Free Software Foundation, Inc. 00018 * 59 Temple Place, Suite 330 00019 * Boston, MA 02111-1307 USA 00020 * 00021 * Contact: 00022 * Andrew Sutton asutton@cs.kent.edu 00023 */ 00024 00025 #ifndef OMF_SET_HPP 00026 #define OMF_SET_HPP 00027 00028 // std includes 00029 #include <map> 00030 00031 // OMF includes 00032 #include <OMF/Container.hpp> 00033 00034 namespace OMF 00035 { 00047 class Set : public Container 00048 { 00049 static const std::string &_typeCode(); 00050 00051 typedef std::map<unsigned, OMF::Object *> Type; 00052 public: 00053 Set(); 00054 Set(const Set &value); 00055 virtual ~Set(); 00056 00057 const Set &operator =(const Set &value); 00058 00059 virtual Iterator begin(); 00060 virtual Iterator end(); 00061 virtual Iterator find(OMF::Object *obj); 00062 virtual Iterator find(bool value); 00063 virtual Iterator find(int value); 00064 virtual Iterator find(const char *value); 00065 00066 virtual ConstIterator begin() const; 00067 virtual ConstIterator end() const; 00068 virtual ConstIterator find(Object *obj) const; 00069 virtual ConstIterator find(bool value) const; 00070 virtual ConstIterator find(int value) const; 00071 virtual ConstIterator find(const char *value) const; 00072 00073 Iterator insert(Object *obj); 00074 Iterator insert(bool value); 00075 Iterator insert(int value); 00076 Iterator insert(const char *value); 00077 00078 void erase(Iterator i); 00079 void erase(Object *obj); 00080 void erase(bool value); 00081 void erase(int value); 00082 void erase(const char *value); 00083 00084 virtual bool empty() const; 00085 virtual size_t size() const; 00086 00087 virtual void add(Object *obj); 00088 virtual void add(bool value); 00089 virtual void add(int value); 00090 virtual void add(const char *value); 00091 00092 virtual void remove(OMF::Object *obj); 00093 virtual void remove(bool value); 00094 virtual void remove(int value); 00095 virtual void remove(const char *value); 00096 00097 virtual void clear(); 00098 00099 virtual const std::string &typeCode() const; 00100 00101 private: 00102 Type _data; 00103 }; 00104 } 00105 00106 #endif