state-observation 1.7.0
General implementation of observers.
Loading...
Searching...
No Matches
stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker > Class Template Reference

this is a structure allowing for automatically verifying that the item has been initialized or not. The chckitm_reset() function allows to set it back to "not initialized" state. More...

#include <definitions.hpp>

Collaboration diagram for stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >:
[legend]

Public Member Functions

 CheckedItem (bool initialize=true)
 The parameter initialize sets whether the isSet() parameter is initialized to false.
 CheckedItem (const T &)
 CheckedItem (const CheckedItem &)
CheckedItemoperator= (const CheckedItem &)
T & operator= (const T &)
 operator T () const
 operator const T & () const
const T & chckitm_getValue () const
T & operator() ()
const T & operator() () const
T & getRefUnchecked ()
const T & getRefUnchecked () const
bool isSet () const
void reset ()
void set (bool value)
 set the value of the initialization check boolean
void setAssertMessage (std::string s)
void setExceptionPtr (std::exception *e)
T & set ()

Protected Types

typedef DebugItem< bool, detail::defaultTrue, do_check_ > IsSet
typedef DebugItem< const char *, detail::defaultErrorMSG, do_assert_ > AssertMsg
typedef DebugItem< const std::exception *, detail::defaultExceptionAddr, do_exception_ > ExceptionPtr

Protected Member Functions

bool chckitm_check_ () const

Protected Attributes

IsSet isSet_
AssertMsg assertMsg_
ExceptionPtr exceptionPtr_
v_
 this can throw(std::exception)

Static Protected Attributes

static const bool do_check_ = !lazy || isDebug
static const bool do_assert_ = do_check_ && assertion
static const bool do_exception_ = do_check_ && !assertion

Detailed Description

template<typename T, bool lazy = false, bool alwaysCheck = false, bool assertion = true, bool eigenAlignedNew = false, typename additionalChecker = EmptyChecker>
class stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >

this is a structure allowing for automatically verifying that the item has been initialized or not. The chckitm_reset() function allows to set it back to "not initialized" state.

Template Parameters
Tis the contained type
lazymeans that the "set" value is true all the time if NDEBUG is defined
alwaysCheckmeans that the check is always performed and throws exception if it fails. Otherwise, the check is performed only for debug warning, this has no effect if lazy is set to true
assertionmeans that an assertion will be introduced for the check.
eigenAlignedNewshould be set to true if any alignment is required for the new operator (see eigen documentation)
additionalCheckerdefines a check function that is called in addition to the initialization check

Definition at line 378 of file definitions.hpp.

Member Typedef Documentation

◆ IsSet

template<typename T, bool lazy = false, bool alwaysCheck = false, bool assertion = true, bool eigenAlignedNew = false, typename additionalChecker = EmptyChecker>
typedef DebugItem<bool, detail::defaultTrue, do_check_> stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >::IsSet
protected

Definition at line 420 of file definitions.hpp.

◆ AssertMsg

template<typename T, bool lazy = false, bool alwaysCheck = false, bool assertion = true, bool eigenAlignedNew = false, typename additionalChecker = EmptyChecker>
typedef DebugItem<const char *, detail::defaultErrorMSG, do_assert_> stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >::AssertMsg
protected

Definition at line 421 of file definitions.hpp.

◆ ExceptionPtr

template<typename T, bool lazy = false, bool alwaysCheck = false, bool assertion = true, bool eigenAlignedNew = false, typename additionalChecker = EmptyChecker>
typedef DebugItem<const std::exception *, detail::defaultExceptionAddr, do_exception_> stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >::ExceptionPtr
protected

Definition at line 422 of file definitions.hpp.

Constructor & Destructor Documentation

◆ ~CheckedItem()

template<typename T, bool lazy = false, bool alwaysCheck = false, bool assertion = true, bool eigenAlignedNew = false, typename additionalChecker = EmptyChecker>
virtual stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >::~CheckedItem ( )
inlinevirtual

Definition at line 385 of file definitions.hpp.

Member Function Documentation

◆ set()

template<typename T, bool lazy = false, bool alwaysCheck = false, bool assertion = true, bool eigenAlignedNew = false, typename additionalChecker = EmptyChecker>
T & stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >::set ( )
inline

allows to set the initialization boolean to true and give a reference to the object with the same instruction should be used to initialize the object without using the assignment operator

Member Data Documentation

◆ do_check_

template<typename T, bool lazy = false, bool alwaysCheck = false, bool assertion = true, bool eigenAlignedNew = false, typename additionalChecker = EmptyChecker>
const bool stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >::do_check_ = !lazy || isDebug
staticprotected

Definition at line 416 of file definitions.hpp.

◆ do_assert_

template<typename T, bool lazy = false, bool alwaysCheck = false, bool assertion = true, bool eigenAlignedNew = false, typename additionalChecker = EmptyChecker>
const bool stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >::do_assert_ = do_check_ && assertion
staticprotected

Definition at line 417 of file definitions.hpp.

◆ do_exception_

template<typename T, bool lazy = false, bool alwaysCheck = false, bool assertion = true, bool eigenAlignedNew = false, typename additionalChecker = EmptyChecker>
const bool stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >::do_exception_ = do_check_ && !assertion
staticprotected

Definition at line 418 of file definitions.hpp.

◆ isSet_

template<typename T, bool lazy = false, bool alwaysCheck = false, bool assertion = true, bool eigenAlignedNew = false, typename additionalChecker = EmptyChecker>
IsSet stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >::isSet_
protected

Definition at line 424 of file definitions.hpp.

◆ assertMsg_

template<typename T, bool lazy = false, bool alwaysCheck = false, bool assertion = true, bool eigenAlignedNew = false, typename additionalChecker = EmptyChecker>
AssertMsg stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >::assertMsg_
protected

Definition at line 425 of file definitions.hpp.

◆ exceptionPtr_

template<typename T, bool lazy = false, bool alwaysCheck = false, bool assertion = true, bool eigenAlignedNew = false, typename additionalChecker = EmptyChecker>
ExceptionPtr stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >::exceptionPtr_
protected

Definition at line 426 of file definitions.hpp.

◆ v_

template<typename T, bool lazy = false, bool alwaysCheck = false, bool assertion = true, bool eigenAlignedNew = false, typename additionalChecker = EmptyChecker>
T stateObservation::CheckedItem< T, lazy, alwaysCheck, assertion, eigenAlignedNew, additionalChecker >::v_
protected

this can throw(std::exception)

Definition at line 429 of file definitions.hpp.


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