VSM C++ SDK
Vehicle Specific Modules SDK
ugcs::vsm::Reference_guard< Class_ptr > Class Template Reference

Reference guard objects keep references for managed objects. More...

#include <reference_guard.h>

Classes

class  Hasher
 Hasher class for reference type. More...
 

Public Member Functions

 Reference_guard (std::nullptr_t ptr=nullptr)
 Construct an empty guard which doesn't have managed object. More...
 
 Reference_guard (const Class_ptr &ptr)
 Construct guard object. More...
 
 Reference_guard (Class_ptr &&ptr)
 Construct guard by moving managed object to the guard. More...
 
 Reference_guard (const Reference_guard< Class_ptr > &ref)
 Copy guard object. More...
 
 Reference_guard (Reference_guard< Class_ptr > &&ref)
 Move guard object. More...
 
template<typename Src_class_ptr >
 Reference_guard (const Reference_guard< Src_class_ptr > &ref)
 Copy guard object. More...
 
template<typename Src_class_ptr >
 Reference_guard (Reference_guard< Src_class_ptr > &&ref)
 Move guard object. More...
 
Reference_guard< Class_ptr > & operator= (const Reference_guard< Class_ptr > &ref)
 Copy assignment. More...
 
Reference_guard< Class_ptr > & operator= (Reference_guard< Class_ptr > &&ref)
 Move assignment. More...
 
Reference_guard< Class_ptr > & operator= (std::nullptr_t ref __attribute__((unused)))
 nullptr assignment. More...
 
bool operator== (const Reference_guard< Class_ptr > &ref) const
 Guards are equal when managed object pointers are equal. More...
 
bool operator!= (const Reference_guard< Class_ptr > &ref) const
 Guards are not equal when managed object pointers are not equal. More...
 
 operator bool () const
 Guards yields to true when managed object does exist. More...
 
Class_ptr operator-> ()
 Member access is transparent. More...
 
const Class_ptr operator-> () const
 Member access is transparent. More...
 

Public Attributes

decltype(*std::declval< Class_ptr >() operator* )()
 Dereference is transparent. More...
 

Friends

template<typename >
class Reference_guard
 

Detailed Description

template<typename Class_ptr>
class ugcs::vsm::Reference_guard< Class_ptr >

Reference guard objects keep references for managed objects.

The managed object should have Add_ref() and Release_ref() methods which are called by the guarded object. Release_ref() can tear down the object when last reference is released. Both Add_ref() and Release_ref() should be thread-safe.

Parameters
Class_ptrType for referenced object pointer. It can be either plain pointer or any smart pointer class.

Constructor & Destructor Documentation

template<typename Class_ptr>
ugcs::vsm::Reference_guard< Class_ptr >::Reference_guard ( std::nullptr_t  ptr = nullptr)
inline

Construct an empty guard which doesn't have managed object.

template<typename Class_ptr>
ugcs::vsm::Reference_guard< Class_ptr >::Reference_guard ( const Class_ptr &  ptr)
inline

Construct guard object.

template<typename Class_ptr>
ugcs::vsm::Reference_guard< Class_ptr >::Reference_guard ( Class_ptr &&  ptr)
inline

Construct guard by moving managed object to the guard.

template<typename Class_ptr>
ugcs::vsm::Reference_guard< Class_ptr >::Reference_guard ( const Reference_guard< Class_ptr > &  ref)
inline

Copy guard object.

template<typename Class_ptr>
ugcs::vsm::Reference_guard< Class_ptr >::Reference_guard ( Reference_guard< Class_ptr > &&  ref)
inline

Move guard object.

template<typename Class_ptr>
template<typename Src_class_ptr >
ugcs::vsm::Reference_guard< Class_ptr >::Reference_guard ( const Reference_guard< Src_class_ptr > &  ref)
inline

Copy guard object.

template<typename Class_ptr>
template<typename Src_class_ptr >
ugcs::vsm::Reference_guard< Class_ptr >::Reference_guard ( Reference_guard< Src_class_ptr > &&  ref)
inline

Move guard object.

Member Function Documentation

template<typename Class_ptr>
ugcs::vsm::Reference_guard< Class_ptr >::operator bool ( ) const
inlineexplicit

Guards yields to true when managed object does exist.

template<typename Class_ptr>
bool ugcs::vsm::Reference_guard< Class_ptr >::operator!= ( const Reference_guard< Class_ptr > &  ref) const
inline

Guards are not equal when managed object pointers are not equal.

template<typename Class_ptr>
Class_ptr ugcs::vsm::Reference_guard< Class_ptr >::operator-> ( )
inline

Member access is transparent.

template<typename Class_ptr>
const Class_ptr ugcs::vsm::Reference_guard< Class_ptr >::operator-> ( ) const
inline

Member access is transparent.

template<typename Class_ptr>
Reference_guard<Class_ptr>& ugcs::vsm::Reference_guard< Class_ptr >::operator= ( const Reference_guard< Class_ptr > &  ref)
inline

Copy assignment.

template<typename Class_ptr>
Reference_guard<Class_ptr>& ugcs::vsm::Reference_guard< Class_ptr >::operator= ( Reference_guard< Class_ptr > &&  ref)
inline

Move assignment.

template<typename Class_ptr>
Reference_guard<Class_ptr>& ugcs::vsm::Reference_guard< Class_ptr >::operator= ( std::nullptr_t ref   __attribute__(unused))
inline

nullptr assignment.

template<typename Class_ptr>
bool ugcs::vsm::Reference_guard< Class_ptr >::operator== ( const Reference_guard< Class_ptr > &  ref) const
inline

Guards are equal when managed object pointers are equal.

Member Data Documentation

template<typename Class_ptr>
decltype(*std::declval<Class_ptr>() ugcs::vsm::Reference_guard< Class_ptr >::operator*) ()
inline

Dereference is transparent.


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