diff options
author | Georg Holzmann <grholzi@users.sourceforge.net> | 2005-10-21 11:56:32 +0000 |
---|---|---|
committer | Georg Holzmann <grholzi@users.sourceforge.net> | 2005-10-21 11:56:32 +0000 |
commit | 1d6d1e8c73193f57a9c98387ea42eb91eb4d21d1 (patch) | |
tree | 8d0853fe30b12c73774c786f02f3d3011b147d4c /PDContainer/include/HSet.h | |
parent | df8ac7c52ff0dfc8e2ba828c4226ed34b0e9ebfc (diff) |
only moving to a new directory
svn path=/trunk/externals/grh/; revision=3740
Diffstat (limited to 'PDContainer/include/HSet.h')
-rwxr-xr-x | PDContainer/include/HSet.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/PDContainer/include/HSet.h b/PDContainer/include/HSet.h new file mode 100755 index 0000000..231b909 --- /dev/null +++ b/PDContainer/include/HSet.h @@ -0,0 +1,82 @@ +// *********************(c)*2004*********************> +// -holzilib--holzilib--holzilib--holzilib--holzilib-> +// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++> +// +// PDContainer: +// this is a port of the containers from the C++ STL +// (Standard Template Library) +// for usage see the documentation and PD help files +// for license see readme.txt +// +// HSet.h + + +#ifndef _h_set_h__ +#define _h_set_h__ + +#include "include/SimpleBase.h" +#include <set> + +using std::set; + +//--------------------------------------------------- +/* this is the class of the set + */ +class HSet : +public SimpleBase< set<Element>, set<Element>::iterator > +{ + + private: + + /* Copy Construction is not allowed + */ + HSet(const HSet &src) + { } + + /* assignement operator is not allowed + */ + const HSet& operator = (const HSet&) + { return *this; } + + public: + + /* Constructor + * no namespace + */ + HSet() + { dataname_ = "h_set"; } + + /* Constructor + * with a namespace + */ + HSet(string h_namespace) + { + dataname_ = "h_set"; + setNamespace(h_namespace); + } + + /* Destructor + */ + virtual ~HSet() { } + + /* add an element + */ + virtual void add(Element key) + { data_[h_namespace_].insert(key); } + + /* look if the element is set + * returns 1 if it is set + * 0 if it isn't set + */ + virtual int get(const Element &key) const + { return (data_[h_namespace_].find(key) + != data_[h_namespace_].end()); } + + /* removes an element from the container + */ + virtual void remove(const Element &key) const + { data_[h_namespace_].erase(key); } +}; + + +#endif // _h_set_h__ |