aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flitem.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2005-03-15 04:56:36 +0000
committerThomas Grill <xovo@users.sourceforge.net>2005-03-15 04:56:36 +0000
commit31a2d9dcc2b3a519033918e180f81c4e7b9f8e7e (patch)
tree7eae5d3f1e302843147fdc6bc13c99e101906d32 /externals/grill/flext/source/flitem.cpp
parent3e0446e7fda10c3d85a628b8c1effaa5bf7f5529 (diff)
new data type flext::AtomListStatic using pre-allocated space if possible
fixes for OSX replaced memory-intensive STL maps by custom-made vector/map-container fix for gcc strangeness no more static assignment of symbols (problems with Metrowerks) small fix for gcc fixed bugs in SIMD code for non-power-of-2 lengths fixes for attribute editor (to deal with large dialogs) svn path=/trunk/; revision=2628
Diffstat (limited to 'externals/grill/flext/source/flitem.cpp')
-rwxr-xr-xexternals/grill/flext/source/flitem.cpp47
1 files changed, 18 insertions, 29 deletions
diff --git a/externals/grill/flext/source/flitem.cpp b/externals/grill/flext/source/flitem.cpp
index 92ce01cd..eb307d09 100755
--- a/externals/grill/flext/source/flitem.cpp
+++ b/externals/grill/flext/source/flitem.cpp
@@ -21,6 +21,7 @@ flext_base::Item::~Item()
if(nxt) delete nxt;
}
+/*
flext_base::ItemSet::ItemSet() {}
flext_base::ItemSet::~ItemSet()
@@ -28,6 +29,7 @@ flext_base::ItemSet::~ItemSet()
for(iterator it = begin(); it != end(); ++it)
if(it.data()) delete it.data();
}
+*/
flext_base::ItemCont::ItemCont():
members(0),memsize(0),size(0),cont(NULL)
@@ -64,9 +66,9 @@ void flext_base::ItemCont::Add(Item *item,const t_symbol *tag,int inlet)
if(!Contained(inlet)) Resize(inlet+2);
ItemSet &set = GetInlet(inlet);
- Item *&lst = set[tag];
+ Item *lst = set.find(tag);
if(!lst)
- lst = item;
+ set.insert(tag,lst = item);
else
for(;;)
if(!lst->nxt) { lst->nxt = item; break; }
@@ -80,17 +82,15 @@ bool flext_base::ItemCont::Remove(Item *item,const t_symbol *tag,int inlet,bool
if(Contained(inlet)) {
ItemSet &set = GetInlet(inlet);
- ItemSet::iterator it = set.find(tag);
- if(it != set.end()) {
- for(Item *lit = it.data(),*prv = NULL; lit; prv = lit,lit = lit->nxt) {
- if(lit == item) {
- if(prv) prv->nxt = lit->nxt;
- else it.data() = lit->nxt;
-
- lit->nxt = NULL;
- if(free) delete lit;
- return true;
- }
+ Item *lit = set.find(tag);
+ for(Item *prv = NULL; lit; prv = lit,lit = lit->nxt) {
+ if(lit == item) {
+ if(prv) prv->nxt = lit->nxt;
+ else set.insert(tag,lit->nxt);
+
+ lit->nxt = NULL;
+ if(free) delete lit;
+ return true;
}
}
}
@@ -100,30 +100,19 @@ bool flext_base::ItemCont::Remove(Item *item,const t_symbol *tag,int inlet,bool
flext_base::Item *flext_base::ItemCont::FindList(const t_symbol *tag,int inlet)
{
FLEXT_ASSERT(tag);
-
- if(Contained(inlet)) {
- ItemSet &ai = GetInlet(inlet);
- ItemSet::iterator as = ai.find(tag);
- if(as != ai.end()) return as.data();
- }
- return NULL;
+ return Contained(inlet)?GetInlet(inlet).find(tag):NULL;
}
// --- class item lists (methods and attributes) ----------------
-typedef DataMap<flext_base::t_classid,flext_base::ItemCont *> ClassMap;
+typedef TableMap<flext_base::t_classid,flext_base::ItemCont,64> ClassMap;
static ClassMap classarr[2];
flext_base::ItemCont *flext_base::GetClassArr(t_classid c,int ix)
{
ClassMap &map = classarr[ix];
- ClassMap::iterator it = map.find(c);
- if(it == map.end()) {
- ItemCont *cont = new ItemCont;
- map[c] = cont;
- return cont;
- }
- else
- return it.data();
+ ItemCont *cont = map.find(c);
+ if(!cont) map.insert(c,cont = new ItemCont);
+ return cont;
}