tilde~
Puredata Qt-based GUI
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
oop_common.h
Go to the documentation of this file.
1 //
2 // oop_common.h
3 // pd_ext
4 //
5 // Created by Alex Nadzharov on 17/01/17.
6 //
7 //
8 
9 #include "ceammc.h"
10 //#include "m_pd.h"
11 #include <stdlib.h>
12 
13 #include "ceammc_atomlist.h"
14 
15 #include "m_imp.h"
16 
17 #include <stdio.h>
18 
19 #include "cicm_wrapper.h"
20 
21 #include "ceammc_globaldata.h"
22 #include <algorithm>
23 #include <string>
24 
25 using namespace ceammc;
26 using namespace std;
27 
28 #pragma mark -
29 #include <sstream>
30 
31 template <class T>
32 inline string to_string(const T& t)
33 {
34  stringstream ss;
35  ss << t; // ss << std::hex << t;
36  return ss.str();
37 }
38 
39 #pragma mark -
40 
42  t_symbol* ce_dir; /* directory patch lives in */
43  int ce_argc; /* number of "$" arguments */
44  t_atom* ce_argv; /* array of "$" arguments */
45  int ce_dollarzero; /* value of "$0" */
46  t_namelist* ce_path; /* search path */
47 };
48 
49 static void canvas_addtolist(t_canvas* x)
50 {
51  x->gl_next = pd_this->pd_canvaslist;
52  pd_this->pd_canvaslist = x;
53 }
54 
55 static void canvas_takeofflist(t_canvas* x)
56 {
57  /* take it off the window list */
58  if (x == pd_this->pd_canvaslist)
59  pd_this->pd_canvaslist = x->gl_next;
60  else {
61  t_canvas* z;
62  for (z = pd_this->pd_canvaslist; z->gl_next != x; z = z->gl_next)
63  if (!z->gl_next)
64  return;
65  z->gl_next = x->gl_next;
66  }
67 }
68 
69 #pragma mark -
70 
71 typedef vector<t_outlet*> OPOutputs;
72 typedef vector<t_object*> OPProperties;
73 
74 static void canvas_paste_class(t_canvas* x, t_binbuf* b);
75 
76 //weird
77 class OPClass;
78 typedef GlobalData<OPClass*> OPClassByCanvas;
79 typedef GlobalData<OPClass*> OPClassBySymbol;
80 
81 class OPClass {
82 private:
83  map<string, string> methodNames; // todo rename
84  map<string, string> propertyNames;
85  map<string, string> signalNames;
86 
87  map<string, t_outlet*> methodOutlets; //todo OPOutputs
88  map<string, t_outlet*> methodPointerOutlets; //todo OPOutputs
89 
90  OPClass* parent;
91 
92 public:
93  string class_name;
94 
97 
98  // for dynamic (change arguments?)
100  {
101  this->canvas = 0;
102  }
103  // for canvas-based (change arguments?)
104  OPClass(string className)
105  {
106 
107  this->canvas = (t_canvas*)subcanvas_new(gensym(className.c_str()));
108  this->canvas->gl_havewindow = 1;
109  this->canvas->gl_isclone = 1;
110 
111  this->symbol = gensym(class_name.c_str());
112  this->class_name = className;
113 
114  OPClassByCanvas* link = new OPClassByCanvas(to_string((long)this->canvas), "OOP.common");
115  link->ref() = this;
116 
117  OPClassBySymbol* link2 = new OPClassBySymbol(this->symbol->s_name, "OOP.common");
118  link2->ref() = this;
119 
120  canvas_vis(this->canvas, 0);
121 
122  int dollarzero = 1000;
124  env->ce_dir = canvas_getcurrentdir();
125  env->ce_argc = 0;
126  env->ce_argv = 0;
127  env->ce_dollarzero = dollarzero++;
128  env->ce_path = 0;
129 
130  this->canvas->gl_env = (t_canvasenvironment*)env;
131 
132  this->canvas->gl_owner = 0;
133  }
134 
135 #pragma mark getters
136  map<string, string> getMethodNames()
137  {
138  return this->methodNames;
139  }
140  map<string, string> getPropertyNames()
141  {
142  return this->propertyNames;
143  }
144  map<string, t_outlet*> getMethodOutlets()
145  {
146  return this->methodOutlets;
147  }
148 
149 #pragma mark file io
150 
151  void readFile(string fileName, t_canvas* parent_canvas)
152  {
153 
154  t_binbuf* b;
155  b = binbuf_new();
156 
157  binbuf_read_via_canvas(b, (char*)(fileName.c_str()), parent_canvas, 0);
158 
159  int blen = 0;
160  char* bchar;
161  binbuf_gettext(b, &bchar, &blen);
162 
163  // to canvas
164  // find better way to load?
165  if (this->canvas) {
166  if (this->canvas->gl_list) {
167  glist_delete(this->canvas, this->canvas->gl_list);
168  }
169 
170  canvas_paste_class(this->canvas, b);
171  canvas_vis(this->canvas, 0);
172  canvas_setcurrent(parent_canvas);
173 
174  post("loaded class: %s ", (char*)(fileName.c_str()));
175  }
176 
177  //recursive
178 
179  if (this->parent) {
180  //todo
181  //this->parent->readFile(this->parent-, struct _glist *parent_canvas)
182  }
183  }
184 
185  void writeFile(string fileName, t_canvas* parent_canvas)
186  {
187  t_binbuf* b = binbuf_new();
188 
189  canvas_saveto(this->canvas, b);
190 
191  const char* dir = canvas_getdir(parent_canvas)->s_name;
192  binbuf_write(b, (char*)(fileName.c_str()), (char*)dir, 0);
193 
194  post("saved class: %s ", (char*)(fileName.c_str()));
195  }
196 
197 #pragma mark dynamic: methods
198  // dynamic stub:
199  void addMethod(string methodName, string referenceName)
200  {
201  this->methodNames[methodName] = referenceName;
202  }
203 
204  void addMethodOutlet(string referenceName, t_outlet* outlet)
205  {
206  //todo multiple
207  this->methodOutlets[referenceName] = outlet;
208  }
209 
210  void addMethodPointerOutlet(string referenceName, t_outlet* outlet)
211  {
212  //todo multiple
213  this->methodPointerOutlets[referenceName] = outlet;
214  }
215 
217  {
218  t_outlet* ret;
219  if (this->methodOutlets.count(referenceName)) {
220  //todo multiple
221  ret = this->methodOutlets[referenceName];
222  }
223 
224  return ret;
225  }
226 
228  {
229  t_outlet* ret;
230  if (this->methodPointerOutlets.count(referenceName)) {
231  //todo multiple
232  ret = this->methodPointerOutlets[referenceName];
233  }
234 
235  return ret;
236  }
237 
238  void freeMethod(string methodName)
239  {
240  this->methodNames.erase(methodName);
241  }
242 
243  void freeMethodOutlet(string referenceName)
244  {
245  this->methodOutlets.erase(referenceName);
246  }
247 
248  void freeMethodPointerOutlet(string referenceName)
249  {
250  this->methodPointerOutlets.erase(referenceName);
251  }
252 
253  void addProperty(string propertyName, string referenceName)
254  {
255  this->propertyNames[propertyName] = referenceName;
256  }
257 
258  void freeProperty(string propertyName)
259  {
260  this->propertyNames.erase(propertyName);
261  }
262 
263 #pragma mark find
264 
265  static OPClass* findByCanvas(t_canvas* canvas)
266  {
267  OPClassByCanvas* ret = new OPClassByCanvas(to_string((long)canvas), "OOP.common");
268  if (ret)
269  return ret->ref();
270  else
271  return 0;
272  }
273 
274  static OPClass* findBySymbol(t_symbol* symbol)
275  {
276  OPClassBySymbol* ret = new OPClassBySymbol(symbol->s_name, "OOP.common");
277  if (ret)
278  return ret->ref();
279  else
280  return 0;
281  }
282 
283 #pragma mark parent
284 
285  void setParentClass(OPClass* p_class)
286  {
287  this->parent = p_class;
288  }
289 
291  {
292  return this->parent;
293  }
294 
295 #pragma mark signal
296 
297  void addSignal(string signalName, string referenceName)
298  {
299  this->signalNames[signalName] = referenceName;
300  }
301 
302  void freeSignal(string signalName)
303  {
304  this->signalNames.erase(signalName);
305  }
306 
307 #pragma mark info
309  {
310  AtomList ret;
311 
312  for (map<string, string>::iterator it = this->propertyNames.begin(); it != this->propertyNames.end(); ++it) {
313  ret.append(Atom(gensym(it->first.c_str())));
314  }
315 
316  return ret;
317  }
318 
320  {
321  AtomList ret;
322 
323  for (map<string, string>::iterator it = this->methodNames.begin(); it != this->methodNames.end(); ++it) {
324  ret.append(Atom(gensym(it->first.c_str())));
325  }
326 
327  return ret;
328  }
329 
331  {
332  AtomList ret;
333 
334  for (map<string, string>::iterator it = this->signalNames.begin(); it != this->signalNames.end(); ++it) {
335  ret.append(Atom(gensym(it->first.c_str())));
336  }
337 
338  return ret;
339 
340  }
341 };
342 
343 typedef GlobalData<OPClass*> OPClasses;
344 
345 #pragma mark -
346 
347 //weird
349 typedef GlobalData<OPInstance*> OPInstanceByCanvas;
350 typedef GlobalData<OPInstance*> OPInstanceBySymbol;
351 
352 class OPInstance {
353 private:
354  map<t_symbol*, OPOutputs> _methodOutputs;
355  OPOutputs _instanceOutputs;
356 
357  map<t_symbol*, OPOutputs> _getterOutputs;
358  map<t_symbol*, OPOutputs> _setterOutputs;
359 
360  //new
361  map<t_symbol*, AtomList> _propertyValues;
362  int _refCount;
363 
364  // dynamic.
365  map<string, string> methodNames;
366  map<string, string> propertyNames;
367 
368  //signal
369  map<t_symbol*, t_sample*> _signalBuffers;
370 
371  //
372  map<t_symbol*, t_outlet*> _methodPointerOutputs; // todo OPOutputs
373 
374  OPInstanceByCanvas* canvasLink;
375  OPInstanceBySymbol* symbolLink;
376 
377 
378 public:
379  string class_name;
381 
383 
384  //
386 
387  OPInstance(OPClass* _opclass)
388 
389  {
390 
391  printf("new instance\n");
392 
393  this->class_name = _opclass->class_name;
394  this->symbol = gensym(to_string((long)this).c_str());
395 
396  // new canvas. only for canvas-based classes
397  if (_opclass->canvas) {
398  int dsp_state = canvas_suspend_dsp();
399 
400  //parent
401  if (_opclass->getParentClass()) {
402  this->parent = new OPInstance(_opclass->getParentClass());
403  post("created parent class instance");
404  }
405 
406  this->canvas = (t_canvas*)subcanvas_new(gensym(_opclass->class_name.c_str()));
407  this->canvas->gl_havewindow = 1;
408  this->canvas->gl_isclone = 1;
409 
410  int dollarzero = 1000;
412  env->ce_dir = canvas_getcurrentdir();
413  env->ce_argc = 0;
414  env->ce_argv = 0;
415  env->ce_dollarzero = dollarzero++;
416  env->ce_path = 0;
417 
418  this->canvas->gl_env = (t_canvasenvironment*)env;
419 
420  this->canvas->gl_owner = 0;
421 
422  //this->canvas->gl_owner = 0;
423 
424  this->canvasLink = new OPInstanceByCanvas(to_string((long)this->canvas), "OOP.common");
425  this->canvasLink->ref() = this;
426 
427  this->symbolLink = new OPInstanceBySymbol(this->symbol->s_name, "OOP.common");
428  this->symbolLink->ref() = this;
429 
430  //load
431  t_binbuf* b1 = binbuf_new();
432 
433  canvas_saveto(_opclass->canvas, b1);
434 
435  canvas_paste_class(this->canvas, b1);
436  canvas_vis(this->canvas, 0);
437 
438  canvas_addtolist(this->canvas);
439 
440  canvas_loadbang(this->canvas);
441 
442  canvas_resume_dsp(dsp_state);
443 
444  //todo bind symbols
445 
446  printf("OPInstance + canvas\n");
447  printf("canvas: %lu\n", (long)this->canvas);
448 
449  //todo cleanup?
450  //this->retain();
451  this->_refCount = 1;
452  }
453 
454  //generate properties
455  this->propertyNames = _opclass->getPropertyNames();
456 
457  //generate methods
458  //TODO normal class / singleton
459  OPClasses* dyn_class = new OPClasses("__dynamicStub", "exp.method");
460  if (!dyn_class->ref()) {
461  dyn_class->ref() = new OPClass();
462  dyn_class->ref()->class_name = "__dynamicStub";
463  }
464 
465  this->methodNames = _opclass->getMethodNames();
466  // temporary
467  map<string, string>::iterator it;
468  for (it = this->methodNames.begin(); it != this->methodNames.end(); ++it) {
469  t_outlet* dyn_out = dyn_class->ref()->getMethodOutletForReferenceName(it->second);
470 
471  if (dyn_out)
472  this->addMethod(gensym(it->first.c_str()), dyn_out);
473 
474  t_outlet* dyn_pointer_out = dyn_class->ref()->getMethodPointerOutletForReferenceName(it->second);
475 
476  if (dyn_pointer_out)
477  this->addMethodPointerOut(gensym(it->first.c_str()), dyn_pointer_out);
478  }
479  }
480 
482  {
483  int dsp_state = canvas_suspend_dsp();
484 
485  printf("canvas: %lu\n", (long)this->canvas);
486 
487  if (this->canvas)
488  {
489  canvas_dirty(this->canvas, 0);
490  canvas_takeofflist(this->canvas);
491  canvas_free(this->canvas);
492 
493  this->canvas = 0;
494  }
495 
496  delete this->canvasLink;
497  delete this->symbolLink;
498 
499  canvas_resume_dsp(dsp_state);
500 
501  printf("~OPInstance\n");
502  printf("canvas: %lu\n", (long)this->canvas);
503  }
504 
505 #pragma mark methods
506 
507  void addMethod(t_symbol* methodName, t_outlet* outlet)
508  {
509  this->_methodOutputs[methodName].push_back(outlet);
510  }
511 
512  void freeMethod(t_symbol* methodName)
513  {
514  this->_methodOutputs.erase(methodName);
515  }
516 
517  void addMethodPointerOut(t_symbol* methodName, t_outlet* outlet)
518  {
519  this->_methodPointerOutputs[methodName] = outlet; //.push_back(outlet); TODO
520  }
521 
522  void freeMethodPointerOut(t_symbol* methodName)
523  {
524  this->_methodPointerOutputs.erase(methodName);
525  }
526 
527 #pragma mark signal
528 
529  t_sample* getBufferFor(t_symbol* signalName, int vec_size)
530  {
531  t_sample* ret = this->_signalBuffers[signalName];
532 
533  if (!ret) {
534  ret = new t_sample[vec_size];
535  this->_signalBuffers[signalName] = ret;
536  post("new buffer: %s %i\n", signalName->s_name, vec_size);
537  }
538 
539  return ret;
540  }
541 
542  void freeSignal(t_symbol* signalName)
543  {
544  //todo refcounter
545  post("del buffer");
546  delete (this->_signalBuffers[signalName]);
547  this->_signalBuffers.erase(signalName);
548  }
549 
550 #pragma mark properties
551 
552  void addProperty(t_symbol* propertyName, t_outlet* getter_out, t_outlet* setter_out)
553  {
554  this->_getterOutputs[propertyName].push_back(getter_out);
555  this->_setterOutputs[propertyName].push_back(setter_out);
556 
557  this->propertyNames[propertyName->s_name] = "<none>"; //don't link by name as we link outlets.
558  }
559  void freeProperty(t_symbol* propertyName)
560  {
561  this->_getterOutputs.erase(propertyName);
562  this->_setterOutputs.erase(propertyName);
563 
564  this->propertyNames.erase(propertyName->s_name);
565  }
566 
567  void setAtomListProperty(t_symbol* propertyName, AtomList list)
568  {
569  this->_propertyValues[propertyName] = list;
570  }
571 
573  {
574  AtomList list = this->_propertyValues[propertyName];
575 
576  return list;
577  }
578 
580  {
581  AtomList ret;
582 
583  for (map<string, string>::iterator it = this->propertyNames.begin(); it != this->propertyNames.end(); ++it) {
584  ret.append(Atom(gensym(it->first.c_str())));
585  }
586 
587  return ret;
588  }
589 
590 #pragma mark methods
591 
592  void addInstanceOut(t_outlet* outlet)
593  {
594  this->_instanceOutputs.push_back(outlet);
595  }
596  void freeInstanceOut(t_outlet* outlet)
597  {
598  this->_instanceOutputs.erase(remove(this->_instanceOutputs.begin(), this->_instanceOutputs.end(), outlet), this->_instanceOutputs.end());
599  }
600 
602  {
603  for (OPOutputs::iterator it = this->_instanceOutputs.begin(); it != this->_instanceOutputs.end(); ++it) {
604  list.output(*it);
605  }
606  }
607 
608  void callMethod(AtomList list)
609  {
610  t_symbol* method_name = list[0].asSymbol();
611 
612  AtomList subList = list.slice(1, (int)list.size());
613 
614  OPOutputs* out1 = &this->_methodOutputs[method_name];
615 
616  if (out1) {
617  for (OPOutputs::iterator it = out1->begin(); it != out1->end(); ++it) {
618  subList.output(*it);
619  }
620  }
621 
622  //dynamic. todo
623 
624  t_outlet* out2 = this->_methodPointerOutputs[method_name];
625  if (out2) {
626  AtomList objList = AtomList(Atom(gensym("setobject")));
627 
628  objList.append(Atom(gensym(to_string((long)this).c_str())));
629 
630  objList.output(out2);
631  }
632  }
633 
634  void callSetter(AtomList list)
635  {
636  t_symbol* property_name = list[0].asSymbol();
637 
638  // OPProperties *out1 = &this->instancePropertyBoxes[property_name];
639  //
640  // if (out1)
641  // {
642  // for (OPProperties::iterator it =out1->begin(); it!=out1->end(); ++it)
643  // {
644  // pd_typedmess((t_pd*)*it, gensym("set"), (int)list.size(), list.toPdData());
645  // }
646  // }
647 
648  // Atom name = Atom(argv[0]);
649  //
650  // if (name.asSymbol() == x->property_name)
651  // {
652  // AtomList list2(argc-1,&argv[1]);
653  // x->instance->setAtomListProperty(x->property_name, list2);
654  //
655  // outlet_bang(x->out2);
656  // }
657 
658  AtomList list2((size_t)list.size() - 1, (t_atom*)list.toPdData() + 1); //TODO
659  this->setAtomListProperty(property_name, list2);
660 
661  OPOutputs* out1 = &this->_setterOutputs[property_name];
662 
663  for (OPOutputs::iterator it = out1->begin(); it != out1->end(); ++it) {
664  outlet_bang(*it);
665  }
666  }
667 
668  void callGetter(AtomList list)
669  {
670  t_symbol* property_name = list[0].asSymbol();
671 
672  // OPProperties *out1 = &this->instancePropertyBoxes[property_name];
673  //
674  // if (out1)
675  // {
676  // for (OPProperties::iterator it =out1->begin(); it!=out1->end(); ++it)
677  // {
678  // pd_typedmess((t_pd*)*it, gensym("get"), (int)list.size(), list.toPdData());
679  // }
680  // }
681 
682  AtomList list2(list[0]);
683  list2.append(this->getAtomListProperty(property_name));
684 
685  this->multipleOutput(list2);
686 
687  OPOutputs* out1 = &this->_getterOutputs[property_name];
688 
689  for (OPOutputs::iterator it = out1->begin(); it != out1->end(); ++it) {
690  outlet_bang(*it);
691  }
692  }
693 
695  {
696  AtomList ret;
697 
698  for (map<t_symbol*, OPOutputs>::iterator it = this->_methodOutputs.begin(); it != this->_methodOutputs.end(); ++it) {
699  ret.append(Atom(it->first));
700  }
701 
702  return ret;
703  }
704 
706  {
707  AtomList ret;
708 
709  for (map<string, string>::iterator it = this->methodNames.begin(); it != this->methodNames.end(); ++it) {
710  ret.append(Atom(gensym(it->first.c_str())));
711  }
712 
713  return ret;
714  }
715 
716 #pragma mark reference counting
717  // names?
718  void retain()
719  {
720  this->_refCount++;
721  printf("OPInstance ref count: %i\n", this->_refCount);
722  }
723 
724  //?
725  void release()
726  {
727  this->_refCount--;
728  printf("OPInstance ref count: %i\n", this->_refCount);
729  if (this->_refCount == 0)
730  delete this;
731  }
732 
733  //debug
735  {
736  return this->_refCount;
737  }
738 
739 #pragma mark find
741  {
742  OPInstanceByCanvas* ret = new OPInstanceByCanvas(to_string((long)canvas), "OOP.common");
743  return ret->ref();
744  }
745 
747  {
748  OPInstanceBySymbol* ret = new OPInstanceBySymbol(symbol->s_name, "OOP.common");
749  return ret->ref();
750  }
751 };
752 
753 // yet unused
754 #pragma mark canvas additions - C style
755 
756 static bool canvas_is_class(t_canvas* canvas)
757 {
758  return (OPClass::findByCanvas(canvas));
759 }
760 
761 static bool canvas_is_instance(t_canvas* canvas)
762 {
763  return (OPInstance::findByCanvas(canvas));
764 }
765 
766 #pragma mark -
767 
768 // copied from canvas_dopaste
769 // todo fix
770 
771 static void canvas_paste_class(t_canvas* x, t_binbuf* b)
772 {
773  t_gobj* g2; // *last,*newgobj,
774  int dspstate = canvas_suspend_dsp(), nbox, count;
775  t_symbol* asym = gensym("#A");
776  /* save and clear bindings to symbols #a, $N, $X; restore when done */
777  t_pd *boundx = s__X.s_thing, *bounda = asym->s_thing,
778  *boundn = s__N.s_thing;
779  asym->s_thing = 0;
780  s__X.s_thing = &x->gl_pd;
781  s__N.s_thing = 0; //&pd_canvasmaker;
782 
783  canvas_editmode(x, 1.);
784  glist_noselect(x);
785  for (g2 = x->gl_list, nbox = 0; g2; g2 = g2->g_next)
786  nbox++;
787 
788  // paste_onset = nbox;
789  // paste_canvas = x;
790 
791  canvas_setargs(0, 0);
792  binbuf_eval(b, 0, 0, 0);
793  for (g2 = x->gl_list, count = 0; g2; g2 = g2->g_next, count++)
794  if (count >= nbox)
795  glist_select(x, g2);
796  // paste_canvas = 0;
797  canvas_resume_dsp(dspstate);
798  canvas_dirty(x, 1);
799  if (x->gl_mapped)
800  sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x);
801  // if (!sys_noloadbang)
802  // glist_donewloadbangs(x);
803  asym->s_thing = bounda;
804  s__X.s_thing = boundx;
805  s__N.s_thing = boundn;
806 }
EXTERN int canvas_suspend_dsp(void)
EXTERN t_symbol * canvas_getdir(t_glist *x)
map< string, string > getMethodNames()
Definition: oop_common.h:136
AtomList getPropertyList()
Definition: oop_common.h:308
EXTERN void canvas_dirty(t_canvas *x, t_floatarg n)
map< string, string > getPropertyNames()
Definition: oop_common.h:140
EXTERN t_binbuf * binbuf_new(void)
EXTERN void outlet_bang(t_outlet *x)
Definition: oop_common.h:41
void freeMethod(t_symbol *methodName)
Definition: oop_common.h:512
Definition: ceammc_atom.h:23
void freeMethodPointerOutlet(string referenceName)
Definition: oop_common.h:248
t_outlet * getMethodPointerOutletForReferenceName(string referenceName)
Definition: oop_common.h:227
t_namelist * ce_path
Definition: oop_common.h:46
void freeMethodOutlet(string referenceName)
Definition: oop_common.h:243
EXTERN void glist_select(t_glist *x, t_gobj *y)
EXTERN t_symbol * canvas_getcurrentdir(void)
Definition: m_pd.h:179
t_canvas * canvas
Definition: oop_common.h:380
AtomList getPropertyList()
Definition: oop_common.h:579
void freeSignal(t_symbol *signalName)
Definition: oop_common.h:542
EXTERN int binbuf_read_via_canvas(t_binbuf *b, char *filename, t_canvas *canvas, int crflag)
Definition: m_pd.h:209
t_symbol * ce_dir
Definition: oop_common.h:42
~OPInstance()
Definition: oop_common.h:481
t_outlet * getMethodOutletForReferenceName(string referenceName)
Definition: oop_common.h:216
void addMethodPointerOutlet(string referenceName, t_outlet *outlet)
Definition: oop_common.h:210
AtomList getSignalList()
Definition: oop_common.h:330
void freeInstanceOut(t_outlet *outlet)
Definition: oop_common.h:596
GlobalData< OPClass * > OPClasses
class prototype
Definition: oop_common.h:343
EXTERN void glist_noselect(t_glist *x)
OPInstance(OPClass *_opclass)
Definition: oop_common.h:387
#define t_canvas
Definition: m_pd.h:205
static OPInstance * findByCanvas(t_canvas *canvas)
Definition: oop_common.h:740
void output(t_outlet *x) const
AtomList getDynamicMethodList()
Definition: oop_common.h:705
string class_name
Definition: oop_common.h:93
void readFile(string fileName, t_canvas *parent_canvas)
Definition: oop_common.h:151
void freeProperty(string propertyName)
Definition: oop_common.h:258
int ce_argc
Definition: oop_common.h:43
t_canvas * canvas
Definition: oop_common.h:95
t_sample * getBufferFor(t_symbol *signalName, int vec_size)
Definition: oop_common.h:529
void append(const Atom &a)
int ce_dollarzero
Definition: oop_common.h:45
void addProperty(string propertyName, string referenceName)
Definition: oop_common.h:253
GlobalData< OPInstance * > OPInstanceByCanvas
Definition: oop_common.h:348
struct _gobj * g_next
Definition: m_pd.h:212
string to_string(const T &t)
Definition: oop_common.h:32
void callSetter(AtomList list)
Definition: oop_common.h:634
PD_FLOATTYPE t_sample
Definition: m_pd.h:574
AtomList getAtomListProperty(t_symbol *propertyName)
Definition: oop_common.h:572
EXTERN t_symbol * gensym(const char *s)
void callMethod(AtomList list)
Definition: oop_common.h:608
static OPClass * findByCanvas(t_canvas *canvas)
Definition: oop_common.h:265
t_symbol * symbol
Definition: oop_common.h:96
EXTERN void canvas_free(t_canvas *x)
EXTERN void canvas_saveto(t_canvas *x, t_binbuf *b)
GlobalData< OPClass * > OPClassByCanvas
Definition: oop_common.h:77
void addMethod(t_symbol *methodName, t_outlet *outlet)
Definition: oop_common.h:507
vector< t_outlet * > OPOutputs
vector of method boxes outputs
Definition: oop_common.h:71
int getRefCount()
Definition: oop_common.h:734
static OPClass * findBySymbol(t_symbol *symbol)
Definition: oop_common.h:274
void setParentClass(OPClass *p_class)
Definition: oop_common.h:285
AtomList getMethodList()
Definition: oop_common.h:319
Definition: oop_common.h:352
t_atom * toPdData() const
#define t_binbuf
Definition: m_pd.h:195
void addMethodOutlet(string referenceName, t_outlet *outlet)
Definition: oop_common.h:204
EXTERN void canvas_setargs(int argc, t_atom *argv)
OPClass(string className)
Definition: oop_common.h:104
void retain()
Definition: oop_common.h:718
void callGetter(AtomList list)
Definition: oop_common.h:668
OPClass()
Definition: oop_common.h:99
Definition: ceammc_atomlist.h:29
EXTERN void canvas_setcurrent(t_canvas *x)
EXTERN void * getbytes(size_t nbytes)
static OPInstance * findBySymbol(t_symbol *symbol)
Definition: oop_common.h:746
#define t_canvasenvironment
Definition: g_canvas.h:77
#define t_outlet
Definition: m_pd.h:189
void multipleOutput(AtomList list)
Definition: oop_common.h:601
OPClass * getParentClass()
Definition: oop_common.h:290
void addMethodPointerOut(t_symbol *methodName, t_outlet *outlet)
Definition: oop_common.h:517
t_class * t_pd
Definition: m_pd.h:207
Definition: oop_common.h:81
Definition: m_pd.h:110
EXTERN void canvas_vis(t_canvas *x, t_floatarg f)
EXTERN void canvas_loadbang(t_canvas *x)
void setAtomListProperty(t_symbol *propertyName, AtomList list)
Definition: oop_common.h:567
EXTERN void post(const char *fmt,...)
EXTERN void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv)
EXTERN t_symbol s__X
Definition: m_pd.h:276
size_t size() const
struct _class ** s_thing
Definition: m_pd.h:113
void release()
Definition: oop_common.h:725
void freeSignal(string signalName)
Definition: oop_common.h:302
char * s_name
Definition: m_pd.h:112
void freeMethod(string methodName)
Definition: oop_common.h:238
t_atom * ce_argv
Definition: oop_common.h:44
EXTERN void canvas_resume_dsp(int oldstate)
AtomList getMethodList()
Definition: oop_common.h:694
void writeFile(string fileName, t_canvas *parent_canvas)
Definition: oop_common.h:185
EXTERN int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag)
vector< t_object * > OPProperties
vector of property boxes
Definition: oop_common.h:72
AtomList slice(int start) const
void addMethod(string methodName, string referenceName)
Definition: oop_common.h:199
EXTERN t_symbol s__N
Definition: m_pd.h:275
EXTERN void canvas_editmode(t_canvas *x, t_floatarg state)
EXTERN void sys_vgui(const char *fmt,...)
EXTERN void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp)
OPInstance * parent
Definition: oop_common.h:385
EXTERN void glist_delete(t_glist *x, t_gobj *y)
GlobalData< OPClass * > OPClassBySymbol
Definition: oop_common.h:79
void addSignal(string signalName, string referenceName)
Definition: oop_common.h:297
void addInstanceOut(t_outlet *outlet)
Definition: oop_common.h:592
t_symbol * symbol
Definition: oop_common.h:382
void freeMethodPointerOut(t_symbol *methodName)
Definition: oop_common.h:522
EXTERN void * subcanvas_new(t_symbol *s)
string class_name
Definition: oop_common.h:379
map< string, t_outlet * > getMethodOutlets()
Definition: oop_common.h:144
void freeProperty(t_symbol *propertyName)
Definition: oop_common.h:559
GlobalData< OPInstance * > OPInstanceBySymbol
Definition: oop_common.h:350
void addProperty(t_symbol *propertyName, t_outlet *getter_out, t_outlet *setter_out)
Definition: oop_common.h:552