Jamoma API  0.6.0.a19
TTMatrixArray.h
1 /*
2  * Maintains an array of Jamoma matrices
3  * Copyright © 2011, Timothy Place
4  *
5  * License: This code is licensed under the terms of the "New BSD License"
6  * http://creativecommons.org/licenses/BSD/
7  */
8 
9 #ifndef __TT_MATRIXARRAY_H__
10 #define __TT_MATRIXARRAY_H__
11 
12 #include "TTMatrixBase.h"
13 #include "TTEnvironment.h"
14 
15 typedef std::vector<TTMatrixBasePtr> TTMatrixBaseVector;
16 typedef TTMatrixBaseVector::iterator TTMatrixBaseIter;
17 
18 
19 /****************************************************************************************************/
20 // Class Specification
21 
22 
23 
24 /** An array of TTMatrix instance pointers. */
25 class TTFOUNDATION_EXPORT TTMatrixArray : public TTObjectBase {
27 
28 protected:
29 
30  TTMatrixBaseVector mMatrices;
31 
32 public:
33 
34  TTMatrixBasePtr getMatrix(TTUInt32 aMatrixId) const
35  {
36  if (aMatrixId < mMatrices.size())
37  return mMatrices[aMatrixId];
38  else
39  return NULL;
40  }
41 
42  TTUInt32 getMatrixCount() const
43  {
44  return mMatrices.size();
45  }
46 
47  void setMatrixCount(TTUInt32 aCount)
48  {
49  mMatrices.resize(aCount);
50  }
51 
52  void setMatrix(TTUInt32 aMatrixId, TTMatrixBase& aMatrix)
53  {
54  mMatrices[aMatrixId] = &aMatrix;
55  }
56 
57 };
58 
60 
61 
62 
63 #endif // __TT_MATRIXARRAY_H__
64 
2-dimensional matrix of compound values with N elements each.
Base class for all first-class Jamoma objects.
Definition: TTObjectBase.h:109
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
2-dimensional matrix of compound values with N elements each.
Definition: TTMatrixBase.h:41
An array of TTMatrix instance pointers.
Definition: TTMatrixArray.h:25
TTEnvironment is a global object providing information on the environemt.
std::uint32_t TTUInt32
32 bit unsigned integer
Definition: TTBase.h:178
TTErr resize()
Internal method that resizes memory allocated when various attributes change.