mn::pointer::basic_lock_ptr< T, TLOCK > Class Template Reference

auto lock pointer. More...

#include <mn_lock_ptr.hpp>

Public Types

using value_type = T
 
using element_type = T
 
using const_value_type = const T
 
using lock_type = TLOCK
 
using pointer = T *
 
using const_pointer = T *
 
using reference = T &
 
using const_reference = const T &
 
using self_type = basic_lock_ptr< T, TLOCK >
 

Public Member Functions

 basic_lock_ptr (volatile reference v, lock_type &m)
 constructor make the pointer and auto lock More...
 
 basic_lock_ptr (volatile pointer v, lock_type &m)
 constructor make the pointer and auto lock More...
 
 ~basic_lock_ptr ()
 decunstructor and auto unlock the pointer More...
 
const_pointer get () const
 Get the pointer value. More...
 
pointer get ()
 Get the pointer value. More...
 
const_reference operator* () const
 Get the reference of the pointer. More...
 
reference operator* ()
 Get the reference of the pointer. More...
 
const_pointer operator-> () const
 Helper to use this pointer as "native" pointer. More...
 
pointer operator-> ()
 Helper to use this pointer as "native" pointer. More...
 
pointer release ()
 
void reset (pointer p=NULL)
 
lock_typeget_lock ()
 
 basic_lock_ptr (const basic_lock_ptr &)=delete
 
basic_lock_ptroperator= (const basic_lock_ptr &)=delete
 

Private Attributes

volatile pointer m_ptr
 
lock_typem_lock
 

Detailed Description

template<typename T, class TLOCK = LockType_t>
class mn::pointer::basic_lock_ptr< T, TLOCK >

auto lock pointer.

Template Parameters
Tpointer type of this lock pointer
TLOCKlock class
See also
defalt_lock

Member Typedef Documentation

◆ const_pointer

template<typename T , class TLOCK = LockType_t>
using mn::pointer::basic_lock_ptr< T, TLOCK >::const_pointer = T*

◆ const_reference

template<typename T , class TLOCK = LockType_t>
using mn::pointer::basic_lock_ptr< T, TLOCK >::const_reference = const T&

◆ const_value_type

template<typename T , class TLOCK = LockType_t>
using mn::pointer::basic_lock_ptr< T, TLOCK >::const_value_type = const T

◆ element_type

template<typename T , class TLOCK = LockType_t>
using mn::pointer::basic_lock_ptr< T, TLOCK >::element_type = T

◆ lock_type

template<typename T , class TLOCK = LockType_t>
using mn::pointer::basic_lock_ptr< T, TLOCK >::lock_type = TLOCK

◆ pointer

template<typename T , class TLOCK = LockType_t>
using mn::pointer::basic_lock_ptr< T, TLOCK >::pointer = T*

◆ reference

template<typename T , class TLOCK = LockType_t>
using mn::pointer::basic_lock_ptr< T, TLOCK >::reference = T&

◆ self_type

template<typename T , class TLOCK = LockType_t>
using mn::pointer::basic_lock_ptr< T, TLOCK >::self_type = basic_lock_ptr<T, TLOCK>

◆ value_type

template<typename T , class TLOCK = LockType_t>
using mn::pointer::basic_lock_ptr< T, TLOCK >::value_type = T

Constructor & Destructor Documentation

◆ basic_lock_ptr() [1/3]

template<typename T , class TLOCK = LockType_t>
mn::pointer::basic_lock_ptr< T, TLOCK >::basic_lock_ptr ( volatile reference  v,
lock_type m 
)
inline

constructor make the pointer and auto lock

Parameters
vReference to locked area/object
mThe reference of the lock object

◆ basic_lock_ptr() [2/3]

template<typename T , class TLOCK = LockType_t>
mn::pointer::basic_lock_ptr< T, TLOCK >::basic_lock_ptr ( volatile pointer  v,
lock_type m 
)
inline

constructor make the pointer and auto lock

Parameters
vPointer to locked area/object
mThe reference of the lock object

◆ ~basic_lock_ptr()

template<typename T , class TLOCK = LockType_t>
mn::pointer::basic_lock_ptr< T, TLOCK >::~basic_lock_ptr ( )
inline

decunstructor and auto unlock the pointer

◆ basic_lock_ptr() [3/3]

template<typename T , class TLOCK = LockType_t>
mn::pointer::basic_lock_ptr< T, TLOCK >::basic_lock_ptr ( const basic_lock_ptr< T, TLOCK > &  )
delete

Member Function Documentation

◆ get() [1/2]

template<typename T , class TLOCK = LockType_t>
pointer mn::pointer::basic_lock_ptr< T, TLOCK >::get ( void  )
inline

Get the pointer value.

Returns
The pointer value

◆ get() [2/2]

template<typename T , class TLOCK = LockType_t>
const_pointer mn::pointer::basic_lock_ptr< T, TLOCK >::get ( void  ) const
inline

Get the pointer value.

Returns
The pointer value

◆ get_lock()

template<typename T , class TLOCK = LockType_t>
lock_type& mn::pointer::basic_lock_ptr< T, TLOCK >::get_lock ( )
inline

◆ operator*() [1/2]

template<typename T , class TLOCK = LockType_t>
reference mn::pointer::basic_lock_ptr< T, TLOCK >::operator* ( void  )
inline

Get the reference of the pointer.

Returns
The reference of the pointer

◆ operator*() [2/2]

template<typename T , class TLOCK = LockType_t>
const_reference mn::pointer::basic_lock_ptr< T, TLOCK >::operator* ( void  ) const
inline

Get the reference of the pointer.

Returns
The reference of the pointer

◆ operator->() [1/2]

template<typename T , class TLOCK = LockType_t>
pointer mn::pointer::basic_lock_ptr< T, TLOCK >::operator-> ( )
inline

Helper to use this pointer as "native" pointer.

◆ operator->() [2/2]

template<typename T , class TLOCK = LockType_t>
const_pointer mn::pointer::basic_lock_ptr< T, TLOCK >::operator-> ( ) const
inline

Helper to use this pointer as "native" pointer.

◆ operator=()

template<typename T , class TLOCK = LockType_t>
basic_lock_ptr& mn::pointer::basic_lock_ptr< T, TLOCK >::operator= ( const basic_lock_ptr< T, TLOCK > &  )
delete

◆ release()

template<typename T , class TLOCK = LockType_t>
pointer mn::pointer::basic_lock_ptr< T, TLOCK >::release ( )
inline

◆ reset()

template<typename T , class TLOCK = LockType_t>
void mn::pointer::basic_lock_ptr< T, TLOCK >::reset ( pointer  p = NULL)
inline

Member Data Documentation

◆ m_lock

template<typename T , class TLOCK = LockType_t>
lock_type& mn::pointer::basic_lock_ptr< T, TLOCK >::m_lock
private

◆ m_ptr

template<typename T , class TLOCK = LockType_t>
volatile pointer mn::pointer::basic_lock_ptr< T, TLOCK >::m_ptr
private

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