Update of /cvsroot/pure-data/externals/grill/flext/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22965/source
Modified Files: flclass.h flext.h flsupport.h Added Files: flmap.h Log Message: ""
--- NEW FILE: flmap.h --- /*
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
Index: flext.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flext.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** flext.h 27 Dec 2003 03:32:55 -0000 1.19 --- flext.h 23 Apr 2004 22:14:14 -0000 1.20 *************** *** 3,7 **** flext - C++ layer for Max/MSP and pd (pure data) externals
! Copyright (c) 2001-2003 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. --- 3,7 ---- 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. *************** *** 27,31 ****
//! \brief flext version string ! #define FLEXT_VERSTR "0.4.6pre"
//! @} --- 27,31 ----
//! \brief flext version string ! #define FLEXT_VERSTR "0.4.6"
//! @}
Index: flclass.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flclass.h,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** flclass.h 20 Apr 2004 02:33:04 -0000 1.43 --- flclass.h 23 Apr 2004 22:14:12 -0000 1.44 *************** *** 20,23 **** --- 20,24 ---- #include "flbase.h" #include "flsupport.h" + #include "flmap.h"
#ifdef _MSC_VER
Index: flsupport.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsupport.h,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** flsupport.h 23 Apr 2004 02:32:55 -0000 1.67 --- flsupport.h 23 Apr 2004 22:14:14 -0000 1.68 *************** *** 18,22 **** #include "flstdc.h" #include <new> - #include <map>
/*! \defgroup FLEXT_SUPPORT Flext support classes --- 18,21 ---- *************** *** 1150,1197 **** 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
--- 1149,1152 ----