ome-common  5.2.0-m2
Public Types | Public Member Functions | Private Attributes | List of all members
ome::common::boolean Class Reference

Boolean type with guaranteed size, alignment and storage values. More...

#include <ome/common/boolean.h>

Public Types

typedef uint8_t value_type
 Value type for Boolean values.
 

Public Member Functions

 boolean ()
 Default construct. More...
 
 boolean (bool value)
 Construct with initial value. More...
 
 boolean (const boolean &value)
 Copy construct. More...
 
 operator bool () const
 Cast to bool. More...
 
booleanoperator= (bool rhs)
 Assign value. More...
 
booleanoperator= (const boolean &rhs)
 Assign value. More...
 
boolean operator! () const
 Not operator. More...
 

Private Attributes

uint8_t value
 The boolean value.
 

Detailed Description

Boolean type with guaranteed size, alignment and storage values.

The standard bool type has an implementation-defined size, and as such this makes it unsuitable for interoperability with some APIs and libraries when used in arrays and matrices where the size and alignment are required to meet specific criteria. The special-casing of bool for some standard library containers is an additional complication where direct addressing and safe iteration and modification are required.

This type is compatible with bool, but is defined in terms of uint8_t, and so is 8 bits in size. It should have the same alignment requirements (i.e. on byte boundaries as for char) and so should permit tight packing and unaligned access. Its value is all bits zero (false, 0x00) or all bits one (true, 0xFF), making it suitable for direct logical masking operations with 8-bit data or as a normalized GL texture, for example.

Constructor & Destructor Documentation

ome::common::boolean::boolean ( )
inline

Default construct.

The default value is false.

ome::common::boolean::boolean ( bool  value)
inline

Construct with initial value.

Parameters
valuethe initial value.
ome::common::boolean::boolean ( const boolean value)
inline

Copy construct.

Parameters
valuethe value to copy.

Member Function Documentation

ome::common::boolean::operator bool ( ) const
inline

Cast to bool.

Returns
the bool value.

References value.

boolean ome::common::boolean::operator! ( ) const
inline

Not operator.

Returns
the inverted value.
boolean& ome::common::boolean::operator= ( bool  rhs)
inline

Assign value.

Parameters
rhsthe value to assign.
Returns
the new value.

References value.

boolean& ome::common::boolean::operator= ( const boolean rhs)
inline

Assign value.

Parameters
rhsthe value to assign.
Returns
the new value.

References value.


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