Flow 1.0.2
Flow project: Full implementation reference.
Namespaces | Macros | Enumerations | Functions
cfg_manager_fwd.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  flow
 Catch-all namespace for the Flow project: A collection of various production-quality modules written in modern C++17, originally by ygoldfel.
 
namespace  flow::cfg
 Flow module that facilitates configuring modules, such as applications and APIs, via statically and/or dynamically parsed sets of name/value pairs from config sources like files and command lines.
 

Macros

#define FLOW_CFG_OPT_CHECK_ASSERT(ARG_must_be_true)
 Convenience macro particularly useful in the final_validator_func() callback taken by various Config_manager APIs; checks the given condition; if false logs a FLOW_LOG_WARNING() containing the failed condition and executes outcome = flow::cfg::Final_validator_func::S_FAIL;; otherwise no-op. More...
 

Enumerations

enum class  flow::cfg::Final_validator_outcome { flow::cfg::S_ACCEPT , flow::cfg::S_SKIP , flow::cfg::S_FAIL }
 Result enumeration for a Final_validator_func::Type function which is used by a Config_manager user when parsing a config source (ex: file). More...
 

Functions

template<typename... S_d_value_set>
std::ostream & flow::cfg::operator<< (std::ostream &os, const Config_manager< S_d_value_set... > &val)
 Serializes (briefly) a Config_manager to a standard output stream. More...
 

Macro Definition Documentation

◆ FLOW_CFG_OPT_CHECK_ASSERT

#define FLOW_CFG_OPT_CHECK_ASSERT (   ARG_must_be_true)
Value:
( \
if (!(ARG_must_be_true)) \
{ \
FLOW_LOG_WARNING("Validation failed; the following condition must hold: [" #ARG_must_be_true "]."); \
outcome = ::flow::cfg::Final_validator_outcome::S_FAIL; \
} \
)
#define FLOW_UTIL_SEMICOLON_SAFE(ARG_func_macro_definition)
Use this to create a semicolon-safe version of a "void" functional macro definition consisting of at ...
Definition: util_fwd.hpp:1079

Convenience macro particularly useful in the final_validator_func() callback taken by various Config_manager APIs; checks the given condition; if false logs a FLOW_LOG_WARNING() containing the failed condition and executes outcome = flow::cfg::Final_validator_func::S_FAIL;; otherwise no-op.

Note the context must be such that FLOW_LOG_WARNING() compiles and acts properly.

If auto outcome = flow::cfg::Final_validator_func::S_ACCEPT; precedes multiple invocations of this macro, then by the end of those invocations outcome == S_ACCEPT if and only if all checks passed. All errors will be printed if outcome != S_ACCEPT.

Informally: If you have a condition that would cause your final_validator_func() to return flow::cfg::Final_validator_outcome::S_SKIP, then it is probably best to check for this potential condition, and return flow::cfg::Final_validator_outcome::S_SKIP if it holds, before any further checks (FLOW_CFG_OPT_CHECK_ASSERT() calls).

Parameters
ARG_must_be_trueAn expression convertible to bool that should evaluate to true to avoid WARNING and outcome = S_FAIL;.

Definition at line 111 of file cfg_manager_fwd.hpp.