diff options
author | Georg Holzmann <grholzi@users.sourceforge.net> | 2005-11-03 20:40:40 +0000 |
---|---|---|
committer | Georg Holzmann <grholzi@users.sourceforge.net> | 2005-11-03 20:40:40 +0000 |
commit | 406758342ee046707e5426f804c7b381a0728335 (patch) | |
tree | 7e58947fa006199f05efa8fb5cf6cb932cd51586 /PDContainer/src/h_multiset.cpp | |
parent | 9ca96a7b406cde99fabe2956090fef0ea820c0e2 (diff) |
additional methods: [getall(, [keys(, [values(
svn path=/trunk/externals/grh/; revision=3832
Diffstat (limited to 'PDContainer/src/h_multiset.cpp')
-rwxr-xr-x | PDContainer/src/h_multiset.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/PDContainer/src/h_multiset.cpp b/PDContainer/src/h_multiset.cpp index 0886a8b..f6c1ea3 100755 --- a/PDContainer/src/h_multiset.cpp +++ b/PDContainer/src/h_multiset.cpp @@ -82,6 +82,30 @@ static void h_multiset_get_namespace(t_h_multiset *x) post("h_multiset current namespace: %s",x->hmultiset->getNamespace().c_str()); } +static void h_multiset_getall(t_h_multiset *x) +{ + multiset<Element>::iterator iter = x->hmultiset->getAll().begin(); + + while(iter != x->hmultiset->getAll().end()) + { + Element output = *iter; + + if(output.getLength() == 1) // symbol or float + { + if (output.getAtom()[0].a_type == A_FLOAT) + outlet_float(x->out0, output.getAtom()[0].a_w.w_float); + if (output.getAtom()[0].a_type == A_SYMBOL) + outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol); + if (output.getAtom()[0].a_type == A_POINTER) + outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer); + } + if(output.getLength() > 1) // list + outlet_list(x->out0,&s_list,output.getLength(),output.getAtom()); + + iter++; + } +} + static void h_multiset_print(t_h_multiset *x) { x->hmultiset->printAll(); @@ -200,6 +224,8 @@ void h_multiset_setup(void) gensym("namespace"), A_DEFSYMBOL , 0); class_addmethod(h_multiset_class, (t_method)h_multiset_get_namespace, gensym("getnamespace"), A_DEFFLOAT, 0); + class_addmethod(h_multiset_class, (t_method)h_multiset_getall, + gensym("getall"), A_DEFFLOAT, 0); class_addmethod(h_multiset_class, (t_method)h_multiset_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_multiset_class, (t_method)h_multiset_clear, |