Bifrost SDK
Bifrost SDK documentation
Amino::MessageFilter Class Reference

Helper class to filter messages based on their MessageKind. More...

#include <Message.h>

Public Types

enum  Level : int {
  eDisabled = -1 , eError = static_cast<int>(MessageKind::eError) , eWarning = static_cast<int>(MessageKind::eWarning) , eInfo = static_cast<int>(MessageKind::eInfo) ,
  eDebug = static_cast<int>(MessageKind::eDebug)
}
 Same as MessageKind with the addition of a disabled level. More...
 

Public Member Functions

 MessageFilter () noexcept=default
 Default constructor. More...
 
Level getLevel () const
 Get the message filter Level. More...
 
bool isEnabled (MessageKind kind) const
 Returns whether the given MessageKind is enabled. More...
 
bool isEnabled () const
 Returns whether logging is enabled (i.e. the level isn't eDisabled). More...
 
 MessageFilter (MessageKind lvl) noexcept
 Constructs a message filter from the given level. More...
 
 MessageFilter (Level lvl) noexcept
 Constructs a message filter from the given level. More...
 
void setLevel (MessageKind lvl)
 Enables the MessageKind up to (and including) the given level. More...
 
void setLevel (Level lvl)
 Enables the MessageKind up to (and including) the given level. More...
 

Static Public Member Functions

static constexpr Level asLevel (MessageKind kind)
 Get the Level corresponding to the given MessageKind. More...
 

Detailed Description

Helper class to filter messages based on their MessageKind.

Definition at line 306 of file Message.h.

Member Enumeration Documentation

◆ Level

Same as MessageKind with the addition of a disabled level.

Enumerator
eDisabled 
eError 
eWarning 
eInfo 
eDebug 

Definition at line 311 of file Message.h.

Constructor & Destructor Documentation

◆ MessageFilter() [1/3]

Amino::MessageFilter::MessageFilter ( )
defaultnoexcept

Default constructor.

By default, the message level is eInfo, meaning that info, warnings, and errors are enabled, but debug messages are disabled.

◆ MessageFilter() [2/3]

Amino::MessageFilter::MessageFilter ( MessageKind  lvl)
inlineexplicitnoexcept

Constructs a message filter from the given level.

Definition at line 337 of file Message.h.

◆ MessageFilter() [3/3]

Amino::MessageFilter::MessageFilter ( Level  lvl)
inlineexplicitnoexcept

Constructs a message filter from the given level.

Definition at line 339 of file Message.h.

Member Function Documentation

◆ asLevel()

static constexpr Level Amino::MessageFilter::asLevel ( MessageKind  kind)
inlinestaticconstexpr

Get the Level corresponding to the given MessageKind.

Definition at line 322 of file Message.h.

Referenced by isEnabled(), and setLevel().

◆ getLevel()

Level Amino::MessageFilter::getLevel ( ) const
inline

Get the message filter Level.

Definition at line 343 of file Message.h.

◆ isEnabled() [1/2]

bool Amino::MessageFilter::isEnabled ( ) const
inline

Returns whether logging is enabled (i.e. the level isn't eDisabled).

Definition at line 357 of file Message.h.

References eDisabled.

◆ isEnabled() [2/2]

bool Amino::MessageFilter::isEnabled ( MessageKind  kind) const
inline

Returns whether the given MessageKind is enabled.

Definition at line 353 of file Message.h.

References asLevel().

◆ setLevel() [1/2]

void Amino::MessageFilter::setLevel ( Level  lvl)
inline

Enables the MessageKind up to (and including) the given level.

Definition at line 349 of file Message.h.

◆ setLevel() [2/2]

void Amino::MessageFilter::setLevel ( MessageKind  lvl)
inline

Enables the MessageKind up to (and including) the given level.

Definition at line 348 of file Message.h.

References asLevel(), and setLevel().

Referenced by setLevel().