From 1d6d1e8c73193f57a9c98387ea42eb91eb4d21d1 Mon Sep 17 00:00:00 2001 From: Georg Holzmann Date: Fri, 21 Oct 2005 11:56:32 +0000 Subject: only moving to a new directory svn path=/trunk/externals/grh/; revision=3740 --- PDContainer/include/HSet.h | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100755 PDContainer/include/HSet.h (limited to 'PDContainer/include/HSet.h') 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 + +using std::set; + +//--------------------------------------------------- +/* this is the class of the set + */ +class HSet : +public SimpleBase< set, set::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__ -- cgit v1.2.1