[Gridflow-cvs] [svn] commit: r4391 - in /trunk: base/grid.c gridflow.h

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Sun Oct 25 12:56:27 EDT 2009


Author: matju
Date: Sun Oct 25 12:56:27 2009
New Revision: 4391

Log:
wrap GridOutlet::send (rename to send_2) so that the T type can be checked.

Modified:
    trunk/base/grid.c
    trunk/gridflow.h

Modified: trunk/base/grid.c
==============================================================================
--- trunk/base/grid.c (original)
+++ trunk/base/grid.c Sun Oct 25 12:56:27 2009
@@ -2,7 +2,7 @@
 	$Id$
 
 	GridFlow
-	Copyright (c) 2001-2008 by Mathieu Bouchard
+	Copyright (c) 2001-2009 by Mathieu Bouchard
 
 	This program is free software; you can redistribute it and/or
 	modify it under the terms of the GNU General Public License
@@ -82,7 +82,10 @@
 		init(new Dim(),int32_e);
 		CHECK_ALIGN(this->data,nt);
 		((int32 *)*this)[0] = (int32)a.a_float;
-	} else RAISE("can't convert to grid");
+	} else {
+		std::ostringstream s; s << x;
+		RAISE("can't convert to grid: %s",s.str().data());
+	}
 }
 
 // **************** GridInlet *************************************
@@ -243,7 +246,7 @@
 //!@#$ should use BitPacking for conversion...?
 // send modifies dex; send_direct doesn't
 template <class T>
-void GridOutlet::send(long n, T *data) {
+void GridOutlet::send_2(long n, T *data) {
 	//if (inlets.size()==1 && inlets[0]->buf) post("GridOutlet::send(%ld), bufsize %ld",long(n),long(inlets[0]->buf->dim->prod()));
 	if (!n) return;
 	CHECK_BUSY(outlet); CHECK_ALIGN(data,nt);

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Sun Oct 25 12:56:27 2009
@@ -393,8 +393,7 @@
 };
 
 #define FOO(_type_) \
-inline NumberTypeE NumberTypeE_type_of(_type_ *x) { \
-	return _type_##_e; }
+inline NumberTypeE NumberTypeE_type_of(_type_ *x) {return _type_##_e;}
 EACH_NUMBER_TYPE(FOO)
 #undef FOO
 
@@ -746,7 +745,10 @@
 	// receiver doesn't modify the data; in send(), there is buffering;
 	// in send_direct(), there is not. When switching from buffered to
 	// unbuffered mode, flush() must be called
-	template <class T> void send(long n, T *data);
+	#define FOO(T) void send(long n, T *data) {send_2(n,data);}
+	EACH_NUMBER_TYPE(FOO)
+	#undef FOO
+	template <class T> void send_2(long n, T *data);
 	void flush(); // goes with send();
 	PtrGrid buf; // temporary buffer
 	long bufi; // number of bytes used in the buffer



More information about the Gridflow-cvs mailing list