[PD-cvs] externals/grh/PDContainer/src h_prioqueue.cpp,1.3,1.4
Georg Holzmann
grholzi at users.sourceforge.net
Tue Jan 9 22:02:21 CET 2007
Update of /cvsroot/pure-data/externals/grh/PDContainer/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25754
Modified Files:
h_prioqueue.cpp
Log Message:
changed name
Index: h_prioqueue.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grh/PDContainer/src/h_prioqueue.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** h_prioqueue.cpp 9 Jan 2007 20:54:10 -0000 1.3
--- h_prioqueue.cpp 9 Jan 2007 21:02:19 -0000 1.4
***************
*** 15,30 ****
! static t_class *h_priority_queue_class;
static t_class *proxy_class;
! typedef struct _h_priority_queue
{
t_object x_obj;
t_canvas *x_canvas;
t_outlet *out0, *out1, *out2;
! HPrioQueue *hpriority_queue;
Element value;
bool event_set;
! } t_h_priority_queue;
typedef struct proxy
--- 15,30 ----
! static t_class *h_prioqueue_class;
static t_class *proxy_class;
! typedef struct _h_prioqueue
{
t_object x_obj;
t_canvas *x_canvas;
t_outlet *out0, *out1, *out2;
! HPrioQueue *hprioqueue;
Element value;
bool event_set;
! } t_h_prioqueue;
typedef struct proxy
***************
*** 32,43 ****
t_object obj;
t_int index; // number of proxy inlet(s)
! t_h_priority_queue *x; // we'll put the other struct in here
} t_proxy;
! static void h_priority_queue_push(t_h_priority_queue *x, t_symbol *s, int argc, t_atom *argv)
{
if(!x->event_set)
{
! post("h_priority_queue, insert: you must first set a value at right inlet!");
return;
}
--- 32,43 ----
t_object obj;
t_int index; // number of proxy inlet(s)
! t_h_prioqueue *x; // we'll put the other struct in here
} t_proxy;
! static void h_prioqueue_push(t_h_prioqueue *x, t_symbol *s, int argc, t_atom *argv)
{
if(!x->event_set)
{
! post("h_prioqueue, insert: you must first set a value at right inlet!");
return;
}
***************
*** 48,62 ****
else
{
! post("h_priority_queue, push: invalid priority!");
return;
}
! x->hpriority_queue->push(prio,x->value);
x->event_set = false;
}
! static void h_priority_queue_value(t_proxy *p, t_symbol *s, int argc, t_atom *argv)
{
! t_h_priority_queue *x = (t_h_priority_queue *)(p->x);
// symbol without selector "symbol":
--- 48,62 ----
else
{
! post("h_prioqueue, push: invalid priority!");
return;
}
! x->hprioqueue->push(prio,x->value);
x->event_set = false;
}
! static void h_prioqueue_value(t_proxy *p, t_symbol *s, int argc, t_atom *argv)
{
! t_h_prioqueue *x = (t_h_prioqueue *)(p->x);
// symbol without selector "symbol":
***************
*** 107,113 ****
}
! static void h_priority_queue_top(t_h_priority_queue *x)
{
! if(x->hpriority_queue->getSize()==0)
{
// if there was no Element found, put out a bang at the right outlet
--- 107,113 ----
}
! static void h_prioqueue_top(t_h_prioqueue *x)
{
! if(x->hprioqueue->getSize()==0)
{
// if there was no Element found, put out a bang at the right outlet
***************
*** 116,120 ****
}
! Element output = x->hpriority_queue->top();
if(output.getLength() == 1) // symbol or float
--- 116,120 ----
}
! Element output = x->hprioqueue->top();
if(output.getLength() == 1) // symbol or float
***************
*** 138,185 ****
}
! static void h_priority_queue_pop(t_h_priority_queue *x)
{
! if(x->hpriority_queue->getSize()<=0)
{
! post("h_priority_queue, pop: size is already 0 !");
return;
}
! x->hpriority_queue->pop();
}
! static void h_priority_queue_getsize(t_h_priority_queue *x)
{
! outlet_float(x->out1,x->hpriority_queue->getSize());
}
! static void h_priority_queue_help(t_h_priority_queue *x)
{
! x->hpriority_queue->help();
}
! static void h_priority_queue_set_namespace(t_h_priority_queue *x, t_symbol *s)
{
! x->hpriority_queue->setNamespace(s->s_name);
}
! static void h_priority_queue_get_namespace(t_h_priority_queue *x)
{
! post("h_priority_queue current namespace: %s",x->hpriority_queue->getNamespace().c_str());
}
! static void h_priority_queue_clear(t_h_priority_queue *x)
{
! x->hpriority_queue->clearNamespace();
}
! static void h_priority_queue_clear_all(t_h_priority_queue *x)
{
! x->hpriority_queue->clearAll();
}
! static void *h_priority_queue_new(t_symbol *s, int argc, t_atom *argv)
{
! t_h_priority_queue *x = (t_h_priority_queue *)pd_new(h_priority_queue_class);
t_proxy *inlet = (t_proxy *)pd_new(proxy_class); // for the proxy inlet
--- 138,185 ----
}
! static void h_prioqueue_pop(t_h_prioqueue *x)
{
! if(x->hprioqueue->getSize()<=0)
{
! post("h_prioqueue, pop: size is already 0 !");
return;
}
! x->hprioqueue->pop();
}
! static void h_prioqueue_getsize(t_h_prioqueue *x)
{
! outlet_float(x->out1,x->hprioqueue->getSize());
}
! static void h_prioqueue_help(t_h_prioqueue *x)
{
! x->hprioqueue->help();
}
! static void h_prioqueue_set_namespace(t_h_prioqueue *x, t_symbol *s)
{
! x->hprioqueue->setNamespace(s->s_name);
}
! static void h_prioqueue_get_namespace(t_h_prioqueue *x)
{
! post("h_prioqueue current namespace: %s",x->hprioqueue->getNamespace().c_str());
}
! static void h_prioqueue_clear(t_h_prioqueue *x)
{
! x->hprioqueue->clearNamespace();
}
! static void h_prioqueue_clear_all(t_h_prioqueue *x)
{
! x->hprioqueue->clearAll();
}
! static void *h_prioqueue_new(t_symbol *s, int argc, t_atom *argv)
{
! t_h_prioqueue *x = (t_h_prioqueue *)pd_new(h_prioqueue_class);
t_proxy *inlet = (t_proxy *)pd_new(proxy_class); // for the proxy inlet
***************
*** 189,198 ****
{
default:
! post("h_priority_queue warning: only one argument for namespace is possible!");
case 1:
! x->hpriority_queue = new HPrioQueue(atom_getsymbol(argv)->s_name);
break;
case 0:
! x->hpriority_queue = new HPrioQueue();
break;
}
--- 189,198 ----
{
default:
! post("h_prioqueue warning: only one argument for namespace is possible!");
case 1:
! x->hprioqueue = new HPrioQueue(atom_getsymbol(argv)->s_name);
break;
case 0:
! x->hprioqueue = new HPrioQueue();
break;
}
***************
*** 211,217 ****
}
! static void *h_priority_queue_free(t_h_priority_queue *x)
{
! delete x->hpriority_queue;
return (void *)x;
}
--- 211,217 ----
}
! static void *h_prioqueue_free(t_h_prioqueue *x)
{
! delete x->hprioqueue;
return (void *)x;
}
***************
*** 220,250 ****
{
// the object class
! h_priority_queue_class = class_new(gensym("h_priority_queue"), (t_newmethod)h_priority_queue_new,
! (t_method)h_priority_queue_free, sizeof(t_h_priority_queue),
CLASS_DEFAULT, A_GIMME, 0);
// a class for the proxy-inlet
! proxy_class = class_new(gensym("h_priority_queue_proxy"), NULL, NULL, sizeof(t_proxy),
CLASS_PD|CLASS_NOINLET, A_NULL);
! class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_push,
gensym("push"), A_GIMME, 0);
! class_addanything(proxy_class, (t_method)h_priority_queue_value); // the right inlet
! class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_pop,
gensym("pop"), A_DEFFLOAT, 0);
! class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_top,
gensym("top"), A_DEFFLOAT, 0);
! class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_getsize,
gensym("getsize"), A_DEFFLOAT , 0);
! class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_set_namespace,
gensym("namespace"), A_DEFSYMBOL , 0);
! class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_get_namespace,
gensym("getnamespace"), A_DEFFLOAT, 0);
! class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_clear,
gensym("clear"), A_DEFFLOAT, 0);
! class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_clear_all,
gensym("clearall"), A_DEFFLOAT, 0);
// without an argument the following two methods wont work ??? why?? because of c++?
! class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_help, gensym("help"),A_DEFFLOAT, 0);
}
--- 220,250 ----
{
// the object class
! h_prioqueue_class = class_new(gensym("h_prioqueue"), (t_newmethod)h_prioqueue_new,
! (t_method)h_prioqueue_free, sizeof(t_h_prioqueue),
CLASS_DEFAULT, A_GIMME, 0);
// a class for the proxy-inlet
! proxy_class = class_new(gensym("h_prioqueue_proxy"), NULL, NULL, sizeof(t_proxy),
CLASS_PD|CLASS_NOINLET, A_NULL);
! class_addmethod(h_prioqueue_class, (t_method)h_prioqueue_push,
gensym("push"), A_GIMME, 0);
! class_addanything(proxy_class, (t_method)h_prioqueue_value); // the right inlet
! class_addmethod(h_prioqueue_class, (t_method)h_prioqueue_pop,
gensym("pop"), A_DEFFLOAT, 0);
! class_addmethod(h_prioqueue_class, (t_method)h_prioqueue_top,
gensym("top"), A_DEFFLOAT, 0);
! class_addmethod(h_prioqueue_class, (t_method)h_prioqueue_getsize,
gensym("getsize"), A_DEFFLOAT , 0);
! class_addmethod(h_prioqueue_class, (t_method)h_prioqueue_set_namespace,
gensym("namespace"), A_DEFSYMBOL , 0);
! class_addmethod(h_prioqueue_class, (t_method)h_prioqueue_get_namespace,
gensym("getnamespace"), A_DEFFLOAT, 0);
! class_addmethod(h_prioqueue_class, (t_method)h_prioqueue_clear,
gensym("clear"), A_DEFFLOAT, 0);
! class_addmethod(h_prioqueue_class, (t_method)h_prioqueue_clear_all,
gensym("clearall"), A_DEFFLOAT, 0);
// without an argument the following two methods wont work ??? why?? because of c++?
! class_addmethod(h_prioqueue_class, (t_method)h_prioqueue_help, gensym("help"),A_DEFFLOAT, 0);
}
More information about the Pd-cvs
mailing list