Jamoma API  0.6.0.a19
PureData/source/j.parameter_array/j.parameter_array.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup implementationPdExternals
4  *
5  * @brief j.parameter_array / j.message_array / j.return_array : An array of nodes in a model
6  *
7  * @details
8  *
9  * @authors Théo de la Hogue, Trond Lossius, Antoine Villeret
10  *
11  * @copyright © 2010 by Théo de la Hogue @n
12  * Copyright © 2015, Antoine Villeret@n
13  * This code is licensed under the terms of the "New BSD License" @n
14  * http://creativecommons.org/licenses/BSD/
15  */
16 
17 
19 
20 #define data_out 0
21 #define index_out 1
22 #define dump_out 2
23 
24 
25 // This is used to store extra data
26 typedef struct extra {
27 
28  TTBoolean changingAddress; // a flag to protect from succession of address changes
29  TTListPtr objectsSorted; // all objects sorted by index
30 
31 } t_extra;
32 #define EXTRA ((t_extra*)x->extra)
33 
34 
35 // Definitions
36 void WrapTTDataArrayClass(WrappedClassPtr c);
37 void WrappedDataArrayClass_new(TTPtr self, long argc, t_atom *argv);
38 void WrappedDataArrayClass_free(TTPtr self);
39 
40 void data_assist(TTPtr self, TTPtr b, long msg, long arg, char *dst);
41 
42 void data_array_build(TTPtr self, t_symbol *msg, long argc, t_atom *argv);
43 void data_array_build_index(TTPtr self, TTObject& returnedData, TTSymbol service, TTUInt32 index);
44 void data_address(TTPtr self, t_symbol *name);
45 
46 void data_array_return_value(const TTValue& baton, const TTValue& v);
47 void data_edit_array(TTPtr self, TTValue& array);
48 
49 void WrappedDataArrayClass_anything(TTPtr self, t_symbol *msg, long argc, t_atom *argv);
50 void data_bang(TTPtr self);
51 void data_float(TTPtr self, t_float value);
52 void data_list(TTPtr self, t_symbol *msg, long argc, const t_atom *argv);
53 
54 void data_array(TTPtr self, t_symbol *msg, long argc, const t_atom *argv);
55 
56 void data_inc(TTPtr self, t_symbol *msg, long argc, const t_atom *argv);
57 void data_dec(TTPtr self, t_symbol *msg, long argc, const t_atom *argv);
58 
59 #if defined(JMOD_RETURN)
60 extern "C" void JAMOMA_EXPORT_MAXOBJ setup_j0x2ereturn_array(void)
61 #elif defined(JMOD_MESSAGE)
62 extern "C" void JAMOMA_EXPORT_MAXOBJ setup_j0x2emessage_array(void)
63 #else
64 extern "C" void JAMOMA_EXPORT_MAXOBJ setup_j0x2eparameter_array(void)
65 #endif
66 {
67  ModularSpec *spec = new ModularSpec;
68  spec->_wrap = &WrapTTDataArrayClass;
69  spec->_new = &WrappedDataArrayClass_new;
70  spec->_free = &WrappedDataArrayClass_free;
71  spec->_any = &WrappedDataArrayClass_anything;
72  spec->_notify = NULL;
73 
74 #if defined(JMOD_MESSAGE)
75  return (void)wrapTTModularClassAsPdClass(kTTSym_Data, "j.message_array", NULL, spec);
76 #elif defined(JMOD_RETURN)
77  return (void)wrapTTModularClassAsPdClass(kTTSym_Data, "j.return_array", NULL, spec);
78 #else
79  return (void)wrapTTModularClassAsPdClass(kTTSym_Data, "j.parameter_array", NULL, spec);
80 #endif
81 }
82 
83 void WrapTTDataArrayClass(WrappedClassPtr c)
84 {
85  eclass_addmethod(c->pdClass, (method)data_assist, "assist", A_CANT, 0L);
86 
87  eclass_addmethod(c->pdClass, (method)data_bang, "bang", A_NULL, 0L);
88  eclass_addmethod(c->pdClass, (method)data_float, "float", A_FLOAT, 0);
89  eclass_addmethod(c->pdClass, (method)data_list, "list", A_GIMME, 0);
90 
91  eclass_addmethod(c->pdClass, (method)data_array, "array", A_GIMME, 0);
92 
93  eclass_addmethod(c->pdClass, (method)data_inc, "+", A_GIMME, 0);
94  eclass_addmethod(c->pdClass, (method)data_dec, "-", A_GIMME, 0);
95 
96  eclass_addmethod(c->pdClass, (method)data_address, "address", A_SYM,0);
97 // eclass_addmethod(c->pdClass, (method)data_array_build, "loadbang", A_SYM,0);
98 
99 }
100 
101 void WrappedDataArrayClass_new(TTPtr self, long argc, t_atom *argv)
102 {
104  t_symbol *relativeAddress;
105  long attrstart = attr_args_offset(argc, argv); // support normal arguments
106  TTValue none;
107 
108  // check address argument
109  relativeAddress = _sym_nothing;
110  if (attrstart && argv)
111  if (atom_gettype(argv) == A_SYM)
112  relativeAddress = atom_getsym(argv);
113 
114  if (relativeAddress == _sym_nothing) {
115  pd_error((t_object*)x, "j.parameter|j.message need a name as first argument" );
116  x->extra = NULL;
117  return;
118  }
119 
120  // add an inlet for the index
121  x->inlets = (TTHandle)sysmem_newptr(sizeof(TTPtr) * 1);
122 // x->inlets[0] = proxy_new(x, 1, &x->index); // use this member to store index (because index is used for data array)
123  x->inlets[0] = eobj_proxynew(x);
124  x->index = 1;
125 
126  // Make outlets (before attr_args_process)
127  /////////////////////////////////////////////////////////////////////////////////
128 
129  // Don't create outlets during dynamic changes
130  x->outlets = (TTHandle)sysmem_newptr(sizeof(TTPtr) * 2);
131  x->outlets[index_out] = outlet_new((t_object*)x, NULL); // long outlet to output data index
132  x->outlets[data_out] = outlet_new((t_object*)x, NULL); // anything outlet to output data
133 
134  x->useInternals = YES;
135  // x->internals->setThreadProtection(YES); // TODO this crashes if a j.model exists when instanciating j.*_array object
136 
137  x->arraySize = 0;
138  x->arrayIndex = 0;
139  x->arrayAddress = kTTAdrsEmpty;
140  // x->arrayArgs = none; // TODO this crashes if a j.model exists when instanciating j.*_array object
141  x->arrayAttrFormat = gensym("single");
142 
143  // Prepare extra data for parameters and messages
144  x->extra = (t_extra*)malloc(sizeof(t_extra));
145 
146  EXTRA->changingAddress = NO;
147  EXTRA->objectsSorted = new TTList();
148 
149  // handle args
150  if (argc && argv) {
151 
152  // set the external attribute
153  attr_args_process(x, argc, argv);
154 
155  // keep args to set the wrapped object attributes
156  if (argc > 1)
157  jamoma_ttvalue_from_Atom(x->arrayArgs, _sym_list, argc--, argv++);
158  }
159 
160  // set array address and parse number between brackets
161  x->arrayAddress = relativeAddress->s_name;
162  if (x->arrayAddress.getType() != kAddressRelative)
163  {
164  x->arrayAddress = kTTAdrsEmpty;
165  pd_error((t_object*)x, "can't register because %s is not a relative address", relativeAddress->s_name);
166  }
167 
168  t_atom number;
169  atom_setlong(&number, jamoma_parse_bracket(relativeAddress, x->arrayFormatInteger, x->arrayFormatString));
170 
171  // The following must be deferred because we have to interrogate our box,
172  // and our box is not yet valid until we have finished instantiating the object.
173  // Trying to use a loadbang method instead is also not fully successful (as of Max 5.0.6)
174  // data_array_build(x, _sym_nothing, 1, &number);
175 // defer_low((t_object*)x, (method)data_array_build, _sym_nothing, 1, &number);
176 }
177 
178 void WrappedDataArrayClass_free(TTPtr self)
179 {
181 
182  if (EXTRA) {
183 
184  delete EXTRA->objectsSorted;
185  free(EXTRA);
186  }
187 }
188 
189 void data_array_build(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
190 {
192 
193  t_symbol *instanceAddress;
194  TTObject anObject;
195 
196  TTUInt32 newSize = atom_getlong(argv);
197  TTUInt32 lastSize = x->arraySize;
198 
199  if (newSize > MAX_ARRAY_SIZE)
200  {
201  pd_error((t_object*)x, "the size is greater than the maximum array size (%d)", MAX_ARRAY_SIZE);
202  return;
203  }
204 
205  x->arraySize = newSize;
206  x->cursor = kTTSymEmpty;
207 
208  // Starts iteration on internals
209  x->iterateInternals = YES;
210 
211  // if the array size increase : build only new index
212  if (newSize > lastSize)
213  {
214  for (TTUInt32 i = lastSize + 1; i <= newSize; i++)
215  {
216  jamoma_edit_numeric_instance(x->arrayFormatInteger, &instanceAddress, i);
217 
218  // create a data
219 #if defined(JMOD_MESSAGE)
220  data_array_build_index(self, anObject, kTTSym_message, i);
221 #elif defined(JMOD_RETURN)
222  data_array_build_index(self, anObject, kTTSym_return, i);
223 #else
224  data_array_build_index(self, anObject, kTTSym_parameter, i);
225 #endif
226  // append the data to the internals table (without subscriber)
227  TTValue cache(anObject);
228  cache.append(TTSymbol(instanceAddress->s_name));
229 
230  x->internals->append(TTSymbol(instanceAddress->s_name), cache);
231 
232  // inverse objects order for iteration purpose (see in data_array_return_value : array mode)
233  EXTRA->objectsSorted->insert(0, anObject);
234  }
235  }
236 
237  // if the array size decrease : delete only former index
238  else
239  {
240  for (TTUInt32 i = lastSize; i > newSize; i--)
241  {
242  jamoma_edit_numeric_instance(x->arrayFormatInteger, &instanceAddress, i);
243 
244  TTValue cache;
245  x->internals->lookup(TTSymbol(instanceAddress->s_name), cache);
246  anObject = cache[0];
247 
248  // remove the data from the internal table (this will also unregister the data as the subscriber is stored into the table)
249  x->internals->remove(TTSymbol(instanceAddress->s_name));
250 
251  // remove objects from the beginning because they are ordered for iteration purpose (see in data_array_return_value : array mode)
252  EXTRA->objectsSorted->getIndex(0, cache);
253  EXTRA->objectsSorted->remove(cache);
254  cache.clear();
255 
256  if (anObject.instance()->getReferenceCount() > 1)
257  pd_error((t_object*)x, "there are still unreleased reference of a %s wrappedObject(refcount = %d)", instanceAddress->s_name, anObject.instance()->getReferenceCount() - 1);
258  }
259  }
260 
261  // Ends iteration on internals
262  x->iterateInternals = NO;
263 
264  // handle args BEFORE to subscribe the object
265  // TODO : for new index only
266  long ac = 0;
267  t_atom *av = NULL;
268  jamoma_ttvalue_to_Atom(x->arrayArgs, &ac, &av);
269  if (ac && av)
270  attr_args_process(x, ac, av);
271  if (av){
272  delete[] av;
273  av=NULL;
274  }
275 
276  // Starts iteration on internals
277  x->iterateInternals = YES;
278 
279  // subscribe (and init) new index only
280  for (TTUInt32 i = lastSize + 1; i <= newSize; i++)
281  {
282  // select data at index
283  jamoma_edit_numeric_instance(x->arrayFormatInteger, &instanceAddress, i);
284 
285  TTValue cache;
286  x->internals->lookup(TTSymbol(instanceAddress->s_name), cache);
287  anObject = cache[0];
288 
289  // subscribe the data
290  TTAddress returnedAddress;
291  TTNodePtr returnedNode = NULL;
292  TTNodePtr returnedContextNode = NULL;
293  TTObject aSubscriber;
294 
295  if (!jamoma_subscriber_create((t_eobj*)x, anObject, TTAddress(instanceAddress->s_name), aSubscriber, returnedAddress, &returnedNode, &returnedContextNode))
296  {
297  if (aSubscriber.valid())
298  {
299  // append the subscriber to the internals table
300  x->internals->remove(TTSymbol(instanceAddress->s_name));
301 
302  cache.append(aSubscriber);
303  x->internals->append(TTSymbol(instanceAddress->s_name), cache);
304  }
305  }
306 
307 #ifndef JMOD_MESSAGE
308  anObject.send("Init");
309 #endif
310  }
311 
312  // Ends iteration on internals
313  x->iterateInternals = NO;
314 
315  // select all datas
316  if (x->arraySize > 0)
317  wrappedModularClass_ArraySelect(self, gensym("*"), 0, NULL);
318 }
319 
320 void data_array_build_index(TTPtr self, TTObject& returnedData, TTSymbol service, TTUInt32 index)
321 {
323  t_symbol *iAdrs;
324  TTValue baton;
325 
326  returnedData = TTObject(kTTSym_Data, service);
327 
328  jamoma_edit_numeric_instance(x->arrayFormatInteger, &iAdrs, index);
329 
330  baton = TTValue(self, index, TTSymbol(iAdrs->s_name));
331  returnedData.set(kTTSym_baton, baton);
332  returnedData.set(kTTSym_function, TTPtr(&data_array_return_value));
333 }
334 
335 void data_address(TTPtr self, t_symbol *address)
336 {
338 
339  // Avoid succession of address changes
340  if (!EXTRA->changingAddress)
341  {
342  EXTRA->changingAddress = YES;
343 
344  // filter repetitions
345  if (!(x->arrayAddress == TTAddress(address->s_name)))
346  {
347  if (!x->iterateInternals)
348  {
349  // set array address and parse number between brackets
350  x->arrayAddress = address->s_name;
351  if (x->arrayAddress.getType() != kAddressRelative)
352  {
353  x->arrayAddress = kTTAdrsEmpty;
354  pd_error((t_object*)x, "can't register because %s is not a relative address", address->s_name);
355  }
356 
357  t_atom number;
358  TTString newArrayFormatInteger;
359  TTString newArrayFormatString;
360  atom_setlong(&number, jamoma_parse_bracket(address, newArrayFormatInteger, newArrayFormatString));
361 
362  // if the address format change
363  if (newArrayFormatInteger != x->arrayFormatInteger &&
364  newArrayFormatString != x->arrayFormatString &&
365  x->arraySize > 0)
366  {
367  // delete all formers addresses
368  t_atom zero;
369  atom_setlong(&zero, 0);
370  data_array_build(self, _sym_nothing, 1, &zero);
371 // defer(self,(method)data_array_build, _sym_nothing, 1, &zero);
372  }
373 
374  x->arrayFormatInteger = newArrayFormatInteger;
375  x->arrayFormatString = newArrayFormatString;
376 
377  // build internals
378  data_array_build(self, _sym_nothing, 1, &number);
379 // defer(self,(method)data_array_build, _sym_nothing, 1, &number);
380 
381  // for array mode : output the array once afterward
382  if (x->arrayAttrFormat == gensym("array"))
383  {
384  TTValue array;
385  t_symbol *msg;
386  long argc = 0;
387  t_atom *argv = NULL;
388  TTBoolean shifted = NO;
389 
390  data_edit_array(self, array);
391 
392  jamoma_ttvalue_to_typed_Atom(array, &msg, &argc, &argv, shifted);
393 
394  // avoid blank before data
395  if (msg == _sym_nothing)
396  outlet_anything((t_outlet*)x->outlets[data_out], NULL, argc, argv);
397  else
398  outlet_anything((t_outlet*)x->outlets[data_out], msg, argc, argv);
399 
400  if (shifted)
401  argv--;
402  sysmem_freeptr(argv);
403  }
404  }
405  }
406 
407  EXTRA->changingAddress = NO;
408  return;
409  }
410 
411  pd_error((t_object*)x, "can't change to %s address. Please defer low", address->s_name);
412 }
413 
414 // Method for Assistance Messages
415 void data_assist(TTPtr self, TTPtr b, long msg, long arg, char *dst)
416 {
417  if (msg == 1) { // Inlet
418  switch(arg) {
419  case 0 :
420  strcpy(dst, "set the value of the selected instance(s)");
421  break;
422  case 1 :
423  strcpy(dst, "index (use * to bind all instances)");
424  break;
425  }
426  }
427  else { // Outlets
428  switch(arg) {
429  case data_out:
430  strcpy(dst, "direct: values");
431  break;
432  case index_out:
433  strcpy(dst, "index");
434  break;
435  case dump_out:
436  strcpy(dst, "dumpout");
437  break;
438  }
439  }
440 }
441 
442 void data_bang(TTPtr self)
443 {
445 
446  if (!x->internals->isEmpty()) {
447  data_list(self, _sym_bang, 0, NULL);
448  }
449  else
450  pd_error((t_object*)x, "bang : the array is empty");
451 }
452 
453 void data_float(TTPtr self, t_float value)
454 {
456  t_atom a;
457 
458  if (!x->internals->isEmpty()) {
459  atom_setfloat(&a, value);
460  data_list(self, _sym_float, 1, &a);
461  }
462  else
463  pd_error((t_object*)x, "float : the array is empty");
464 }
465 
466 void data_list(TTPtr self, t_symbol *msg, long argc, const t_atom *argv)
467 {
469  TTObject o;
470 
471  if (!x->internals->isEmpty()) {
472 
473  // send to each data
474  if (x->arrayIndex == 0) {
475 
476  TTValue keys;
477 
478  x->internals->getKeys(keys);
479  for (TTUInt32 i = 0; i < keys.size(); i++) {
480  x->cursor = keys[i];
481  o = selectedObject;
482  jamoma_data_command(o, msg, argc, argv);
483  }
484 
485  // watch an instance by default
486  x->cursor = keys[0];
487  }
488  else {
489  o = selectedObject;
490  jamoma_data_command(o, msg, argc, argv);
491  }
492 
493  }
494  else
495  pd_error((t_object*)x, "list : the array is empty");
496 }
497 
498 void WrappedDataArrayClass_anything(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
499 {
501  TTObject o;
502 
503  if (x->inlets[0])
504  wrappedModularClass_ArraySelect(self, msg, argc, argv);
505  else
506  data_list(self, msg, argc, argv);
507 }
508 
509 void data_array(TTPtr self, t_symbol *msg, long argc, const t_atom *argv)
510 {
512  TTInt32 d, i;
513  t_symbol *instanceAddress;
514  TTSymbol memoCursor;
515 
516  if (!x->internals->isEmpty()) {
517 
518  // is the incoming data size is a multiple of the array size ?
519  // TODO why not mod ?
520  d = argc / x->arraySize;
521  if ((d * x->arraySize) == argc) {
522 
523  memoCursor = x->cursor;
524 
525  for (i = 1; i <= (TTInt32) x->arraySize; i++) {
526 
527  jamoma_edit_numeric_instance(x->arrayFormatInteger, &instanceAddress, i);
528  x->cursor = TTSymbol(instanceAddress->s_name);
529  TTObject o = selectedObject;
530  jamoma_data_command(o, _sym_nothing, d, argv+((i-1)*d));
531  }
532 
533  x->cursor = memoCursor;
534  }
535  else
536  pd_error((t_object*)x, "array : the array message size have to be a multiple of the array size");
537 
538  }
539  else
540  pd_error((t_object*)x, "array : the array is empty");
541 }
542 
543 void data_inc(TTPtr self, t_symbol *msg, long argc, const t_atom *argv)
544 {
546  TTValue v, none;
547 
548  jamoma_ttvalue_from_Atom(v, _sym_nothing, argc, argv);
549  selectedObject->sendMessage(TTSymbol("Inc"), v, none);
550 }
551 
552 void data_dec(TTPtr self, t_symbol *msg, long argc, const t_atom *argv)
553 {
555  TTValue v, none;
556 
557  jamoma_ttvalue_from_Atom(v, _sym_nothing, argc, argv);
558  selectedObject->sendMessage(TTSymbol("Dec"), v, none);
559 }
560 
561 void data_array_return_value(const TTValue& baton, const TTValue& v)
562 {
564  TTValue array;
565  t_symbol *msg;
566  TTUInt32 i;
567  long argc = 0;
568  t_atom *argv = NULL;
569  TTBoolean shifted = NO;
570 
571  // unpack baton (a t_object, the index of the value and the instance symbol)
572  x = WrappedModularInstancePtr((TTPtr)baton[0]);
573  i = baton[1];
574 
575  // output index
576  if (x->arrayIndex == 0)
577  x->cursor = baton[2];
578 
579  outlet_int((t_outlet*)x->outlets[index_out], i);
580 
581  // in array output mode
582  // edit a value containing all values
583  if (x->arrayAttrFormat == gensym("array")) {
584 
585  // don't output array when changing address
586  if (EXTRA->changingAddress)
587  return;
588 
589  data_edit_array(x, array);
590 
591  jamoma_ttvalue_to_typed_Atom(array, &msg, &argc, &argv, shifted);
592  }
593  else
594  // output single value
595  jamoma_ttvalue_to_typed_Atom(v, &msg, &argc, &argv, shifted);
596 
597  // avoid blank before data
598  if (msg == _sym_nothing)
599  outlet_anything((t_outlet*)x->outlets[data_out], NULL, argc, argv);
600  else
601  outlet_anything((t_outlet*)x->outlets[data_out], msg, argc, argv);
602 
603  if (shifted)
604  argv--;
605  sysmem_freeptr(argv);
606 }
607 
608 void data_edit_array(TTPtr self, TTValue& array)
609 {
611  TTValue keys, object, grab, t;
612  TTSymbol key, type;
613  TTObject aData;
614 
615  // get each value from the data object itself
616  for (EXTRA->objectsSorted->begin();
617  EXTRA->objectsSorted->end();
618  EXTRA->objectsSorted->next()) {
619 
620  aData = EXTRA->objectsSorted->current()[0];
621 
622  // try to get the value or the value default
623  if (aData.get(kTTSym_value, grab))
624  aData.get(kTTSym_valueDefault, grab);
625 
626  // if there is no value
627  if (grab.size() == 0) {
628 
629  aData.get(kTTSym_type, t);
630 
631  type = t[0];
632 
633  if (type == kTTSym_string)
634  grab = kTTSym_none;
635  else
636  grab = 0;
637  }
638 
639  array.prepend(grab);
640  }
641 }
642 
643 t_max_err data_get_format(TTPtr self, TTPtr attr, long *ac, t_atom **av)
644 {
646 
647  if ((*ac)&&(*av)) {
648  //memory passed in, use it
649  } else {
650  //otherwise allocate memory
651  *ac = 1;
652  if (!(*av = (t_atom*)getbytes(sizeof(t_atom)*(*ac)))) {
653  *ac = 0;
654  return -4; // MAX_ERR_OUT_OF_MEM;
655  }
656  }
657 
658  atom_setsym(*av, x->arrayAttrFormat);
659 
660  return 0; // MAX_ERR_NONE;
661 }
662 
663 t_max_err data_set_format(TTPtr self, TTPtr attr, long ac, t_atom *av)
664 {
666 
667  if (ac&&av) {
668  x->arrayAttrFormat = atom_getsym(av);
669  } else {
670  // no args, set to single
671  x->arrayAttrFormat = gensym("single");
672  }
673  return 0; // MAX_ERR_NONE;
674 }
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
TTErr send(const TTSymbol aName)
Send a message to this object with no arguments.
Definition: TTObject.cpp:135
void JAMOMA_EXPORT jamoma_edit_numeric_instance(TTString format, t_symbol **returnedName, long i)
Edit a new instance of the given format address using interger.
TTHandle outlets
an array of outlet
TTErr lookup(const TTSymbol key, TTValue &value)
Find the value for the given key.
Definition: TTHash.cpp:76
We build a directory of TTNodes, and you can request a pointer for any TTNode, or add an observer to ...
Definition: TTNode.h:59
The TTAddress class is used to represent a string and efficiently pass and compare that string...
Definition: TTAddress.h:29
Create and use Jamoma object instances.
Definition: TTObject.h:29
size_type size() const noexcept
Return the number of elements.
Data structure for storing extra data.
void * extra
used to keep very specific things
this flag means that an address have no leading slash
Definition: TTAddressBase.h:64
TTErr getKeys(TTValue &hashKeys)
Get an array of all of the keys for the hash table.
Definition: TTHash.cpp:126
TTHashPtr internals
An hash table to store any internal TTObjectBases (like TTData, TTViewer, ...)
void prepend(const TTValue &aValueToPrepend)
Insert another TTValue before the first element.
Definition: TTValue.h:162
void append(const T &anElementValueToAppend)
Insert a single TTElement at the end.
Definition: TTValue.h:243
void * TTPtr
A generic pointer.
Definition: TTBase.h:248
TTErr get(const TTSymbol aName, T &aReturnedValue) const
Get an attribute value for an object.
void data_inc(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
Increase parameter value in steps.
void JAMOMA_EXPORT jamoma_ttvalue_to_Atom(const TTValue &v, long *argc, t_atom **argv)
Make an Atom array from a TTValue.
TTErr set(const TTSymbol aName, T aValue)
Set an attribute value for an object.
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
TTErr append(const TTSymbol key, const TTValue &value)
Insert an item into the hash table.
Definition: TTHash.cpp:70
TTHandle inlets
an array of inlets
TTErr JAMOMA_EXPORT jamoma_data_command(TTObject &aData, t_symbol *msg, long argc, const t_atom *argv)
Set the TTData value attribute using the #TTData::Command method.
TTBoolean iterateInternals
The flag is true when an iteration is done on the internals.
TTBoolean isEmpty()
Return true if the hash has nothing stored in it.
Definition: TTHash.cpp:205
void JAMOMA_EXPORT jamoma_ttvalue_to_typed_Atom(const TTValue &v, t_symbol **msg, long *argc, t_atom **argv, TTBoolean &shifted)
Make a typed Atom array from a TTValue.
void data_list(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
Process an incoming message containing a list.
std::int32_t TTInt32
32 bit signed integer
Definition: TTBase.h:177
void JAMOMA_EXPORT jamoma_ttvalue_from_Atom(TTValue &v, t_symbol *msg, long argc, const t_atom *argv)
Make a TTValue from Atom array.
void data_bang(TTPtr self)
Process an incoming 'bang' message.
void clear()
Clear all values from the vector, leaving with size of 0.
Definition: TTValue.h:131
Wraps Jamoma Core classes as objects for PureData.
Data Structure for this object.
TTErr remove(const TTSymbol key)
Remove an item from the hash table.
Definition: TTHash.cpp:108
std::uint32_t TTUInt32
32 bit unsigned integer
Definition: TTBase.h:178
TTBoolean useInternals
The hash table can be used as an array of wrappedObject.
void data_dec(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
Decrease parameter value in steps.
TTObjectBase * instance() const
Return a direct pointer to the internal instance.
Definition: TTObject.cpp:105
TTErr JAMOMA_EXPORT jamoma_subscriber_create(t_object *x, TTObject &anObject, TTAddress relativeAddress, TTObject &returnedSubscriber, TTSymbol &returnedAddress, TTNodePtr *returnedNode, TTNodePtr *returnedContextNode)
Create a #TTSubscriber object and register a TTObject into the tree or, if aTTObject is NULL...
The TTString class is used to represent a string.
Definition: TTString.h:34
TTUInt32 JAMOMA_EXPORT jamoma_parse_bracket(t_symbol *s, TTString &si_format, TTString &ss_format)
Returned the N inside "pp/xx.[N]/yyy" and a format string as "pp/xx.%d/yy" and a format string as "pp...
long index
index of the inlet used
TTSymbol cursor
to select an entry in x->internals
void data_float(TTPtr self, double value)
Process an incoming float value.
void data_assist(TTPtr self, TTPtr b, long msg, long arg, char *dst)
Provide assistance on input and output while patching.
TTBoolean valid() const
Determine if the object contained by this TTObject is truly ready for use.
Definition: TTObject.cpp:179
WrappedModularInstance * WrappedModularInstancePtr
Pointer to a wrapped instance of our object.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
TTUInt16 getReferenceCount()
Query an object to get its current reference count.
Definition: TTObjectBase.h:144
TTErr wrapTTModularClassAsPdClass(TTSymbol &ttblueClassName, const char *pdClassName, WrappedClassPtr *c, ModularSpec *specificities)
Wrap a Jamoma class as a Pd class.