HART  0.2.0
High level Audio Regression and Testing
Loading...
Searching...
No Matches
ChannelFlags Class Reference

A set of boolean flags mapped to each audio channel. More...

#include <hart_channel_flags.hpp>

Public Member Functions

 ChannelFlags (bool defaultValues=true, size_t numChannels=m_maxChannels)
 Creates a new channel flags object.
 
void setAllTo (bool newValues)
 Sets all flags to a new value.
 
size_t size () const noexcept
 Returns the size (not capacity) of the container.
 
void resize (size_t newNumChannels)
 Resizes the container.
 
std::bitset< m_maxChannels >::reference operator[] (size_t channel)
 Access the flag value for a specific channel.
 
bool operator[] (size_t channel) const
 Access the flag value for a specific channel.
 
bool allTrue () const noexcept
 Checks if all flags are set to true
 
size_t numTrue ()
 Checks how many channels are marked with true
 
bool anyTrue () const noexcept
 Checks if any of the flags is set to true
 
void representAsInitializerList (std::ostream &stream) const
 Makes text representation of itself as a initializer list of active channels.
 

Detailed Description

A set of boolean flags mapped to each audio channel.

Definition at line 12 of file hart_channel_flags.hpp.

Constructor & Destructor Documentation

◆ ChannelFlags()

ChannelFlags ( bool  defaultValues = true,
size_t  numChannels = m_maxChannels 
)
inline

Creates a new channel flags object.

Parameters
defaultValuesInitial value for all flags
numChannelsSize of the contailer

Definition at line 21 of file hart_channel_flags.hpp.

Member Function Documentation

◆ setAllTo()

void setAllTo ( bool  newValues)
inline

Sets all flags to a new value.

Parameters
newValuesNew values for all flags

Definition at line 32 of file hart_channel_flags.hpp.

◆ size()

size_t size ( ) const
inlinenoexcept

Returns the size (not capacity) of the container.

This size is guaranteed to be equal to the number of channels in whatever it's assotiated with, or more.

Definition at line 43 of file hart_channel_flags.hpp.

◆ resize()

void resize ( size_t  newNumChannels)
inline

Resizes the container.

Does not change the capacity - it's fixed. Does not change the flags values.

Definition at line 51 of file hart_channel_flags.hpp.

◆ operator[]() [1/2]

std::bitset< m_maxChannels >::reference operator[] ( size_t  channel)
inline

Access the flag value for a specific channel.

Parameters
channelNumber of channel (0-based)
Returns
A reference to underlying storage for the corresponding flag

Definition at line 62 of file hart_channel_flags.hpp.

◆ operator[]() [2/2]

bool operator[] ( size_t  channel) const
inline

Access the flag value for a specific channel.

Parameters
channelNumber of channel (0-based)
Returns
Value of a corresponding flag

Definition at line 72 of file hart_channel_flags.hpp.

◆ allTrue()

bool allTrue ( ) const
inlinenoexcept

Checks if all flags are set to true

Returns
true if all flags for all channels are true, false otherwise

Definition at line 81 of file hart_channel_flags.hpp.

◆ numTrue()

size_t numTrue ( )
inline

Checks how many channels are marked with true

Returns
Amount of flags set to true

Definition at line 94 of file hart_channel_flags.hpp.

◆ anyTrue()

bool anyTrue ( ) const
inlinenoexcept

Checks if any of the flags is set to true

Returns
true if flag for at least one channel is true, false otherwise

Definition at line 106 of file hart_channel_flags.hpp.

◆ representAsInitializerList()

void representAsInitializerList ( std::ostream &  stream) const
inline

Makes text representation of itself as a initializer list of active channels.

Parameters
[out]streamOutput stream to write to

Definition at line 119 of file hart_channel_flags.hpp.


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