Leonardus
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Attributes | List of all members
DbCRAIIassert< T > Class Template Reference

Helper class to call a check always at function return. More...

#include <dbc.h>

+ Collaboration diagram for DbCRAIIassert< T >:

Public Member Functions

 DbCRAIIassert (assert_t p_fun, T *p_obj)
 Ctor.
 
 ~DbCRAIIassert ()
 Dtor.
 

Private Types

using assert_t = bool(T::*)() const noexcept
 A shortcut for the invariant() function pointers.
 

Private Attributes

const assert_t fun_
 The invariant() of the current class to be called at function return.
 
const T * obj_
 The this of the invariant function.
 

Detailed Description

template<typename T>
class DbCRAIIassert< T >

Helper class to call a check always at function return.

Template Parameters
TType of the object containing the invariant() member function.
Invariant
None.

Constructor & Destructor Documentation

◆ DbCRAIIassert()

template<typename T >
DbCRAIIassert< T >::DbCRAIIassert ( assert_t  p_fun,
T *  p_obj 
)
inline

Ctor.

Parameters
[in]p_funPointer to an invariant() member function returning bool.
[in]p_objObject on which the invariant function is called.

◆ ~DbCRAIIassert()

template<typename T >
DbCRAIIassert< T >::~DbCRAIIassert ( )
inline

Dtor.

Calls the stored invariant() function with the ASSERT macro.


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