From 74e28b058aaf629d94ad7d44a9add3062e89441d Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sun, 22 Feb 2004 03:34:00 +0000 Subject: "" svn path=/trunk/; revision=1326 --- externals/grill/flext/source/flclass.h | 102 +++++++++++++++------------------ 1 file changed, 47 insertions(+), 55 deletions(-) (limited to 'externals/grill/flext/source/flclass.h') diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index 721c3f5f..18af3baa 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.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. @@ -23,6 +23,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include #include #include +#include #ifdef _MSC_VER #pragma warning(disable: 4786) @@ -600,67 +601,56 @@ protected: class AttrItem; - class Item: - public flext_root + class Item { public: - Item(const t_symbol *t,int inl,AttrItem *a); - virtual ~Item(); + Item(AttrItem *a): attr(a) {} + virtual ~Item() {} bool IsAttr() const { return attr != NULL; } - const t_symbol *tag; - int inlet; AttrItem *attr; - Item *nxt; }; + typedef std::list ItemList; + + typedef std::map ItemSet; + typedef std::vector ItemVec; + //! This class holds hashed item entries class ItemCont: - public flext_root + private ItemVec { public: - ItemCont(); - ~ItemCont(); + typedef ItemVec::iterator iterator; + typedef ItemVec::const_iterator const_iterator; + + ItemCont(): members(0) {} + + bool Contained(int i) const { return i+1 < (int)size(); } //! Add an entry - void Add(Item *it); + void Add(Item *it,const t_symbol *tag,int inlet = 0); //! Remove an entry - bool Remove(Item *it); - //! Find an entry in the Item array - Item *Find(const t_symbol *tag,int inlet = 0) const; + bool Remove(Item *it,const t_symbol *tag,int inlet = 0); + //! Find an entry list in the Item array + ItemList *FindList(const t_symbol *tag,int inlet = 0); + //! Get list for an inlet + ItemSet &GetInlet(int inlet = 0) { return (*this)[inlet+1]; } - //! Create hash table out of the preliminary linked lists - void Finalize(); + //! Get counter for total members (for index of new item) + int Members() const { return members; } - //! Get first element - Item *First() { return !Ready()?arr[0]:NULL; } - //! Get last element - Item *Last() { return !Ready()?arr[1]:NULL; } - - //! Query whether the array has been finalized - bool Ready() const { return bits >= 0; } - //! Number of items in the array - int Count() const { return cnt; } - //! Number of array slots (0 if not finalized) - int Size() const { return bits?1<