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

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Fri Jul 11 03:43:39 EDT 2008


Author: matju
Date: Fri Jul 11 03:43:38 2008
New Revision: 4010

Log:
remove GridInlet::set_mode(6) and GridOutlet::give()

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

Modified: trunk/base/grid.c
==============================================================================
--- trunk/base/grid.c (original)
+++ trunk/base/grid.c Fri Jul 11 03:43:38 2008
@@ -184,15 +184,8 @@
 			bufi+=k; data+=k; n-=k;
 			if (bufi==bufn) {
 				long newdex = dex+bufn;
-				if (this->mode==6) {
-					T *data2 = NEWBUF(T,bufn);
-					COPY(data2,bufd,bufn);
-					CHECK_ALIGN(data2);
-					try {gh->flow(this,bufn,data2);} CATCH_IT;
-				} else {
-					CHECK_ALIGN(bufd);
-					try {gh->flow(this,bufn,bufd);} CATCH_IT;
-				}
+				CHECK_ALIGN(bufd);
+				try {gh->flow(this,bufn,bufd);} CATCH_IT;
 				dex = newdex;
 				bufi = 0;
 			}
@@ -200,25 +193,12 @@
 		int m = (n/bufn)*bufn;
 		if (m) {
 			int newdex = dex + m;
-			if (this->mode==6) {
-				T *data2 = NEWBUF(T,m);
-				COPY(data2,data,m);
-				CHECK_ALIGN(data2);
-				try {gh->flow(this,m,data2);} CATCH_IT;
-			} else {
-				try {gh->flow(this,m,data);} CATCH_IT;
-			}
+			try {gh->flow(this,m,data);} CATCH_IT;
 			dex = newdex;
 		}
 		data += m;
 		n -= m;
 		if (buf && n>0) COPY((T *)*buf+bufi,data,n), bufi+=n;
-	}break;
-	case 6:{
-		int newdex = dex + n;
-		try {gh->flow(this,n,data);} CATCH_IT;
-		if (this->mode==4) DELBUF(data);
-		dex = newdex;
 	}break;
 	case 0: break; // ignore data
 	default: RAISE("%s: unknown inlet mode",ARGS(parent));
@@ -361,29 +341,6 @@
 	}
 }
 
-template <class T>
-void GridOutlet::give(long n, T *data) {TRACE;
-	CHECK_BUSY(outlet);
-	CHECK_ALIGN(data);
-	if (NumberTypeE_type_of(data)!=nt) {
-		send(n,data);
-		DELBUF(data);
-		return;
-	}
-	if (inlets.size()==1 && inlets[0]->mode == 6) {
-		// this is the copyless buffer passing
-		flush();
-		try {inlets[0]->flow(6,n,data);} CATCH_IT;
-		dex += n;
-	} else {
-		flush();
-		send_direct(n,data);
-		dex += n;
-		DELBUF(data);
-	}
-	if (dex==dim->prod()) finish();
-}
-
 void GridOutlet::callback(GridInlet *in) {TRACE;
 	CHECK_BUSY1(outlet);
 	if (!(in->mode==6 || in->mode==4 || in->mode==0)) RAISE("mode error");
@@ -394,7 +351,7 @@
 // i'm trying to circumvent either a bug in the compiler or i don't have a clue. :-(
 void make_gimmick () {
 	GridOutlet foo(0,0,0);
-#define FOO(S) foo.give(0,(S *)0);
+#define FOO(S) foo.send(0,(S *)0);
 EACH_NUMBER_TYPE(FOO)
 #undef FOO
 	//foo.send(0,(float64 *)0); // this doesn't work, when trying to fix the new link problem in --lite mode.

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Fri Jul 11 03:43:38 2008
@@ -711,7 +711,7 @@
 	PtrGrid buf;// factor-chunk buffer
 	long bufi;   // buffer index: how much of buf is filled
 public:
-	int mode; // 0=ignore; 4=ro; 6=rw
+	int mode; // 0=ignore; 4=ro
 //	long allocfactor,allocmin,allocmax,allocn;
 //	uint8 *alloc;
 
@@ -721,7 +721,7 @@
 	~GridInlet() {}
 	void set_factor(long factor); // obsolete
 	void set_chunk(long whichdim);
-	void set_mode(int mode_) { mode=mode_; }
+	void set_mode(int mode_) {mode=mode_;}
 	int32 factor() {return buf?buf->dim->prod():1;}
 	void begin(int argc, t_atom2 *argv);
 	void finish(); /* i thought this should be private but maybe it shouldn't. */
@@ -795,11 +795,6 @@
 	template <class T> void send(long n, T *data);
 	void flush(); // goes with send();
 
-	// give: data must be dynamically allocated as a whole: the data
-	// will be deleted eventually, and should not be used by the caller
-	// beyond the call to give().
-	template <class T> void give(long n, T *data);
-
 	// third way to send (upcoming, in GF-1.1.??) is called "ask".
 	template <class T> void ask(int &n, T *&data, long factor, long min, long max);
 



More information about the Gridflow-cvs mailing list