diff options
Diffstat (limited to 'externals/grill/flext/source')
-rw-r--r-- | externals/grill/flext/source/flclass.h | 1 | ||||
-rw-r--r-- | externals/grill/flext/source/flext.h | 4 | ||||
-rw-r--r-- | externals/grill/flext/source/flmap.h | 70 | ||||
-rw-r--r-- | externals/grill/flext/source/flsupport.h | 45 |
4 files changed, 73 insertions, 47 deletions
diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index f49341e1..cd1d4943 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -19,6 +19,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. // include the header file declaring the base classes #include "flbase.h" #include "flsupport.h" +#include "flmap.h" #ifdef _MSC_VER #pragma warning(disable: 4786) diff --git a/externals/grill/flext/source/flext.h b/externals/grill/flext/source/flext.h index 2ce48d5a..4f4f166c 100644 --- a/externals/grill/flext/source/flext.h +++ b/externals/grill/flext/source/flext.h @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net) +Copyright (c) 2001-2004 Thomas Grill (xovo@gmx.net) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -26,7 +26,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define FLEXT_VERSION 406 //! \brief flext version string -#define FLEXT_VERSTR "0.4.6pre" +#define FLEXT_VERSTR "0.4.6" //! @} diff --git a/externals/grill/flext/source/flmap.h b/externals/grill/flext/source/flmap.h new file mode 100644 index 00000000..b32b2652 --- /dev/null +++ b/externals/grill/flext/source/flmap.h @@ -0,0 +1,70 @@ +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2004 Thomas Grill (xovo@gmx.net) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. + +*/ + +/*! \file flmap.h + \brief special map class for all 32-bit key/value-pairs +*/ + +#ifndef __FLMAP_H +#define __FLMAP_H + +#include <map> + +/*! \defgroup FLEXT_SUPPORT Flext support classes + @{ +*/ + +//! Base class for maps +class AnyMap: + public std::map<unsigned int,unsigned int> +{ + typedef std::map<unsigned int,unsigned int> Parent; +public: + AnyMap(); + ~AnyMap(); + iterator find(unsigned int k); + unsigned int &operator [](unsigned int k); + + typedef std::pair<unsigned int,unsigned int> pair; +}; + +//! Specialized map class for any 32-bit key/value types +template <class K,class T> +class DataMap: + public AnyMap +{ +public: + class iterator: + public AnyMap::iterator + { + public: + iterator() {} + iterator(AnyMap::iterator it): AnyMap::iterator(it) {} + + inline K &key() const { return *(K *)&((*this)->first); } + inline T &data() const { return *(T *)&((*this)->second); } + }; + + class pair: + public AnyMap::pair + { + public: + inline K &key() const { return *(K *)&first; } + inline T &data() const { return *(T *)&second; } + }; + + inline iterator find(K k) { return AnyMap::find(*(unsigned int *)&k); } + inline T &operator [](K k) { return *(T *)&(AnyMap::operator [](*(unsigned int *)&k)); } + inline void erase(K k) { AnyMap::erase(*(unsigned int *)&k); } +}; + +//! @} // FLEXT_SUPPORT + +#endif diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index feff1fa3..cd92aaa4 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -17,7 +17,6 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "flstdc.h" #include <new> -#include <map> /*! \defgroup FLEXT_SUPPORT Flext support classes @{ @@ -1149,50 +1148,6 @@ inline bool operator <=(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF inline bool operator >(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) > 0; } inline bool operator >=(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) >= 0; } - -class AnyMap: - public std::map<unsigned int,unsigned int> -{ - typedef std::map<unsigned int,unsigned int> Parent; -public: - AnyMap(); - ~AnyMap(); - iterator find(unsigned int k); - unsigned int &operator [](unsigned int k); - - typedef std::pair<unsigned int,unsigned int> pair; -}; - -template <class K,class T> -class DataMap: - public AnyMap -{ -public: - class iterator: - public AnyMap::iterator - { - public: - iterator() {} - iterator(AnyMap::iterator it): AnyMap::iterator(it) {} - - inline K &key() const { return *(K *)&((*this)->first); } - inline T &data() const { return *(T *)&((*this)->second); } - }; - - class pair: - public AnyMap::pair - { - public: - inline K &key() const { return *(K *)&first; } - inline T &data() const { return *(T *)&second; } - }; - - inline iterator find(K k) { return AnyMap::find(*(unsigned int *)&k); } - inline T &operator [](K k) { return *(T *)&(AnyMap::operator [](*(unsigned int *)&k)); } - inline void erase(K k) { AnyMap::erase(*(unsigned int *)&k); } -}; - - //! @} // FLEXT_SUPPORT #endif |