[Gridflow-cvs] [svn] commit: r6520 - in /trunk/src: grid.cxx gridflow.hxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Thu Feb 3 20:24:53 EST 2011


Author: matju
Date: Thu Feb  3 20:24:53 2011
New Revision: 6520

Log:
Grid: add instance method 'init_from_msg', add class method 'from_msg'

Modified:
    trunk/src/grid.cxx
    trunk/src/gridflow.hxx

Modified: trunk/src/grid.cxx
==============================================================================
--- trunk/src/grid.cxx (original)
+++ trunk/src/grid.cxx Thu Feb  3 20:24:53 2011
@@ -85,6 +85,11 @@
 		ostringstream s; s << x;
 		RAISE("can't convert to grid: %s",s.str().data());
 	}
+}
+
+void Grid::init_from_msg(int argc, t_atom *argv, NumberTypeE nt) {
+	if (argc==1) init_from_atom(argv[0]); // what do I do with nt here ? is nt being useful here anyway ?
+	else         init_from_list(argc,argv,nt);
 }
 
 // **************** GridInlet *************************************

Modified: trunk/src/gridflow.hxx
==============================================================================
--- trunk/src/gridflow.hxx (original)
+++ trunk/src/gridflow.hxx Thu Feb  3 20:24:53 2011
@@ -625,6 +625,8 @@
 	Grid(const t_atom &x) {data=0; state=1; init_from_atom(x);}
 	Grid(int n, t_atom2 *a, NumberTypeE nt_=int32_e) {data=0; state=1; init_from_list(n,a,nt_);}
 	Grid(int n, t_atom  *a, NumberTypeE nt_=int32_e) {data=0; state=1; init_from_list(n,a,nt_);}
+	static Grid *from_msg(int n, t_atom2 *a) {Grid *self = new Grid; self->init_from_msg(n,a); return self;}
+	static Grid *from_msg(int n, t_atom  *a) {Grid *self = new Grid; self->init_from_msg(n,a); return self;}
 	template <class T> Grid(const Dim &dim, T *data) {
 		state=0; this->dim=dim;
 		this->nt=NumberTypeE_type_of((T *)0);
@@ -655,6 +657,7 @@
 	}
 	void init_from_atom(const t_atom &x);
 	void init_from_list(int n, t_atom *a, NumberTypeE nt=int32_e);
+	void init_from_msg (int n, t_atom *a, NumberTypeE nt=int32_e);
 };
 static inline Grid *convert (const t_atom2 &r, Grid **bogus) {return new Grid(r);}
 



More information about the Gridflow-cvs mailing list