LRT14  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
ManagedArray.h
1 #ifndef RHESUS_SAFEARRAY_H_
2 #define RHESUS_SAFEARRAY_H_
3 
4 #include <cstddef>
5 
6 #ifdef __VXWORKS__
7 #include <vxWorks.h>
8 #endif
9 
10 #include "Defines.h"
11 
12 namespace Rhesus
13 {
14 namespace Toolkit
15 {
16  template <class T>
17  class ManagedArray
18  {
19  public:
20  ManagedArray(const INT32& length);
21  ~ManagedArray();
22 
23  const T& operator[](const INT32 i) const; // getter
24  T& operator[](const INT32 i); // setter
25 
26  T& Get(const INT32& index);
27  void Set(const INT32& index, const T& t);
28 
29  INT32 Length();
30  private:
31  void allocate(const INT32& length);
32  void deallocate();
33 
34  T* m_internalArray;
35 
36  INT32 m_length;
37  };
38 }
39 }
40 
41 #endif