Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::TBitFlags< Value, Input > Class Template Referencefinal

Manipulate a value type where each bit is a binary flag. More...

#include <TBitFlags.h>

Public Member Functions

constexpr TBitFlags ()
 Creates an instance with no flags.
 
constexpr TBitFlags (const FlagsSet &flagsSet)
 Create with initial flags set.
 
constexpr TBitFlags (Input flagsSet)
 Create with initial flags set.
 
template<typename OtherInput >
constexpr TBitFlags (const TBitFlags< Value, OtherInput > &otherFlags)
 Copy construct flags from another TBitFlags with a different Input type.
 
constexpr TBitFlagsintersectWith (const FlagsSet &flagsSet)
 Intersects this instance with the specified flags.
 
constexpr bool hasNone (const FlagsSet &flagsSet) const
 Checks whether this instance contains no specified flags.
 
constexpr bool hasAny (const FlagsSet &flagsSet) const
 Checks whether this instance contains at least one of the specified flags.
 
constexpr bool hasAll (const FlagsSet &flagsSet) const
 Checks whether this instance contains all of the specified flags.
 
constexpr bool hasExactly (const FlagsSet &flagsSet) const
 Checks whether this instance contains exactly the specified flags. No more, no less.
 
constexpr bool hasNone (Input flagsSet) const
 Checks whether this instance contains no specified flags.
 
constexpr bool hasAny (Input flagsSet) const
 Checks whether this instance contains at least one of the specified flags.
 
constexpr bool hasAll (Input flagsSet) const
 Checks whether this instance contains all of the specified flags.
 
constexpr bool hasExactly (Input flagsSet) const
 Checks whether this instance contains exactly the specified flags. No more, no less.
 
constexpr bool has (Input singleFlag) const
 Checks whether this single flag is fully contained.
 
constexpr bool hasNo (Input singleFlag) const
 Checks whether this single flag is fully absent.
 
constexpr bool isEmpty () const
 Checks whether this instance contains no flags.
 
constexpr bool isEqual (const TBitFlags &other) const
 
constexpr Value get () const
 Get the value representing current flags.
 
constexpr TBitFlagsset (const FlagsSet &flagsSet)
 
constexpr TBitFlagsset (Input flagsSet)
 
constexpr Input getEnum () const
 Get the enum representing current flags. This method is only defined for enum flags.
 
constexpr TBitFlagsunionWith (const FlagsSet &flagsSet)
 Unions specified flags into this instance.
 
constexpr TBitFlagsunionWith (const TBitFlags &flags)
 
constexpr TBitFlagsturnOn (const FlagsSet &flagsSet)
 Enable/disable specified flags.
 
constexpr TBitFlagsturnOff (const FlagsSet &flagsSet)
 

Detailed Description

template<typename Value, typename Input = Value>
class ph::TBitFlags< Value, Input >

Manipulate a value type where each bit is a binary flag.

Template Parameters
ValueThe underlying value type of this class. Must be an integral.
InputThe input type for the manipulation of flags. Can be integral, scoped/unscoped enum.

Constructor & Destructor Documentation

◆ TBitFlags() [1/4]

template<typename Value , typename Input >
ph::TBitFlags< Value, Input >::TBitFlags ( )
inlineconstexpr

Creates an instance with no flags.

◆ TBitFlags() [2/4]

template<typename Value , typename Input >
ph::TBitFlags< Value, Input >::TBitFlags ( const FlagsSet & flagsSet)
inlineexplicitconstexpr

Create with initial flags set.

◆ TBitFlags() [3/4]

template<typename Value , typename Input >
ph::TBitFlags< Value, Input >::TBitFlags ( Input flagsSet)
inlineexplicitconstexpr

Create with initial flags set.

◆ TBitFlags() [4/4]

template<typename Value , typename Input >
template<typename OtherInput >
ph::TBitFlags< Value, Input >::TBitFlags ( const TBitFlags< Value, OtherInput > & otherFlags)
inlineexplicitconstexpr

Copy construct flags from another TBitFlags with a different Input type.

Member Function Documentation

◆ get()

template<typename Value , typename Input >
Value ph::TBitFlags< Value, Input >::get ( ) const
inlineconstexpr

Get the value representing current flags.

◆ getEnum()

template<typename Value , typename Input = Value>
Input ph::TBitFlags< Value, Input >::getEnum ( ) const
inlineconstexpr

Get the enum representing current flags. This method is only defined for enum flags.

◆ has()

template<typename Value , typename Input >
bool ph::TBitFlags< Value, Input >::has ( Input singleFlag) const
inlineconstexpr

Checks whether this single flag is fully contained.

Parameters
singleFlagThe flag to test. If the flag combines multiple flags, this method is effectively the same as hasAll().

◆ hasAll() [1/2]

template<typename Value , typename Input >
bool ph::TBitFlags< Value, Input >::hasAll ( const FlagsSet & flagsSet) const
inlineconstexpr

Checks whether this instance contains all of the specified flags.

◆ hasAll() [2/2]

template<typename Value , typename Input >
bool ph::TBitFlags< Value, Input >::hasAll ( Input flagsSet) const
inlineconstexpr

Checks whether this instance contains all of the specified flags.

◆ hasAny() [1/2]

template<typename Value , typename Input >
bool ph::TBitFlags< Value, Input >::hasAny ( const FlagsSet & flagsSet) const
inlineconstexpr

Checks whether this instance contains at least one of the specified flags.

◆ hasAny() [2/2]

template<typename Value , typename Input >
bool ph::TBitFlags< Value, Input >::hasAny ( Input flagsSet) const
inlineconstexpr

Checks whether this instance contains at least one of the specified flags.

◆ hasExactly() [1/2]

template<typename Value , typename Input >
bool ph::TBitFlags< Value, Input >::hasExactly ( const FlagsSet & flagsSet) const
inlineconstexpr

Checks whether this instance contains exactly the specified flags. No more, no less.

◆ hasExactly() [2/2]

template<typename Value , typename Input >
bool ph::TBitFlags< Value, Input >::hasExactly ( Input flagsSet) const
inlineconstexpr

Checks whether this instance contains exactly the specified flags. No more, no less.

◆ hasNo()

template<typename Value , typename Input >
bool ph::TBitFlags< Value, Input >::hasNo ( Input singleFlag) const
inlineconstexpr

Checks whether this single flag is fully absent.

Parameters
singleFlagThe flag to test. If the flag combines multiple flags, this method is effectively the same as hasNone().

◆ hasNone() [1/2]

template<typename Value , typename Input >
bool ph::TBitFlags< Value, Input >::hasNone ( const FlagsSet & flagsSet) const
inlineconstexpr

Checks whether this instance contains no specified flags.

◆ hasNone() [2/2]

template<typename Value , typename Input >
bool ph::TBitFlags< Value, Input >::hasNone ( Input flagsSet) const
inlineconstexpr

Checks whether this instance contains no specified flags.

◆ intersectWith()

template<typename Value , typename Input >
TBitFlags< Value, Input > & ph::TBitFlags< Value, Input >::intersectWith ( const FlagsSet & flagsSet)
inlineconstexpr

Intersects this instance with the specified flags.

◆ isEmpty()

template<typename Value , typename Input >
bool ph::TBitFlags< Value, Input >::isEmpty ( ) const
inlineconstexpr

Checks whether this instance contains no flags.

◆ isEqual()

template<typename Value , typename Input >
bool ph::TBitFlags< Value, Input >::isEqual ( const TBitFlags< Value, Input > & other) const
inlineconstexpr

◆ set() [1/2]

template<typename Value , typename Input >
TBitFlags< Value, Input > & ph::TBitFlags< Value, Input >::set ( const FlagsSet & flagsSet)
inlineconstexpr

◆ set() [2/2]

template<typename Value , typename Input >
TBitFlags< Value, Input > & ph::TBitFlags< Value, Input >::set ( Input flagsSet)
inlineconstexpr

◆ turnOff()

template<typename Value , typename Input >
TBitFlags< Value, Input > & ph::TBitFlags< Value, Input >::turnOff ( const FlagsSet & flagsSet)
inlineconstexpr

◆ turnOn()

template<typename Value , typename Input >
TBitFlags< Value, Input > & ph::TBitFlags< Value, Input >::turnOn ( const FlagsSet & flagsSet)
inlineconstexpr

Enable/disable specified flags.

◆ unionWith() [1/2]

template<typename Value , typename Input >
TBitFlags< Value, Input > & ph::TBitFlags< Value, Input >::unionWith ( const FlagsSet & flagsSet)
inlineconstexpr

Unions specified flags into this instance.

◆ unionWith() [2/2]

template<typename Value , typename Input >
TBitFlags< Value, Input > & ph::TBitFlags< Value, Input >::unionWith ( const TBitFlags< Value, Input > & flags)
inlineconstexpr

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