diff options
Diffstat (limited to 'PDContainer/src')
-rwxr-xr-x | PDContainer/src/h_deque.cpp | 26 | ||||
-rwxr-xr-x | PDContainer/src/h_list.cpp | 26 | ||||
-rwxr-xr-x | PDContainer/src/h_map.cpp | 52 | ||||
-rwxr-xr-x | PDContainer/src/h_multimap.cpp | 52 | ||||
-rwxr-xr-x | PDContainer/src/h_multiset.cpp | 26 | ||||
-rwxr-xr-x | PDContainer/src/h_set.cpp | 26 | ||||
-rwxr-xr-x | PDContainer/src/h_vector.cpp | 26 |
7 files changed, 234 insertions, 0 deletions
diff --git a/PDContainer/src/h_deque.cpp b/PDContainer/src/h_deque.cpp index 6246a51..989ca51 100755 --- a/PDContainer/src/h_deque.cpp +++ b/PDContainer/src/h_deque.cpp @@ -343,6 +343,30 @@ static void h_deque_get_namespace(t_h_deque *x) post("h_deque current namespace: %s",x->hdeque->getNamespace().c_str()); } +static void h_deque_getall(t_h_deque *x) +{ + deque<Element>::iterator iter = x->hdeque->getAll().begin(); + + while(iter != x->hdeque->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_deque_print(t_h_deque *x) { x->hdeque->printAllIndex(); @@ -554,6 +578,8 @@ void h_deque_setup(void) gensym("namespace"), A_DEFSYMBOL , 0); class_addmethod(h_deque_class, (t_method)h_deque_get_namespace, gensym("getnamespace"), A_DEFFLOAT, 0); + class_addmethod(h_deque_class, (t_method)h_deque_getall, + gensym("getall"), A_DEFFLOAT, 0); class_addmethod(h_deque_class, (t_method)h_deque_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_deque_class, (t_method)h_deque_clear, diff --git a/PDContainer/src/h_list.cpp b/PDContainer/src/h_list.cpp index bbe9b68..e44e2a5 100755 --- a/PDContainer/src/h_list.cpp +++ b/PDContainer/src/h_list.cpp @@ -279,6 +279,30 @@ static void h_list_clear_all(t_h_list *x) x->hlist->clearAll(); } +static void h_list_getall(t_h_list *x) +{ + list<Element>::iterator iter = x->hlist->getAll().begin(); + + while(iter != x->hlist->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_list_print(t_h_list *x) { x->hlist->printAllIndex(); @@ -426,6 +450,8 @@ void h_list_setup(void) gensym("clear"), A_DEFFLOAT, 0); class_addmethod(h_list_class, (t_method)h_list_clear_all, gensym("clearall"), A_DEFFLOAT, 0); + class_addmethod(h_list_class, (t_method)h_list_getall, + gensym("getall"), A_DEFFLOAT, 0); class_addmethod(h_list_class, (t_method)h_list_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_list_class, (t_method)h_list_save, diff --git a/PDContainer/src/h_map.cpp b/PDContainer/src/h_map.cpp index 11ce59e..4e5beeb 100755 --- a/PDContainer/src/h_map.cpp +++ b/PDContainer/src/h_map.cpp @@ -182,6 +182,54 @@ static void h_map_get_namespace(t_h_map *x) post("h_map current namespace: %s",x->hmap->getNamespace().c_str()); } +static void h_map_keys(t_h_map *x) +{ + map<Element,Element>::iterator iter = x->hmap->getAll().begin(); + + while(iter != x->hmap->getAll().end()) + { + Element output = (*iter).first; + + 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_map_values(t_h_map *x) +{ + map<Element,Element>::iterator iter = x->hmap->getAll().begin(); + + while(iter != x->hmap->getAll().end()) + { + Element output = (*iter).second; + + 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_map_print(t_h_map *x) { x->hmap->printAll(); @@ -314,6 +362,10 @@ void h_map_setup(void) gensym("namespace"), A_DEFSYMBOL , 0); class_addmethod(h_map_class, (t_method)h_map_get_namespace, gensym("getnamespace"), A_DEFFLOAT, 0); + class_addmethod(h_map_class, (t_method)h_map_keys, + gensym("keys"), A_DEFFLOAT, 0); + class_addmethod(h_map_class, (t_method)h_map_values, + gensym("values"), A_DEFFLOAT, 0); class_addmethod(h_map_class, (t_method)h_map_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_map_class, (t_method)h_map_clear, diff --git a/PDContainer/src/h_multimap.cpp b/PDContainer/src/h_multimap.cpp index 8449fd9..9f5de2e 100755 --- a/PDContainer/src/h_multimap.cpp +++ b/PDContainer/src/h_multimap.cpp @@ -179,6 +179,54 @@ static void h_multimap_get_namespace(t_h_multimap *x) post("h_multimap current namespace: %s",x->hmultimap->getNamespace().c_str()); } +static void h_multimap_keys(t_h_multimap *x) +{ + multimap<Element,Element>::iterator iter = x->hmultimap->getAll().begin(); + + while(iter != x->hmultimap->getAll().end()) + { + Element output = (*iter).first; + + 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_multimap_values(t_h_multimap *x) +{ + multimap<Element,Element>::iterator iter = x->hmultimap->getAll().begin(); + + while(iter != x->hmultimap->getAll().end()) + { + Element output = (*iter).second; + + 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_multimap_print(t_h_multimap *x) { x->hmultimap->printAll(); @@ -310,6 +358,10 @@ void h_multimap_setup(void) gensym("namespace"), A_DEFSYMBOL , 0); class_addmethod(h_multimap_class, (t_method)h_multimap_get_namespace, gensym("getnamespace"), A_DEFFLOAT, 0); + class_addmethod(h_multimap_class, (t_method)h_multimap_keys, + gensym("keys"), A_DEFFLOAT, 0); + class_addmethod(h_multimap_class, (t_method)h_multimap_values, + gensym("values"), A_DEFFLOAT, 0); class_addmethod(h_multimap_class, (t_method)h_multimap_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_multimap_class, (t_method)h_multimap_clear, 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, 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<Element>::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, diff --git a/PDContainer/src/h_vector.cpp b/PDContainer/src/h_vector.cpp index d3f76a3..df29ccf 100755 --- a/PDContainer/src/h_vector.cpp +++ b/PDContainer/src/h_vector.cpp @@ -261,6 +261,30 @@ static void h_vector_get_namespace(t_h_vector *x) post("h_vector current namespace: %s",x->hvector->getNamespace().c_str()); } +static void h_vector_getall(t_h_vector *x) +{ + vector<Element>::iterator iter = x->hvector->getAll().begin(); + + while(iter != x->hvector->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_vector_print(t_h_vector *x) { x->hvector->printAllIndex(); @@ -465,6 +489,8 @@ void h_vector_setup(void) class_addmethod(h_vector_class, (t_method)h_vector_get_namespace, gensym("getnamespace"), A_DEFFLOAT, 0); class_addmethod(h_vector_class, (t_method)h_vector_print, + gensym("getall"), A_DEFFLOAT, 0); + class_addmethod(h_vector_class, (t_method)h_vector_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_vector_class, (t_method)h_vector_clear, gensym("clear"), A_DEFFLOAT, 0); |