MeVisLab Toolbox Reference
ml::DistantObject< T > Class Template Reference

A DistantObject stores the pointer to an object of type T and forbids direct access to the stored pointer. More...

#include <mlDistantObject.h>

Public Types

typedef T Type
 The type of the stored object. More...
 

Public Member Functions

 DistantObject (T *obj)
 Construct a new distant object (make it explicit to avoid auto-conversion). More...
 
 DistantObject ()
 Creates empty distant object. More...
 
DistantObjectoperator= (T *obj)
 Assignment from T*. More...
 
bool isNull () const
 Returns if the object is NULL. More...
 
bool operator== (const DistantObject< T > &other) const
 
bool operator!= (const DistantObject< T > &other) const
 
bool operator! () const
 

Friends

class DistantObjectAccessor
 
bool operator== (const DistantObject< T > &lhs, const T *rhs)
 
bool operator== (const T *lhs, const DistantObject< T > &rhs)
 
bool operator!= (const DistantObject< T > &lhs, const T *rhs)
 
bool operator!= (const T *lhs, const DistantObject< T > &rhs)
 

Detailed Description

template<typename T>
class ml::DistantObject< T >

A DistantObject stores the pointer to an object of type T and forbids direct access to the stored pointer.

This avoids that someone calls methods on the object from a thread that is not allowed to directly access the object.

A DistantObjectAccessor can be used to get access to the stored pointer, but this should be used in special places only, e.g. when a thread wants to send a message that requieres the pointer of the object that is stored in a DistantObject

Definition at line 30 of file mlDistantObject.h.

Member Typedef Documentation

◆ Type

template<typename T >
typedef T ml::DistantObject< T >::Type

The type of the stored object.

Definition at line 34 of file mlDistantObject.h.

Constructor & Destructor Documentation

◆ DistantObject() [1/2]

template<typename T >
ml::DistantObject< T >::DistantObject ( T obj)
inlineexplicit

Construct a new distant object (make it explicit to avoid auto-conversion).

Definition at line 37 of file mlDistantObject.h.

◆ DistantObject() [2/2]

template<typename T >
ml::DistantObject< T >::DistantObject ( )
inline

Creates empty distant object.

Definition at line 40 of file mlDistantObject.h.

Member Function Documentation

◆ isNull()

template<typename T >
bool ml::DistantObject< T >::isNull ( ) const
inline

Returns if the object is NULL.

Definition at line 49 of file mlDistantObject.h.

◆ operator!()

template<typename T >
bool ml::DistantObject< T >::operator! ( ) const
inline

Definition at line 59 of file mlDistantObject.h.

◆ operator!=()

template<typename T >
bool ml::DistantObject< T >::operator!= ( const DistantObject< T > &  other) const
inline

Definition at line 55 of file mlDistantObject.h.

◆ operator=()

template<typename T >
DistantObject& ml::DistantObject< T >::operator= ( T obj)
inline

Assignment from T*.

Definition at line 43 of file mlDistantObject.h.

◆ operator==()

template<typename T >
bool ml::DistantObject< T >::operator== ( const DistantObject< T > &  other) const
inline

Definition at line 51 of file mlDistantObject.h.

Friends And Related Function Documentation

◆ DistantObjectAccessor

template<typename T >
friend class DistantObjectAccessor
friend

Definition at line 87 of file mlDistantObject.h.

◆ operator!= [1/2]

template<typename T >
bool operator!= ( const DistantObject< T > &  lhs,
const T rhs 
)
friend

Definition at line 74 of file mlDistantObject.h.

◆ operator!= [2/2]

template<typename T >
bool operator!= ( const T lhs,
const DistantObject< T > &  rhs 
)
friend

Definition at line 80 of file mlDistantObject.h.

◆ operator== [1/2]

template<typename T >
bool operator== ( const DistantObject< T > &  lhs,
const T rhs 
)
friend

Definition at line 64 of file mlDistantObject.h.

◆ operator== [2/2]

template<typename T >
bool operator== ( const T lhs,
const DistantObject< T > &  rhs 
)
friend

Definition at line 69 of file mlDistantObject.h.


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