mn::basic_shared_object< TOBJECT > Class Template Reference

#include <mn_shared.hpp>

+ Collaboration diagram for mn::basic_shared_object< TOBJECT >:

Public Types

using object_t = TOBJECT
 
using ref_object_t = TOBJECT &
 

Public Member Functions

 basic_shared_object (const ref_object_t refValue)
 
ref_object_t get_object () const
 
void set_object (const ref_object_t refNewValue)
 
void operator= (const ref_object_t refNewValue)
 
 operator object_t () const
 

Protected Attributes

mutex_t m_pReadWriteLock
 
ref_object_t m_refValue
 

Detailed Description

template<class TOBJECT>
class mn::basic_shared_object< TOBJECT >

Template class used to protect a shared resource with a Mutex.

Member Typedef Documentation

◆ object_t

template<class TOBJECT >
using mn::basic_shared_object< TOBJECT >::object_t = TOBJECT

◆ ref_object_t

template<class TOBJECT >
using mn::basic_shared_object< TOBJECT >::ref_object_t = TOBJECT&

Constructor & Destructor Documentation

◆ basic_shared_object()

template<class TOBJECT >
mn::basic_shared_object< TOBJECT >::basic_shared_object ( const ref_object_t  refValue)
inline

Resource constructor.

Parameters
valuesets the initial value of the resource.

Member Function Documentation

◆ get_object()

template<class TOBJECT >
ref_object_t mn::basic_shared_object< TOBJECT >::get_object ( ) const
inline

Get the value of the shared resource.

Returns
The value of the shared resource.

◆ operator object_t()

template<class TOBJECT >
mn::basic_shared_object< TOBJECT >::operator object_t ( ) const
inline

Operator to get the value of the shared resource.

Returns
The value of the shared resource.

◆ operator=()

template<class TOBJECT >
void mn::basic_shared_object< TOBJECT >::operator= ( const ref_object_t  refNewValue)
inline

Operator to set the value of the shared resource.

Parameters
refNewValueThe new value for this shared resource

◆ set_object()

template<class TOBJECT >
void mn::basic_shared_object< TOBJECT >::set_object ( const ref_object_t  refNewValue)
inline

Sets the value of the shared resource with the specified new_value.

Parameters
refNewValueThe new value for this shared resource

Member Data Documentation

◆ m_pReadWriteLock

template<class TOBJECT >
mutex_t mn::basic_shared_object< TOBJECT >::m_pReadWriteLock
protected

the controll mutex

◆ m_refValue

template<class TOBJECT >
ref_object_t mn::basic_shared_object< TOBJECT >::m_refValue
protected

reference of the object


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