Jamoma API  0.6.0.a19
TTMatrixBase.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup foundationLibrary
4  *
5  * @brief 2-dimensional matrix of compound values with N elements each.
6  *
7  * @author Timothy Place & Nathan Wolek
8  *
9  * @copyright Copyright © 2011-2012, Timothy Place & Nathan Wolek @n
10  * This code is licensed under the terms of the "New BSD License" @n
11  * http://creativecommons.org/licenses/BSD/
12  */
13 
14 #include "TTMatrixBase.h"
15 #include "TTEnvironment.h"
16 #include "TTBase.h"
17 
18 #define thisTTClass TTMatrixBase
19 #define thisTTClassName "matrix"
20 #define thisTTClassTags "matrix"
21 
22 
24  mData(NULL),
25  mRowCount(1), // initialize to a 1x1 matrix by default (maybe we should be using the args?)
26  mColumnCount(1), // initialize to a 1x1 matrix by default (maybe we should be using the args?)
27  mElementCount(1),
28  mComponentCount(1),
29  mComponentStride(1),
30  mDataCount(0),
31  mType(kTypeUInt8),
32  mTypeSizeInBytes(1),
33  mDataSize(0),
34  mDataIsLocallyOwned(YES)
35 {
36  addAttributeWithGetterAndSetter(Dimensions, kTypeInt32); // mDimensions deprecated and not used directly
37  // setDimensions() & getDimensions() methods actually work with RowCount and ColumnCount
39  addAttributeWithSetter(ColumnCount, kTypeInt32);
40  addAttributeWithGetterAndSetter(Type, kTypeUInt8); // necessary so that public interface uses symbols
41  // internally we use TTDataType
42  addAttributeWithSetter(ElementCount, kTypeInt16);
43 
44  addMessage(clear);
48 
49  // TODO: getLockedPointer -- returns a pointer to the data, locks the matrix mutex
50  // TODO: releaseLockedPointer -- releases the matrix mutex
51  // TODO: the above two items mean we need a TTMutex member
52 
53  resize();
54 
55 
56 }
57 
58 
59 TTMatrixBase::~TTMatrixBase()
60 {
62  delete[] mData; // TODO: only do this if the refcount for the data is down to zero!
63 }
64 
65 
67 {
71 
74 
75  // TODO: currently, we are not preserving memory when resizing. Should we try to preserve the previous memory contents?
76  // TODO: thread protection
77  delete[] mData;
78  mData = new TTByte[mDataSize];
79  }
80 
81  if (mDataSize && mData)
82  {
83  return kTTErrNone;
84  } else {
85  return kTTErrAllocFailed;
86  }
87 }
88 
89 
91 {
92  if (aNewRowCount > 0)
93  {
94  mRowCount = aNewRowCount;
95  return true;
96  } else {
97  return false;
98  }
99 }
100 
101 
103 {
104  if (aNewColumnCount > 0)
105  {
106  mColumnCount = aNewColumnCount;
107  return true;
108  } else {
109  return false;
110  }
111 }
112 
113 
115 {
116  if (aNewElementCount > 0)
117  {
118  mElementCount = aNewElementCount;
119  return true;
120  } else {
121  return false;
122  }
123 }
124 
125 
127 {
128  if (ttDataTypeInfo[aNewType]->isNumerical)
129  {
130  mType = aNewType;
131  mTypeAsDataInfo = TTDataInfo::getInfoForType(aNewType);
132  mTypeAsSymbol = &(mTypeAsDataInfo->name);
133  mTypeSizeInBytes = (mTypeAsDataInfo->bitdepth / 8);
134  return true;
135  } else {
136  return false;
137  }
138 }
139 
140 
142 {
143  TTRowID aNewRowCountInt = aNewRowCount;
144 
145  if (setRowCountWithoutResize(aNewRowCountInt))
146  {
147  return resize();
148  } else {
149  return kTTErrInvalidValue;
150  }
151 }
152 
153 
155 {
156  TTColumnID aNewColumnCountInt = aNewColumnCount;
157 
158  if (setColumnCountWithoutResize(aNewColumnCountInt))
159  {
160  return resize();
161  } else {
162  return kTTErrInvalidValue;
163  }
164 }
165 
166 
168 {
169  TTElementID aNewElementCountInt = newElementCount;
170 
171  if (setElementCountWithoutResize(aNewElementCountInt))
172  {
173  return resize();
174  } else {
175  return kTTErrInvalidValue;
176  }
177 }
178 
179 
181 {
182  TTSymbol aNewTypeAsSymbol = aType;
183  TTDataType aNewDataType = TTDataInfo::matchSymbolToDataType(aNewTypeAsSymbol);
184 
185  if (setTypeWithoutResize(aNewDataType))
186  {
187  mTypeAsSymbol = aNewTypeAsSymbol; // TODO: dereferencing TTDataInfo->name not working, so this is temp solution
188  // after if{} because we should not change unless resize() will occur
189  return resize();
190  } else {
191  return kTTErrInvalidValue;
192  }
193 }
194 
195 
196 TTErr TTMatrixBase::setDimensions(const TTValue& someNewDimensions)
197 {
198  TTRowID aNewRowCount = 1;
199  TTColumnID aNewColumnCount = 1;
200 
201  TTUInt8 size = someNewDimensions.size();
202 
203  // needed to support old calls with 1 or 2 dimensions
204  if (size > 0)
205  aNewRowCount = someNewDimensions[0];
206  if (size > 1)
207  aNewColumnCount = someNewDimensions[1];
208 
209  if (this->setRowCountWithoutResize(aNewRowCount) &&
210  this->setColumnCountWithoutResize(aNewColumnCount))
211  {
212  return resize();
213  } else {
214  return kTTErrInvalidValue;
215  }
216 }
217 
218 
219 TTErr TTMatrixBase::getType(TTValue& returnedType) const
220 {
221  returnedType = mTypeAsSymbol;
222 
223  return kTTErrNone;
224 }
225 
226 
227 TTErr TTMatrixBase::getDimensions(TTValue& returnedDimensions) const
228 {
229  returnedDimensions.resize(2);
230  returnedDimensions[0] = TTUInt32(mRowCount); // compile fails if we don't cast mRowCount here
231  returnedDimensions[1] = TTUInt32(mColumnCount); // compile fails if we don't cast mColumnCount here
232 
233  return kTTErrNone;
234 }
235 
236 
238 {
239  memset(mData, 0, mDataSize);
240  return kTTErrNone;
241 }
242 
243 
244 TTErr TTMatrixBase::fill(const TTValue& anInputValue, TTValue &anUnusedOutputValue)
245 {
246  TTBytePtr fillValue = new TTByte[mComponentStride];
247  TTUInt32 inputElementCount = anInputValue.size();
248  TTUInt32 fillIterationCount = (inputElementCount < (TTUInt32) mElementCount) ? inputElementCount : (TTUInt32) mElementCount; // which ever is smaller
249 
250  // first we need to copy the TTValues in our array of TTBytes
251  TTBytePtr tempCopyValuePtr;
252  union TTNumericalDataValue {
253  TTFloat32 float32;
254  TTFloat64 float64;
255  TTInt8 int8;
256  TTUInt8 uint8;
257  TTInt16 int16;
258  TTUInt16 uint16;
259  TTInt32 int32;
260  TTUInt32 uint32;
261  TTInt64 int64;
262  TTUInt64 uint64;
263  } tempCopyValue;
264 
265 
266  for (TTUInt32 f=0; f<fillIterationCount; f++) // step through the elements
267  {
268 
269  // NW: an even uglier switch than before, but I see no way around it...
270  switch (mType) {
271  case kTypeFloat32:
272  tempCopyValue.float32 = anInputValue[f];
273  tempCopyValuePtr = (TTBytePtr)&(tempCopyValue.float32);
274  break;
275  case kTypeFloat64:
276  tempCopyValue.float64 = anInputValue[f];
277  tempCopyValuePtr = (TTBytePtr)&(tempCopyValue.float64);
278  break;
279  case kTypeInt8:
280  tempCopyValue.int8 = anInputValue[f];
281  tempCopyValuePtr = (TTBytePtr)&(tempCopyValue.int8);
282  break;
283  case kTypeUInt8:
284  tempCopyValue.uint8 = anInputValue[f];
285  tempCopyValuePtr = (TTBytePtr)&(tempCopyValue.uint8);
286  break;
287  case kTypeInt16:
288  tempCopyValue.int16 = anInputValue[f];
289  tempCopyValuePtr = (TTBytePtr)&(tempCopyValue.int16);
290  break;
291  case kTypeUInt16:
292  tempCopyValue.uint16 = anInputValue[f];
293  tempCopyValuePtr = (TTBytePtr)&(tempCopyValue.uint16);
294  break;
295  case kTypeInt32:
296  tempCopyValue.int32 = anInputValue[f];
297  tempCopyValuePtr = (TTBytePtr)&(tempCopyValue.int32);
298  break;
299  case kTypeUInt32:
300  tempCopyValue.uint32 = anInputValue[f];
301  tempCopyValuePtr = (TTBytePtr)&(tempCopyValue.uint32);
302  break;
303  case kTypeInt64:
304  tempCopyValue.int64 = anInputValue[f];
305  tempCopyValuePtr = (TTBytePtr)&(tempCopyValue.int64);
306  break;
307  case kTypeUInt64:
308  tempCopyValue.uint64 = anInputValue[f];
309  tempCopyValuePtr = (TTBytePtr)&(tempCopyValue.uint64);
310  break;
311  default:
312  return kTTErrInvalidType; // type is not numerical or undefined
313  break;
314  }
315 
316  memcpy( fillValue+(f*mTypeSizeInBytes), // pointer to where to start copying
317  tempCopyValuePtr, // the TTBytePtr from the switch above
318  mTypeSizeInBytes); // number of bytes to copy
319 
320  }
321 
322  for (TTUInt32 i=0; i<mDataSize; i += mComponentStride)
323  memcpy(mData+i, fillValue, mComponentStride);
324 
325  delete[] fillValue;
326  return kTTErrNone;
327 }
328 
329 /*
330  To find the index in the matrix:
331 
332  1D Matrix: index = x
333  2D Matrix: index = dim_0 y + x
334  3D Matrix: index = dim_0 dim_1 z + dim_0 y + x
335  etc.
336  */
337 
338 
339 // args passed-in should be the 2 coordinates
340 // args returned will be the value(s) at those coordinates
341 TTErr TTMatrixBase::get(const TTValue& anInputValue, TTValue &anOutputValue) const
342 {
343  TTUInt16 dimensionCount = anInputValue.size();
344 
345  if (dimensionCount != 2) // 2 dimensions only
346  return kTTErrWrongNumValues;
347 
348  TTInt32 i, j;
349  i = anInputValue[0];
350  j = anInputValue[1];
351 
352  TTBoolean weAreNotInBounds = makeInBounds(i,j);
353  if (weAreNotInBounds)
354  return kTTErrOutOfBounds;
355  // TODO: for now we throw an error when out of bounds. wrapping could be option in future version.
356 
358 
359  anOutputValue.clear();
360 
361  // TODO: here we have this ugly switch again...
362  // Maybe we could just have duplicate pointers of different types in our class, and then we could access them more cleanly?
363  if (mType == kTypeUInt8) {
364  for (int e=0; e<mElementCount; e++)
365  anOutputValue.append((TTUInt8*)(mData+(index+e*mTypeSizeInBytes)));
366  }
367  else if (mType == kTypeInt32) {
368  for (int e=0; e<mElementCount; e++)
369  anOutputValue.append((TTInt32*)(mData+(index+e*mTypeSizeInBytes)));
370  }
371  else if (mType == kTypeFloat32) {
372  for (int e=0; e<mElementCount; e++)
373  anOutputValue.append((TTFloat32*)(mData+(index+e*mTypeSizeInBytes)));
374  }
375  else if (mType == kTypeFloat64) {
376  for (int e=0; e<mElementCount; e++)
377  anOutputValue.append((TTFloat64*)(mData+(index+e*mTypeSizeInBytes)));
378  }
379 
380  return kTTErrNone;
381 }
382 
383 
384 // args passed-in should be the coordinates plus the value
385 // therefore anInputValue requires (2 + mElementCount) items
386 TTErr TTMatrixBase::set(const TTValue& anInputValue, TTValue &anUnusedOutputValue)
387 {
388  TTValue theValue;
389  TTUInt16 dimensionCount = anInputValue.size() - mElementCount;
390 
391  if (dimensionCount != 2) // 2 dimensions only
392  return kTTErrWrongNumValues;
393 
394  theValue.copyFrom(anInputValue, dimensionCount);
395 
396  TTInt32 i, j;
397  i = anInputValue[0];
398  j = anInputValue[1];
399 
400  TTBoolean weAreNotInBounds = makeInBounds(i,j);
401  if (weAreNotInBounds)
402  return kTTErrOutOfBounds;
403  // TODO: for now we throw an error when out of bounds. wrapping could be option in future version.
404 
406 
407  if (mType == kTypeUInt8) {
408  for (int e=0; e<mElementCount; e++)
409  *(TTUInt8*)(mData+(index+e*mTypeSizeInBytes)) = anInputValue[e+dimensionCount];
410  }
411  else if (mType == kTypeInt32) {
412  for (int e=0; e<mElementCount; e++)
413  *(TTInt32*)(mData+(index+e*mTypeSizeInBytes)) = anInputValue[e+dimensionCount];
414  }
415  else if (mType == kTypeFloat32) {
416  for (int e=0; e<mElementCount; e++)
417  *(TTFloat32*)(mData+(index+e*mTypeSizeInBytes)) = anInputValue[e+dimensionCount];
418  }
419  else if (mType == kTypeFloat64) {
420  for (int e=0; e<mElementCount; e++)
421  *(TTFloat64*)(mData+(index+e*mTypeSizeInBytes)) = anInputValue[e+dimensionCount];
422  }
423 
424  return kTTErrNone;
425 }
426 
427 
429 {
430  // TODO: should/could this be inlined?
431  if (mType == anotherMatrix.mType &&
432  mElementCount == anotherMatrix.mElementCount &&
433  mRowCount == anotherMatrix.mRowCount &&
434  mColumnCount == anotherMatrix.mColumnCount)
435  {
436  return true;
437  } else {
438  return false;
439  }
440 }
441 
442 
444 {
445  // TODO: could this be rethought as an iterator?
446  dest.adaptTo(source);
447  memcpy(dest.mData, source.mData, source.mDataSize);
448  return kTTErrNone;
449 }
450 
451 
453 {
454  // TODO: what should we do if anotherMatrix is not locally owned?
455  // It would be nice to re-dimension the data, but we can't re-alloc / resize the number of bytes...
456  // NW: don't understand above comment, previous set attribute methods *were* calling resize()
457 
458  // NOTE: there is potential for some attributes to change while others fail
459  // if that happens, mData is never resized but attributes that changed will report bogus results
460 
461  if (setRowCountWithoutResize(anotherMatrix.mRowCount) &&
462  setColumnCountWithoutResize(anotherMatrix.mColumnCount) &&
464  setTypeWithoutResize(anotherMatrix.mType))
465  {
466  return resize();
467  } else {
468  return kTTErrInvalidValue;
469  }
470 
471 }
472 
473 
474 TTErr TTMatrixBase::iterate(TTMatrixBase* C, const TTMatrixBase* A, const TTMatrixBase* B, TTMatrixBaseIterator iterator)
475 {
476  if(C->adaptTo(A) == kTTErrNone)
477  {
478  int stride = A->mTypeSizeInBytes;
479  int size = A->mDataSize;
480 
481  for (int k=0; k<size; k+=stride)
482  (*iterator)(C->mData+k, A->mData+k, B->mData+k);
483 
484  return kTTErrNone;
485  } else {
486  return kTTErrGeneric;
487  }
488 }
489 
490 TTErr TTMatrixBase::iterateWhenAllAttributesMatch(TTMatrixBase* C, const TTMatrixBase* A, const TTMatrixBase* B, TTMatrixBaseIterator iterator)
491 {
492  if (A->allAttributesMatch(B)) {
493  return iterate(C,A,B,iterator);
494  } else {
495  return kTTErrGeneric;
496  }
497 }
498 
499 
2-dimensional matrix of compound values with N elements each.
TTFOUNDATION_EXPORT TTDataInfoPtr ttDataTypeInfo[kNumTTDataTypes]
An array, indexed by values from TTDataType, containing information about those data types...
Definition: TTBase.cpp:424
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
std::uint16_t TTUInt16
16 bit unsigned integer
Definition: TTBase.h:176
An inappropriate value was specified for an attribute or variable.
Definition: TTBase.h:349
TTErr setRowCount(const TTValue &aNewRowCount)
Attribute accessor.
Attempted to access memory outside a matrix or array (in a TTMatrix & TTSampleMatrix).
Definition: TTBase.h:355
TTBoolean allAttributesMatch(const TTMatrixBase &anotherMatrix) const
Compare the attributes of this matrix to another to see if they all match.
TTErr clear()
Set every element in the matrix to zero.
Couldn't get memory.
Definition: TTBase.h:345
std::uint64_t TTUInt64
64 bit unsigned integer
Definition: TTBase.h:180
void copyFrom(const TTValue &obj, TTUInt16 index)
Copy a value starting from an index until the last element.
Definition: TTValue.h:147
TTUInt32 mDataCount
mComponentCount * mElementCount (e.g. total number of floats or ints in the matrix) ...
Definition: TTMatrixBase.h:52
8-bit unsigned integer, range is 0 through 255.
Definition: TTBase.h:274
TTBoolean makeInBounds(TTRowID &i, TTColumnID &j, TTMatrixBaseOutOfBoundsHandler handler=outOfBoundsWrap) const
Make sure an (i,j) pair is within the limits set by RowCount & ColumnCount.
Definition: TTMatrixBase.h:366
TTErr get(const TTValue &anInputValue, TTValue &anOutputValue) const
Get the value of a component located at any location in 2-dimensional matrix.
64-bit unsigned integer, range is 0 through 18,446,744,073,709,551,615.
Definition: TTBase.h:280
size_type size() const noexcept
Return the number of elements.
TTUInt32 mComponentCount
mRowCount * mColumnCount
Definition: TTMatrixBase.h:50
TTErr setDimensions(const TTValue &someNewDimensions)
Attribute accessor.
static TTErr copy(const TTMatrixBase &source, TTMatrixBase &dest)
Copy the data from one matrix into another.
TTDataType
TTBlue Data Types Enumeration of data types used through out TTBlue, including the TTValue class and ...
Definition: TTBase.h:269
TTInt32 TTColumnID
Datatype for any number used to indicate a column index within the matrix.
Definition: TTBase.h:216
Bad DataType for the context.
Definition: TTBase.h:347
TTBoolean setRowCountWithoutResize(TTRowID aNewRowCount)
Internal method that sets the value for RowCount without resizing the matrix of values.
The wrong number of values were passed to a method or attribute.
Definition: TTBase.h:350
TTDataInfoPtr mTypeAsDataInfo
pointer to info about the data type found in #TTBase::ttDataTypeInfo
Definition: TTMatrixBase.h:54
TTErr fill(const TTValue &anInputValue, TTValue &anOutputValue)
Fill every component in the matrix with the same value.
TTInt32 TTRowID
Datatype for any number used to indicate a row index within a matrix.
Definition: TTBase.h:207
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
TTSymbol mTypeAsSymbol
symbol with data type name for the public interface
Definition: TTMatrixBase.h:55
TTErr getDimensions(TTValue &returnedDimensions) const
Legacy attribute accessor.
TTErr adaptTo(const TTMatrixBase &anotherMatrix)
Set dimensions, element count, datatype, etc.
TTUInt32 mDataSize
mTypeSizeInBytes * mDataCount
Definition: TTMatrixBase.h:57
16-bit unsigned integer, range is 0 through 65,535.
Definition: TTBase.h:276
void append(const T &anElementValueToAppend)
Insert a single TTElement at the end.
Definition: TTValue.h:243
TTErr setColumnCount(const TTValue &aNewColumnCount)
Attribute accessor.
std::int64_t TTInt64
64 bit signed integer
Definition: TTBase.h:179
2-dimensional matrix of compound values with N elements each.
Definition: TTMatrixBase.h:41
std::int16_t TTInt16
16 bit signed integer
Definition: TTBase.h:175
TTErr setType(const TTValue &aType)
Attribute accessor.
16-bit signed integer, range is −32,768 through 32,767.
Definition: TTBase.h:275
64-bit floating point
Definition: TTBase.h:272
Jamoma's lowest-level base class and related infrastructure.
TTBoolean setColumnCountWithoutResize(TTColumnID aNewColumnCount)
Internal method that sets the value for ColumnCount without resizing the matrix of values...
#define INDEX_OF_COMPONENT_FIRSTBYTE(i, j)
[doxygenAppendixC_macroExample]
Definition: TTMatrixBase.h:246
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
TTErr setElementCount(const TTValue &newElementCount)
Attribute accessor.
TTBoolean setTypeWithoutResize(TTDataType aNewType)
Internal method that sets the values for type-related variables without resizing the matrix of values...
float TTFloat32
32 bit floating point number
Definition: TTBase.h:187
TTRowID mRowCount
How many rows of values the matrix should have. Uses an signed 32-bit integer which provides a maximu...
Definition: TTMatrixBase.h:47
#define addMessageWithArguments(name)
A convenience macro to be used by subclasses for registering messages.
Definition: TTMessage.h:27
std::int32_t TTInt32
32 bit signed integer
Definition: TTBase.h:177
TTByte * TTBytePtr
Data is a pointer to some bytes.
Definition: TTBase.h:169
TTColumnID mColumnCount
How many columns of values the matrix should have. Uses an signed 32-bit integer which provides a max...
Definition: TTMatrixBase.h:48
TTErr getType(TTValue &returnedType) const
Attribute accessor.
64-bit signed integer, ragne is −9,223,372,036,854,775,808 through 9,223,372,036,854,775,807
Definition: TTBase.h:279
32-bit floating point
Definition: TTBase.h:271
static TTErr iterateWhenAllAttributesMatch(TTMatrixBase *C, const TTMatrixBase *A, const TTMatrixBase *B, TTMatrixBaseIterator iterator)
Only if all the attributes of matrix A and B match, then step through every component to produce matr...
void clear()
Clear all values from the vector, leaving with size of 0.
Definition: TTValue.h:131
TTEnvironment is a global object providing information on the environemt.
TTUInt8 mTypeSizeInBytes
number of bytes present in mType
Definition: TTMatrixBase.h:56
32-bit signed integer, range is -2,147,483,648 through 2,147,483,647.
Definition: TTBase.h:277
unsigned char TTByte
Byte value.
Definition: TTBase.h:168
Something went wrong, but what exactly is not known. Typically used for context-specific problems...
Definition: TTBase.h:344
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTInt16 TTElementID
Datatype for any number used to indicate an element index within the matrix.
Definition: TTBase.h:224
static TTErr iterate(TTMatrixBase *C, const TTMatrixBase *A, const TTMatrixBase *B, TTMatrixBaseIterator iterator)
Step through every component in the matrix A and B to produce matrix C using the specified iterator m...
TTBoolean setElementCountWithoutResize(TTElementID aNewElementCount)
Internal method that sets the value for ElementCount without resizing the matrix of values...
signed char TTInt8
8 bit signed integer (char)
Definition: TTBase.h:173
std::uint32_t TTUInt32
32 bit unsigned integer
Definition: TTBase.h:178
TTErr resize()
Internal method that resizes memory allocated when various attributes change.
#define addAttributeWithSetter(name, type)
A convenience macro to be used by subclasses for registering attributes with a custom setter...
Definition: TTAttribute.h:47
#define addMessage(name)
A convenience macro to be used by subclasses for registering messages.
Definition: TTMessage.h:19
32-bit unsigned integer, range is 0 through 4,294,967,295.
Definition: TTBase.h:278
8-bit signed integer, range is -128 through 127.
Definition: TTBase.h:273
No Error.
Definition: TTBase.h:343
TTUInt32 mComponentStride
how many bytes from one the beginning one matrix component to the next
Definition: TTMatrixBase.h:51
TTElementID mElementCount
How many elements (parts) per value (e.g. 2 for complex numbers, 4 for colors, default = 1)...
Definition: TTMatrixBase.h:49
TTBoolean mDataIsLocallyOwned
If false, then we are referencing outside memory which we don't own.
Definition: TTMatrixBase.h:58
TT_OBJECT_CONSTRUCTOR
Constructor macro.
TTDataType mType
member of global enumerated list #TTBase::TTDataType (i.e., kTypeUInt8, kTypeUInt16, kTypeInt32, kTypeUInt64, kTypeFloat32, kTypeFloat64)
Definition: TTMatrixBase.h:53
void resize(size_type n)
Change the number of elements.
TTBytePtr mData
memory used to store matrix values
Definition: TTMatrixBase.h:46
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
TTErr set(const TTValue &anInputValue, TTValue &anOutputValue)
Set the value of a component located at any location in an 2-dimensional matrix.
unsigned char TTUInt8
8 bit unsigned integer (char)
Definition: TTBase.h:174
#define addAttributeWithGetterAndSetter(name, type)
A convenience macro to be used by subclasses for registering attributes with a custom getter and sett...
Definition: TTAttribute.h:57