From 406758342ee046707e5426f804c7b381a0728335 Mon Sep 17 00:00:00 2001 From: Georg Holzmann Date: Thu, 3 Nov 2005 20:40:40 +0000 Subject: additional methods: [getall(, [keys(, [values( svn path=/trunk/externals/grh/; revision=3832 --- PDContainer/src/h_set.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'PDContainer/src/h_set.cpp') diff --git a/PDContainer/src/h_set.cpp b/PDContainer/src/h_set.cpp index 2e97cef..712817b 100755 --- a/PDContainer/src/h_set.cpp +++ b/PDContainer/src/h_set.cpp @@ -82,6 +82,30 @@ static void h_set_get_namespace(t_h_set *x) post("h_set current namespace: %s",x->hset->getNamespace().c_str()); } +static void h_set_getall(t_h_set *x) +{ + set::iterator iter = x->hset->getAll().begin(); + + while(iter != x->hset->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_set_print(t_h_set *x) { x->hset->printAll(); @@ -200,6 +224,8 @@ void h_set_setup(void) gensym("namespace"), A_DEFSYMBOL , 0); class_addmethod(h_set_class, (t_method)h_set_get_namespace, gensym("getnamespace"), A_DEFFLOAT, 0); + class_addmethod(h_set_class, (t_method)h_set_getall, + gensym("getall"), A_DEFFLOAT, 0); class_addmethod(h_set_class, (t_method)h_set_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_set_class, (t_method)h_set_clear, -- cgit v1.2.1