cgv
Loading...
Searching...
No Matches
cgv::data::ref_arr< T > Class Template Reference

Public Member Functions

 ref_arr (T *a=0, counter_type *c=0)
 construct reference counted pointer
 
 ref_arr (const ref_arr< T > &ra)
 copy construct from same pointer type and increment count
 
 ~ref_arr ()
 destruct reference counted pointer
 
ref_arr< T > & operator= (const ref_arr< T > &ra)
 assignment to pointer of same type
 
T * ptr () const
 return array pointer
 
T & operator* () const
 access to element
 
T * operator-> () const
 access to element pointer
 
T & operator[] (int i)
 access to i-th element
 
ref_arr< T > operator() (int i) const
 return an array pointer pointing to the i-th element
 
bool operator== (const ref_arr< T > &ra) const
 compare by pointer
 
int get_count () const
 return current count
 
bool unique () const
 check if this is the only reference
 
bool empty () const
 check if pointer is not yet set
 
 operator bool () const
 conversion to bool results in false if the stored pointer is a null pointer
 
void clear ()
 clear the array pointer
 

Detailed Description

template<typename T>
class cgv::data::ref_arr< T >

Definition at line 12 of file ref_arr.h.

Constructor & Destructor Documentation

◆ ref_arr() [1/2]

template<typename T >
cgv::data::ref_arr< T >::ref_arr ( T *  a = 0,
counter_type *  c = 0 
)
inlineexplicit

construct reference counted pointer

Definition at line 40 of file ref_arr.h.

◆ ref_arr() [2/2]

template<typename T >
cgv::data::ref_arr< T >::ref_arr ( const ref_arr< T > &  ra)
inline

copy construct from same pointer type and increment count

Definition at line 45 of file ref_arr.h.

◆ ~ref_arr()

template<typename T >
cgv::data::ref_arr< T >::~ref_arr ( )
inline

destruct reference counted pointer

Definition at line 51 of file ref_arr.h.

Member Function Documentation

◆ clear()

template<typename T >
void cgv::data::ref_arr< T >::clear ( )
inline

clear the array pointer

Definition at line 103 of file ref_arr.h.

◆ empty()

template<typename T >
bool cgv::data::ref_arr< T >::empty ( ) const
inline

check if pointer is not yet set

Definition at line 95 of file ref_arr.h.

References cgv::data::ref_arr< T >::get_count().

Referenced by cgv::data::ref_arr< T >::operator bool().

◆ get_count()

template<typename T >
int cgv::data::ref_arr< T >::get_count ( ) const
inline

return current count

Definition at line 87 of file ref_arr.h.

Referenced by cgv::data::ref_arr< T >::empty(), and cgv::data::ref_arr< T >::unique().

◆ operator bool()

template<typename T >
cgv::data::ref_arr< T >::operator bool ( ) const
inline

conversion to bool results in false if the stored pointer is a null pointer

Definition at line 99 of file ref_arr.h.

References cgv::data::ref_arr< T >::empty().

◆ operator()()

template<typename T >
ref_arr< T > cgv::data::ref_arr< T >::operator() ( int  i) const
inline

return an array pointer pointing to the i-th element

Definition at line 79 of file ref_arr.h.

◆ operator*()

template<typename T >
T & cgv::data::ref_arr< T >::operator* ( ) const
inline

access to element

Definition at line 67 of file ref_arr.h.

◆ operator->()

template<typename T >
T * cgv::data::ref_arr< T >::operator-> ( ) const
inline

access to element pointer

Definition at line 71 of file ref_arr.h.

◆ operator=()

template<typename T >
ref_arr< T > & cgv::data::ref_arr< T >::operator= ( const ref_arr< T > &  ra)
inline

assignment to pointer of same type

Definition at line 55 of file ref_arr.h.

◆ operator==()

template<typename T >
bool cgv::data::ref_arr< T >::operator== ( const ref_arr< T > &  ra) const
inline

compare by pointer

Definition at line 83 of file ref_arr.h.

◆ operator[]()

template<typename T >
T & cgv::data::ref_arr< T >::operator[] ( int  i)
inline

access to i-th element

Definition at line 75 of file ref_arr.h.

◆ ptr()

template<typename T >
T * cgv::data::ref_arr< T >::ptr ( ) const
inline

return array pointer

Definition at line 63 of file ref_arr.h.

◆ unique()

template<typename T >
bool cgv::data::ref_arr< T >::unique ( ) const
inline

check if this is the only reference

Definition at line 91 of file ref_arr.h.

References cgv::data::ref_arr< T >::get_count().


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