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

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Fri Aug 13 12:16:07 EDT 2010


Author: matju
Date: Fri Aug 13 12:16:05 2010
New Revision: 6074

Log:
replace t_outlet* by PtrOutlet as a place to implement future shortcuts

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

Modified: trunk/src/gridflow.cxx
==============================================================================
--- trunk/src/gridflow.cxx (original)
+++ trunk/src/gridflow.cxx Fri Aug 13 12:16:05 2010
@@ -631,7 +631,7 @@
 	ninlets  = 1;
 	noutlets = 0;
 	inlets  = new  BFProxy*[1];
-	outlets = new t_outlet*[1];
+	outlets = new PtrOutlet[1];
 	FClass *fc = fclasses[name];
 	inlets[0] = 0; // inlet 0 of this table is not in use
 	ninlets_set( fc->ninlets ,false);
@@ -737,11 +737,11 @@
 	if (n<0) RAISE("noutlets_set: n=%d must be at least 0",n);
 	if (draw) BFObject_undrawio(bself);
 	if (noutlets<n) {
-		t_outlet **noo = new t_outlet*[n>0?n:1];
+		PtrOutlet*noo = new PtrOutlet[n>0?n:1];
 		memcpy(noo,outlets,noutlets*sizeof(t_outlet*));
 		delete[] outlets;
 		outlets = noo;
-		while (noutlets<n) outlets[noutlets++] = outlet_new(bself,&s_anything);
+		while (noutlets<n) outlets[noutlets++].p = outlet_new(bself,&s_anything);
 	} else {
 		while (noutlets>n) outlet_free(outlets[--noutlets]);
 	}

Modified: trunk/src/gridflow.hxx
==============================================================================
--- trunk/src/gridflow.hxx (original)
+++ trunk/src/gridflow.hxx Fri Aug 13 12:16:05 2010
@@ -804,6 +804,11 @@
     //void send () {outlet_bang(
 };*/
 
+struct PtrOutlet {
+	t_outlet *p;
+	operator t_outlet * () {return p;}
+};
+
 // represents objects that have inlets/outlets
 \class FObject {
 	virtual ~FObject ();
@@ -811,7 +816,7 @@
 	BFObject *bself; // point to PD peer
 	int ninlets,noutlets; // per object settings (not class)
 	BFProxy  **inlets;    // direct access to  inlets (not linked lists)
-	t_outlet **outlets;   // direct access to outlets (not linked lists)
+	PtrOutlet *outlets;  // direct access to outlets (not linked lists)
 	t_canvas *mom;
 	void  ninlets_set(int n, bool draw=true);
 	void noutlets_set(int n, bool draw=true);



More information about the Gridflow-cvs mailing list