[Gridflow-cvs] [svn] commit: r5888 - in /trunk: doc/flow_classes/attr-help.pd src/classes2.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Sat Jul 31 20:12:53 EDT 2010


Author: matju
Date: Sat Jul 31 20:12:53 2010
New Revision: 5888

Log:
support multiple arguments in each attr in [attr]

Modified:
    trunk/doc/flow_classes/attr-help.pd
    trunk/src/classes2.cxx

Modified: trunk/doc/flow_classes/attr-help.pd
==============================================================================
--- trunk/doc/flow_classes/attr-help.pd (original)
+++ trunk/doc/flow_classes/attr-help.pd Sat Jul 31 20:12:53 2010
@@ -1,11 +1,9 @@
-#N canvas 473 114 632 409 10;
+#N canvas 473 114 632 430 10;
 #X obj 0 0 doc_h;
-#X obj 0 374 doc_f;
-#X text 255 89 for future use;
 #X obj 174 72 attr;
 #X obj 14 322 doc_oo 0;
 #X obj 14 203 doc_ii 0;
-#X obj 3 354 doc_also;
+#X obj 3 376 doc_also;
 #X obj 3 131 doc_c 0;
 #X obj 3 171 doc_i 1;
 #X obj 3 292 doc_o 1;
@@ -16,20 +14,27 @@
 ;
 #X text 232 225 with \$1 : get one specific attribute (and send to
 outlet 0 as well);
-#X obj 103 354 args;
-#X obj 139 354 setargs;
-#X obj 97 322 doc_m o0 <any>;
-#X text 232 322 an attribute.;
+#X obj 103 376 args;
+#X obj 139 376 setargs;
+#X obj 97 344 doc_m o0 <any>;
+#X text 232 344 an attribute.;
 #X msg 145 39 get;
 #X obj 174 91 print;
 #X msg 174 39 pruneau 2 3 \, cannelle 5 7 11 13 \, perline coucou \,
 tibrin rigodon melodie;
-#X connect 3 0 20 0;
-#X connect 6 1 15 0;
-#X connect 6 1 16 0;
+#X msg 49 55 get tibrin;
+#X obj 97 322 doc_m o0 bang;
+#X obj 0 396 doc_f;
+#X text 232 322 in get \$1 \, no such attribute was found.;
+#X text 161 150 creation arguments will be added eventually.;
+#X connect 1 0 18 0;
+#X connect 4 1 13 0;
+#X connect 4 1 14 0;
+#X connect 8 1 9 0;
 #X connect 10 1 11 0;
-#X connect 12 1 13 0;
-#X connect 12 1 14 0;
-#X connect 17 1 18 0;
-#X connect 19 0 3 0;
-#X connect 21 0 3 0;
+#X connect 10 1 12 0;
+#X connect 15 1 16 0;
+#X connect 17 0 1 0;
+#X connect 19 0 1 0;
+#X connect 20 0 1 0;
+#X connect 21 1 23 0;

Modified: trunk/src/classes2.cxx
==============================================================================
--- trunk/src/classes2.cxx (original)
+++ trunk/src/classes2.cxx Sat Jul 31 20:12:53 2010
@@ -214,20 +214,24 @@
 \end class {install("setargs",1,1);}
 
 \class GFAttr : FObject {
-	std::map<t_symbol *,t_atom2> table;
+	std::map<t_symbol *,std::vector<t_atom2> > table;
 	\constructor () {}
+	void outlet_entry(const typeof(table.begin()) &f) {
+		outlet_anything(outlets[0],f->first,f->second.size(),f->second.data());
+	}
 	\decl 0 get (t_symbol *s=0) {
 		if (s) {
 			typeof(table.begin()) f = table.find(s);
-			if (f!=table.end()) outlet_anything(outlets[0],s,1,&f->second);
+			if (f!=table.end()) outlet_entry(f);
 		} else {
-			foreach(it,table) outlet_anything(outlets[0],it->first,1,&it->second);
+			foreach(it,table) outlet_entry(it);
 		}
 	}
 	\decl 0 remove (t_symbol *s=0) {if (s) table.erase(s); else table.clear();}
-	\decl void anything (string s, t_atom2 a) {
-		t_symbol *sel = gensym(s.data()+3);
-		table[sel]=a;
+	\decl void anything (...) {
+		t_symbol *sel = (t_symbol *)argv[0]; sel = gensym(sel->s_name+3);
+		table[sel].clear();
+		for (int i=1; i<argc; i++) table[sel].push_back(argv[i]);
 	}
 };
 \end class {install("attr",1,1);}



More information about the Gridflow-cvs mailing list