mn::basic_clock< TLockType > Class Template Reference

#include <mn_clock.hpp>

+ Inheritance diagram for mn::basic_clock< TLockType >:
+ Collaboration diagram for mn::basic_clock< TLockType >:

Public Types

using LockType_t = TLockType
 
- Public Types inherited from mn::ILockObject
using this_type = ILockObject
 

Public Member Functions

 basic_clock (LockType_t &m, bool bLocked, unsigned int timeout)
 
 basic_clock (basic_clock const &)=delete
 
 ~basic_clock ()
 
virtual int lock (unsigned int timeout)
 
virtual int unlock ()
 
bool is_locked ()
 
bool is_unlocked ()
 
 operator bool ()
 
void operator= (basic_clock const &)=delete
 
- Public Member Functions inherited from mn::basic_semaphore
 basic_semaphore ()
 
 basic_semaphore (const basic_semaphore &other)
 
 basic_semaphore (basic_semaphore &&other)
 
virtual int time_lock (const struct timespec *timeout)
 
void * get_handle ()
 
int get_error ()
 
virtual bool is_initialized () const
 
virtual bool is_locked () const
 Is locked? More...
 
bool operator== (const basic_semaphore &r) const
 
bool operator!= (const basic_semaphore &r) const
 
bool operator< (const basic_semaphore &r) const
 
bool operator> (const basic_semaphore &r) const
 
- Public Member Functions inherited from mn::ILockObject
 ILockObject ()
 
virtual bool try_lock ()
 

Protected Attributes

LockType_tm_refLockRefObject
 
unsigned int m_iLocks
 
- Protected Attributes inherited from mn::basic_semaphore
void * m_pSpinlock
 
int m_iCreateErrorCode
 
bool m_isLocked
 

Additional Inherited Members

- Protected Member Functions inherited from mn::basic_semaphore
void set_error (int error)
 

Detailed Description

template<class TLockType>
class mn::basic_clock< TLockType >

Template wrapper for basic_semaphores for counting lock

Member Typedef Documentation

◆ LockType_t

template<class TLockType >
using mn::basic_clock< TLockType >::LockType_t = TLockType

Constructor & Destructor Documentation

◆ basic_clock() [1/2]

template<class TLockType >
mn::basic_clock< TLockType >::basic_clock ( LockType_t m,
bool  bLocked,
unsigned int  timeout 
)
inline

Constructor

Parameters
mThe reference to the basic_semaphore object for counting
bLockedwhen true then lock the reference of the basic_semaphore object
timeoutHow long to wait to get the lock until giving up.

◆ basic_clock() [2/2]

template<class TLockType >
mn::basic_clock< TLockType >::basic_clock ( basic_clock< TLockType > const &  )
delete

We are not copyable.

◆ ~basic_clock()

template<class TLockType >
mn::basic_clock< TLockType >::~basic_clock ( )
inline

Destructor - unlock the reference object

Member Function Documentation

◆ is_locked()

template<class TLockType >
bool mn::basic_clock< TLockType >::is_locked ( )
inline

If the object locked ?

Returns
if true then are locked and if false when not

◆ is_unlocked()

template<class TLockType >
bool mn::basic_clock< TLockType >::is_unlocked ( )
inline

If the object unlocked ?

Returns
if true then are unlocked and if false when not

◆ lock()

template<class TLockType >
virtual int mn::basic_clock< TLockType >::lock ( unsigned int  timeout)
inlinevirtual

lock (take) a semaphore.

Parameters
timeoutHow long to wait to get the lock until giving up.
Returns
ERR_SPINLOCK_OK if the Semaphore was locked, ERR_SPINLOCK_LOCK if it timed out.

Reimplemented from mn::basic_semaphore.

◆ operator bool()

template<class TLockType >
mn::basic_clock< TLockType >::operator bool ( )
inline

If the object locked ?

Returns
if true then are locked and if false when not

◆ operator=()

template<class TLockType >
void mn::basic_clock< TLockType >::operator= ( basic_clock< TLockType > const &  )
delete

We are not assignable.

◆ unlock()

template<class TLockType >
virtual int mn::basic_clock< TLockType >::unlock ( )
inlinevirtual

unlock (give) a semaphore.

Returns
ERR_SPINLOCK_OK if the Semaphore was unlocked, ERR_SPINLOCK_UNLOCK if it failed.

Reimplemented from mn::basic_semaphore.

Member Data Documentation

◆ m_iLocks

template<class TLockType >
unsigned int mn::basic_clock< TLockType >::m_iLocks
protected

◆ m_refLockRefObject

template<class TLockType >
LockType_t& mn::basic_clock< TLockType >::m_refLockRefObject
protected

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