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

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Mon Jul 14 16:10:04 EDT 2008


Author: matju
Date: Mon Jul 14 16:10:03 2008
New Revision: 4026

Log:
new method GridOutlet::create_buf : separate output buffering creation from GridOutlet::begin

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

Modified: trunk/base/grid.c
==============================================================================
--- trunk/base/grid.c (original)
+++ trunk/base/grid.c Mon Jul 14 16:10:03 2008
@@ -236,14 +236,7 @@
 	begin(woutlet,dim,nt);
 }
 
-void GridOutlet::begin(int woutlet, P<Dim> dim, NumberTypeE nt) {TRACE;
-	this->nt = nt;
-	this->dim = dim;
-	t_atom a[1];
-	SETGRIDOUT(a,this);
-	outlet_anything(parent->bself->outlets[woutlet],bsym._grid,1,a);
-	frozen=true;
-	if (!dim->prod()) {finish(); return;}
+void GridOutlet::create_buf () {TRACE;
 	int32 lcm_factor = 1;
 	for (uint32 i=0; i<inlets.size(); i++) lcm_factor = lcm(lcm_factor,inlets[i]->factor());
 	//size_t ntsz = number_type_table[nt].size;
@@ -253,10 +246,21 @@
 	buf=new Grid(new Dim(v),nt);
 #ifdef TRACEBUFS
 	std::ostringstream text;
-	oprintf(text,"GridOutlet: %20s buf for sending to  ",dim->to_s());
+	oprintf(text,"GridOutlet: %20s buf for sending to  ",buf->dim->to_s());
 	for (uint i=0; i<inlets.size(); i++) text << " " << (void *)inlets[i]->parent;
 	post("%s",text.str().data());
 #endif
+}
+
+void GridOutlet::begin(int woutlet, P<Dim> dim, NumberTypeE nt) {TRACE;
+	this->nt = nt;
+	this->dim = dim;
+	t_atom a[1];
+	SETGRIDOUT(a,this);
+	outlet_anything(parent->bself->outlets[woutlet],bsym._grid,1,a);
+	frozen=true;
+	if (!dim->prod()) {finish(); return;}
+	create_buf();
 }
 
 // send modifies dex; send_direct doesn't

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Mon Jul 14 16:10:03 2008
@@ -798,13 +798,13 @@
 	template <class T> void send(long n, T *data);
 	void flush(); // goes with send();
 
-private:
 	bool frozen; // is the "begin" phase finished?
 	PtrGrid buf; // temporary buffer
 	long bufi; // number of bytes used in the buffer
 	void begin(int woutlet, P<Dim> dim, NumberTypeE nt=int32_e);
 	template <class T> void send_direct(long n, T *data);
 	void finish();
+	void create_buf();
 };
 
 //****************************************************************



More information about the Gridflow-cvs mailing list