The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::OneWayBool< Default > Class Template Reference

Boolean with a default capable of being changed to the opposite value only. it can never set to the default even if already at the default value. More...

#include <Utils.hpp>

Public Member Functions

 OneWayBool ()=default
 Default construction. Defaults to template argument 'Default'.
 
 OneWayBool (bool value)
 
 operator bool () const
 Get current value as a bool.
 
bool operator== (bool b) const
 Compare value with a bool.
 
template<bool ArgDefault>
bool operator== (const OneWayBool< ArgDefault > &b) const
 Compare value with another OneWayBool.
 
template<bool ArgDefault>
bool operator= (const OneWayBool< ArgDefault > &b)
 Assign value from another OneWayBool.
 
bool operator= (bool b)
 Assign value from a bool.
 
void set_DEPRECATED (bool b)
 set this object arbitrarily
 

Detailed Description

template<bool Default>
class sparta::OneWayBool< Default >

Boolean with a default capable of being changed to the opposite value only. it can never set to the default even if already at the default value.

Template Parameters
Defaultdefault value of this bool. The bool can never be change to this value, only to the opposite

Definition at line 354 of file Utils.hpp.

Constructor & Destructor Documentation

◆ OneWayBool()

template<bool Default>
sparta::OneWayBool< Default >::OneWayBool ( bool  value)
inline

Definition at line 368 of file Utils.hpp.

Member Function Documentation

◆ operator bool()

template<bool Default>
sparta::OneWayBool< Default >::operator bool ( ) const
inline

Get current value as a bool.

Definition at line 380 of file Utils.hpp.

◆ operator=() [1/2]

template<bool Default>
bool sparta::OneWayBool< Default >::operator= ( bool  b)
inline

Assign value from a bool.

Parameters
[in]bValue to assign; must be equal to !Default
Precondition
Can only be called once

Definition at line 412 of file Utils.hpp.

◆ operator=() [2/2]

template<bool Default>
template<bool ArgDefault>
bool sparta::OneWayBool< Default >::operator= ( const OneWayBool< ArgDefault > &  b)
inline

Assign value from another OneWayBool.

Parameters
[in]bValue to assign; must currently be equal to !Default.
Precondition
Can only be aclled once

Definition at line 399 of file Utils.hpp.

◆ operator==() [1/2]

template<bool Default>
bool sparta::OneWayBool< Default >::operator== ( bool  b) const
inline

Compare value with a bool.

Definition at line 385 of file Utils.hpp.

◆ operator==() [2/2]

template<bool Default>
template<bool ArgDefault>
bool sparta::OneWayBool< Default >::operator== ( const OneWayBool< ArgDefault > &  b) const
inline

Compare value with another OneWayBool.

Definition at line 391 of file Utils.hpp.

◆ set_DEPRECATED()

template<bool Default>
void sparta::OneWayBool< Default >::set_DEPRECATED ( bool  b)
inline

set this object arbitrarily

Deprecated:
This should not be used. It is a temporary fix for AssignOnceObject's unassign_DEPRECATED function which has its own dependency.

Definition at line 426 of file Utils.hpp.


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