Artec 3D Scanning SDK  2.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
artec::sdk::base::TArrayRef< T > Class Template Reference

This class is intended for safe manipulation of arrays in terms of their life time. More...

#include <artec/sdk/base/TArrayRef.h>

+ Inheritance diagram for artec::sdk::base::TArrayRef< T >:

Public Types

typedef T::elementType elementType
 
- Public Types inherited from artec::sdk::base::TRef< T >
typedef T base
 

Public Member Functions

 TArrayRef ()
 
 TArrayRef (T *p)
 
 TArrayRef (const TRef< T > &p)
 
 TArrayRef (const TArrayRef &p)
 
 ~TArrayRef ()
 
int size () const
 
elementTypeoperator[] (int i) const
 
elementTypegetPointer () const
 
TArrayRefoperator= (T *p)
 
TArrayRefoperator= (const TRef< T > &p)
 
TArrayRefoperator= (const TArrayRef &p)
 
- Public Member Functions inherited from artec::sdk::base::TRef< T >
 TRef (T *p=NULL)
 
 TRef (const TRef< T > &p)
 
 TRef (TRef< T > &&p)
 
 ~TRef ()
 
 operator bool () const
 
T * operator-> () const
 
 operator T * () const
 
const T & operator* () const
 
T & operator* ()
 
TRef< T > & operator= (T *p)
 
TRef< T > & operator= (const TRef< T > &p)
 
TRef< T > & operator= (TRef< T > &&p)
 Move operator. More...
 
T ** operator& ()
 
bool operator== (T *p) const
 
bool operator!= (T *p) const
 
void attach (T *p)
 Attach to the interface pointer without calling addref() for it. More...
 
T * detach ()
 Detach the interface pointer without calling release() for it. More...
 
void release ()
 

Protected Member Functions

void keep ()
 

Protected Attributes

int dataSize_
 
elementTypedataPointer_
 
- Protected Attributes inherited from artec::sdk::base::TRef< T >
T * tObject_
 

Friends

template<class T2 >
ErrorCode createArray (TArrayRef< T2 > &src, int elementsCount, bool zeroFill)
 
template<class T2 >
ErrorCode resizeArray (TArrayRef< T2 > &src, int elementsCount)
 
template<class T2 >
ErrorCode resizeArray (TArrayRef< T2 > &src, int elementsCount, bool zeroFill)
 

Detailed Description

template<class T>
class artec::sdk::base::TArrayRef< T >

This class is intended for safe manipulation of arrays in terms of their life time.

Those arrays should implement one of the IArrayXXX interfaces that provides reference counting support. TArrayRef objects should hold pointers to the instances of such classes. Below is an example of how to create an instance of the IArrayInt implementation: TArrayRef<IArrayInt> arrayInt; createArrayInt( &arrayInt, 100 ); Operator &() is overloaded so that createArrayInt() function can fill the passed TArrayRef with a newly created instance. At the very moment of definition TArrayRef object has a count of references equal to 1.

This class is similar to TRef, however, some important differences should be noted. TArrayRef class has the []() operator. In order to optimize and avoid excessive virtual calls, the array size and the data pointer are cached once the array is created. This is why the array instance cannot be replaced inside. Some TArrayRef operators are also private in order to prohibit their usage.

Examples:
parallel-capture-sample.cpp.

Definition at line 43 of file TArrayRef.h.

Member Typedef Documentation

template<class T>
typedef T::elementType artec::sdk::base::TArrayRef< T >::elementType

Definition at line 46 of file TArrayRef.h.

Constructor & Destructor Documentation

template<class T>
artec::sdk::base::TArrayRef< T >::TArrayRef ( )
inline

Definition at line 48 of file TArrayRef.h.

template<class T>
artec::sdk::base::TArrayRef< T >::TArrayRef ( T *  p)
inline

Definition at line 53 of file TArrayRef.h.

template<class T>
artec::sdk::base::TArrayRef< T >::TArrayRef ( const TRef< T > &  p)
inline

Definition at line 58 of file TArrayRef.h.

template<class T>
artec::sdk::base::TArrayRef< T >::TArrayRef ( const TArrayRef< T > &  p)
inline

Definition at line 63 of file TArrayRef.h.

template<class T>
artec::sdk::base::TArrayRef< T >::~TArrayRef ( )
inline

Definition at line 68 of file TArrayRef.h.

Member Function Documentation

template<class T>
elementType* artec::sdk::base::TArrayRef< T >::getPointer ( ) const
inline

Definition at line 74 of file TArrayRef.h.

template<class T>
void artec::sdk::base::TArrayRef< T >::keep ( )
inlineprotected

Definition at line 98 of file TArrayRef.h.

template<class T>
TArrayRef& artec::sdk::base::TArrayRef< T >::operator= ( T *  p)
inline

Definition at line 76 of file TArrayRef.h.

template<class T>
TArrayRef& artec::sdk::base::TArrayRef< T >::operator= ( const TRef< T > &  p)
inline

Definition at line 83 of file TArrayRef.h.

template<class T>
TArrayRef& artec::sdk::base::TArrayRef< T >::operator= ( const TArrayRef< T > &  p)
inline

Definition at line 90 of file TArrayRef.h.

template<class T>
elementType& artec::sdk::base::TArrayRef< T >::operator[] ( int  i) const
inline

Definition at line 72 of file TArrayRef.h.

template<class T>
int artec::sdk::base::TArrayRef< T >::size ( ) const
inline

Definition at line 70 of file TArrayRef.h.

Friends And Related Function Documentation

template<class T>
template<class T2 >
ErrorCode createArray ( TArrayRef< T2 > &  src,
int  elementsCount,
bool  zeroFill 
)
friend
template<class T>
template<class T2 >
ErrorCode resizeArray ( TArrayRef< T2 > &  src,
int  elementsCount 
)
friend
template<class T>
template<class T2 >
ErrorCode resizeArray ( TArrayRef< T2 > &  src,
int  elementsCount,
bool  zeroFill 
)
friend

Member Data Documentation

template<class T>
elementType* artec::sdk::base::TArrayRef< T >::dataPointer_
protected

Definition at line 113 of file TArrayRef.h.

template<class T>
int artec::sdk::base::TArrayRef< T >::dataSize_
protected

Definition at line 112 of file TArrayRef.h.


The documentation for this class was generated from the following file: