From 6ce33fd36eaaebfe3df5d262785ab2fe74499252 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Fri, 25 Jul 2003 02:32:45 +0000 Subject: "" svn path=/trunk/; revision=797 --- externals/grill/flext/source/flclass.h | 130 +++++++++++++++++++-------------- 1 file changed, 77 insertions(+), 53 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 6536590f..689767d2 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -20,6 +20,9 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "flbase.h" #include "flsupport.h" +#include +#include +#include #ifdef _MSC_VER #pragma warning(disable: 4786) @@ -573,33 +576,33 @@ protected: public: - class attritem; + class AttrItem; - class item { + class Item { public: - item(const t_symbol *t,int inl,attritem *a); - virtual ~item(); + Item(const t_symbol *t,int inl,AttrItem *a); + virtual ~Item(); bool IsAttr() const { return attr != NULL; } const t_symbol *tag; int inlet; - attritem *attr; - item *nxt; + AttrItem *attr; + Item *nxt; }; //! This class holds hashed item entries - class itemarr { + class ItemCont { public: - itemarr(); - ~itemarr(); + ItemCont(); + ~ItemCont(); //! Add an entry - void Add(item *it); + void Add(Item *it); //! 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); + //! Find an entry in the Item array + Item *Find(const t_symbol *tag,int inlet = 0) const; //! Create hash table out of the preliminary linked lists void Finalize(); @@ -612,22 +615,22 @@ protected: int Size() const { return bits?1< AttrDataCont; + typedef std::pair AttrDataPair; + + // these outlet functions don't check for thread but send directly to the real-time system void ToSysBang(int n) const; void ToSysFloat(int n,float f) const; @@ -674,11 +698,12 @@ private: public: //! \brief This represents an item of the symbol-bound method list - class binditem: - public item { + class BindItem + :public Item + { public: - binditem(int inlet,const t_symbol *sym,bool (*f)(flext_base *,t_symbol *s,int,t_atom *,void *),pxbnd_object *px); - virtual ~binditem(); + BindItem(int inlet,const t_symbol *sym,bool (*f)(flext_base *,t_symbol *s,int,t_atom *,void *),pxbnd_object *px); + virtual ~BindItem(); bool (*fun)(flext_base *,t_symbol *s,int,t_atom *,void *); pxbnd_object *px; @@ -686,15 +711,15 @@ public: //! @} FLEXT_CLASS - itemarr *ThMeths() { return methhead; } - static itemarr *ClMeths(t_classid c) { return GetClassArr(c,0); } + ItemCont *ThMeths() { return methhead; } + static ItemCont *ClMeths(t_classid c) { return GetClassArr(c,0); } - static void AddMethod(itemarr *ma,int inlet,const char *tag,methfun fun,metharg tp,...); + static void AddMethod(ItemCont *ma,int inlet,const char *tag,methfun fun,metharg tp,...); - itemarr *ThAttrs() { return attrhead; } - static itemarr *ClAttrs(t_classid c) { return GetClassArr(c,1); } + ItemCont *ThAttrs() { return attrhead; } + static ItemCont *ClAttrs(t_classid c) { return GetClassArr(c,1); } - static void AddAttrib(itemarr *aa,itemarr *ma,const char *attr,metharg tp,methfun gfun,methfun sfun); + static void AddAttrib(ItemCont *aa,ItemCont *ma,const char *attr,metharg tp,methfun gfun,methfun sfun); void AddAttrib(const char *attr,metharg tp,methfun gfun,methfun sfun); static void AddAttrib(t_classid c,const char *attr,metharg tp,methfun gfun,methfun sfun); @@ -732,33 +757,32 @@ private: typedef bool (*methfun_4)(flext_base *c,t_any &,t_any &,t_any &,t_any &); typedef bool (*methfun_5)(flext_base *c,t_any &,t_any &,t_any &,t_any &,t_any &); - static itemarr *GetClassArr(t_classid,int ix); + static ItemCont *GetClassArr(t_classid,int ix); - itemarr *methhead,*clmethhead; - itemarr *bindhead; + ItemCont *methhead,*clmethhead; + ItemCont *bindhead; - bool CallMeth(const methitem &m,int argc,const t_atom *argv); + bool CallMeth(const MethItem &m,int argc,const t_atom *argv); bool FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *argv); - bool TryMethTag(const methitem *m,int inlet,const t_symbol *t,int argc,const t_atom *argv); - bool TryMethSym(const methitem *m,int inlet,const t_symbol *t,const t_symbol *s); - bool TryMethAny(const methitem *m,int inlet,const t_symbol *t,const t_symbol *s,int argc,const t_atom *argv); + bool TryMethTag(const MethItem *m,int inlet,const t_symbol *t,int argc,const t_atom *argv); + bool TryMethSym(const MethItem *m,int inlet,const t_symbol *t,const t_symbol *s); + bool TryMethAny(const MethItem *m,int inlet,const t_symbol *t,const t_symbol *s,int argc,const t_atom *argv); - itemarr *attrhead,*clattrhead; + ItemCont *attrhead,*clattrhead; + AttrDataCont *attrdata; - attritem *FindAttrib(const t_symbol *tag,bool get,bool msg = false) const; + AttrItem *FindAttrib(const t_symbol *tag,bool get,bool msg = false) const; static int CheckAttrib(int argc,const t_atom *argv); bool InitAttrib(int argc,const t_atom *argv); bool ListMethods(int inlet = 0) const; bool ListAttrib() const; - bool GetAttrib(attritem *a); - bool GetAttrib(attritem *a,AtomList &l) const; + bool GetAttrib(AttrItem *a); + bool GetAttrib(AttrItem *a,AtomList &l) const; bool SetAttrib(const t_symbol *s,int argc,const t_atom *argv); - bool SetAttrib(attritem *a,int argc,const t_atom *argv); - - void SetAttribSave(attritem *a,bool save); - bool GetAttribSave(attritem *a) const { return a->IsSaved(); } + bool SetAttrib(AttrItem *a,int argc,const t_atom *argv); + bool SetAttrib(AttrItem *a,const AtomList &l) { return SetAttrib(a,l.Count(),l.Atoms()); } static bool cb_ListMethods(flext_base *c,int argc,const t_atom *argv); static bool cb_ListAttrib(flext_base *c) { return c->ListAttrib(); } @@ -839,10 +863,10 @@ private: public: t_object obj; // MUST reside at memory offset 0 flext_base *base; - binditem *item; + BindItem *item; void *data; - void init(flext_base *b,binditem *it,void *d) { base = b; item = it; data = d; } + void init(flext_base *b,BindItem *it,void *d) { base = b; item = it; data = d; } static void px_method(pxbnd_object *c,const t_symbol *s,int argc,t_atom *argv); }; -- cgit v1.2.1