![]() |
dfx 0.1.0
Linux-based dynamic dataflow executor
|
Namespaces | |
| namespace | literals |
| Namespace containing fixed-width integer literal operators. | |
Classes | |
| class | Exception |
Runtime error that captures a std::source_location. More... | |
| struct | ExecOnOOS |
| Scope guard that executes a callable when it goes out of scope. More... | |
| class | Flags |
| Typesafe bitmask wrapper for enum flags. More... | |
| class | JoinedView |
Lightweight wrapper used to format a range as a delimiter-joined string via std::format. More... | |
| class | JsonValidator |
| Registry of JSON Schemas with validation helpers. More... | |
| class | LoggerFactory |
| class | MonotonicIdAllocator |
| Monotonically increasing ID allocator. More... | |
| class | RecyclableIdAllocator |
| ID allocator that can recycle released identifiers. More... | |
| struct | ScopedMdc |
| class | SystemConfig |
| System configuration registry with typed values, entry metadata, and change callbacks. More... | |
| struct | TransparentEqual |
| Transparent equality predicate for string-like lookups. More... | |
| struct | TransparentHash |
| Transparent hash functor for string-like lookups. More... | |
| struct | UUID |
| 128-bit UUID value type. More... | |
| class | UUIDGenerator |
| Random UUID generator. More... | |
Concepts | |
| concept | IsEnum |
| Concept matching any enumeration type. This is used to constrain Flags to be instantiated only with enum types. | |
Typedefs | |
| using | ExceptionStack = std::vector<Exception> |
| Convenience alias for a linearized nested exception chain. | |
| using | TransparentLess = std::less<> |
| Comparator alias enabling transparent ordered lookup. | |
| template<typename T, typename Allocator = std::allocator<std::pair<std::string const, T>>> | |
| using | UnorderedStringMap = std::unordered_map<std::string, T, TransparentHash, TransparentEqual, Allocator> |
Convenience alias for an unordered map keyed by std::string with transparent lookup. | |
| template<typename T, typename Allocator = std::allocator<std::pair<std::string const, T>>> | |
| using | StringMap = std::map<std::string, T, TransparentLess, Allocator> |
Convenience alias for an ordered map keyed by std::string with transparent lookup. | |
Functions | |
| template<typename T> | |
| constexpr bool | __b_assert_expr (T &&expr) |
| Helper used by B_ASSERT to validate and evaluate the asserted expression. | |
| template<typename F, typename ... Args> requires std::invocable<F, Args...> | |
| auto | safeInvoke (std::shared_ptr< spdlog::logger > logger, F &&f, Args &&... args) noexcept |
| Invoke a callable and catch/log all exceptions. | |
| template<typename F, typename ... Args> requires std::invocable<F, Args...> | |
| auto | safeInvoke (std::string const &loggerName, F &&f, Args &&... args) noexcept |
| Convenience overload of safeInvoke using a logger name. Internally resolves the logger via spdlog::get(loggerName) and then calls the logger-pointer overload. | |
| template<std::ranges::forward_range Range> | |
| constexpr JoinedView< Range > | join (Range const &range, std::string_view delimiter) noexcept |
| Create a JoinedView from a range and a delimiter. | |
| template<typename It, typename Sent> requires std::forward_iterator<It> && std::sentinel_for<Sent, It> | |
| constexpr auto | join (It first, Sent last, std::string_view delimiter) noexcept |
| Create a JoinedView from an iterator/sentinel pair and a delimiter. | |
| std::vector< std::string > | split (std::string const &str, std::string_view sep=" ", bool skipEmpty=true, bool shouldTrim=false) |
Split a string into substrings separated by sep. | |
| std::vector< std::string_view > | splitView (std::string_view str, std::string_view sep=" ", bool skipEmpty=true, bool shouldTrim=false) |
Split a string view into substring views separated by sep. | |
| std::string | toLower (std::string_view str) |
| Convert a string to lower case. | |
| std::string | toUpper (std::string_view str) |
| Convert a string to upper case. | |
| std::string & | ltrim (std::string &s) noexcept |
| Trim leading whitespace from a string in-place. | |
| std::string & | rtrim (std::string &s) noexcept |
| Trim trailing whitespace from a string in-place. | |
| std::string & | trim (std::string &s) noexcept |
| Trim leading and trailing whitespace from a string in-place. | |
| std::string_view & | trimView (std::string_view &str) noexcept |
| Trim leading and trailing whitespace from a string view by adjusting its boundaries. | |
| template<typename T1, typename T2> | |
| bool | isOneOf (T1 val, std::initializer_list< T2 const > list) |
Test whether val is equal to one of the elements in list. | |
| template<typename T1, typename T2> | |
| bool | isOneOf (T1 val, std::span< T2 const > list) |
Test whether val is equal to one of the elements in list. | |
| std::string | formatBytes (std::uint64_t byteCount, std::size_t precision=2) |
| Format a byte count as a human-readable string. | |
| std::optional< bool > | boolFromString (std::string_view str) noexcept |
| Parse a boolean value from text. | |
| std::string_view | boolToString (bool value) noexcept |
| Convert a boolean value to a stable textual representation. | |
| std::string_view | strsignal (int sig) noexcept |
| Convert a signal number to a stringified version. | |
| using dfx::Utils::ExceptionStack = std::vector<Exception> |
Convenience alias for a linearized nested exception chain.
The first element is the outer-most exception (the one you caught), followed by nested exceptions (as produced by std::throw_with_nested).
| using dfx::Utils::StringMap = std::map<std::string, T, TransparentLess, Allocator> |
Convenience alias for an ordered map keyed by std::string with transparent lookup.
| T | Value type. |
| Allocator | Allocator type for std::pair<const std::string, T>. |
Uses TransparentLess (i.e. std::less<>) to allow heterogeneous lookup with std::string_view.
| using dfx::Utils::TransparentLess = std::less<> |
Comparator alias enabling transparent ordered lookup.
std::less<> is a transparent comparator. When used as the comparator of std::map<std::string, ...>, it enables lookups using std::string_view without allocating a temporary std::string.
| using dfx::Utils::UnorderedStringMap = std::unordered_map<std::string, T, TransparentHash, TransparentEqual, Allocator> |
Convenience alias for an unordered map keyed by std::string with transparent lookup.
| T | Value type. |
| Allocator | Allocator type for std::pair<const std::string, T>. |
Uses TransparentHash and TransparentEqual to allow heterogeneous lookup with std::string_view.
|
constexpr |
Helper used by B_ASSERT to validate and evaluate the asserted expression.
This function exists mainly to improve diagnostics:
expr.
|
noexcept |
Parse a boolean value from text.
| str | Input text. |
std::optional<bool> containing the parsed boolean on successstd::nullopt if the string is not recognized as a boolean valueThe accepted spellings are "true" and "false" only in a case-insensitive manner. Any other value will return std::nullopt
|
noexcept |
Convert a boolean value to a stable textual representation.
| value | Boolean value. |
This will return the string "true" or "false" depending on the input value
| std::string dfx::Utils::formatBytes | ( | std::uint64_t | byteCount, |
| std::size_t | precision = 2 ) |
Format a byte count as a human-readable string.
| byteCount | Number of bytes. |
| precision | Number of fractional digits to include. |
| bool dfx::Utils::isOneOf | ( | T1 | val, |
| std::initializer_list< T2 const > | list ) |
Test whether val is equal to one of the elements in list.
| T1 | Value type. |
| T2 | List element type. |
| val | Value to test. |
| list | Candidate values. |
true if val matches an element of list, otherwise false.This performs a linear search using operator==.
| bool dfx::Utils::isOneOf | ( | T1 | val, |
| std::span< T2 const > | list ) |
Test whether val is equal to one of the elements in list.
| T1 | Value type. |
| T2 | List element type. |
| val | Value to test. |
| list | Candidate values as a span. |
true if val matches an element of list, otherwise false.This performs a linear search using operator==.
|
constexprnoexcept |
Create a JoinedView from an iterator/sentinel pair and a delimiter.
Convenience overload that builds a std::ranges::subrange and forwards to join(range, delimiter).
| It | Forward iterator type. |
| Sent | Sentinel type for It. |
| first | Beginning of the sequence. |
| last | End sentinel of the sequence. |
| delimiter | Delimiter placed between consecutive elements. |
|
constexprnoexcept |
Create a JoinedView from a range and a delimiter.
This is the recommended entry point.
| Range | A forward range type. |
| range | Input range to join. |
| delimiter | Delimiter placed between consecutive elements. |
range and the delimiter view.
|
noexcept |
Trim leading whitespace from a string in-place.
| s | String to trim. |
s.Removes whitespace at the beginning of s.
|
noexcept |
Trim trailing whitespace from a string in-place.
| s | String to trim. |
s.Removes whitespace at the end of s.
|
noexcept |
Invoke a callable and catch/log all exceptions.
This helper is meant for "best-effort" code paths such as callbacks, destructors, or logging hooks where throwing is not desirable. Any exception is swallowed.
std::exception and logs what().If the callable returns a value, the return type is std::optional<Result>:
| F | Callable type. |
| Args | Argument types. |
| logger | Logger to use; if null, errors are swallowed silently. |
| f | Callable to invoke. |
| args | Arguments forwarded to the callable. |
|
noexcept |
Convenience overload of safeInvoke using a logger name. Internally resolves the logger via spdlog::get(loggerName) and then calls the logger-pointer overload.
| std::vector< std::string > dfx::Utils::split | ( | std::string const & | str, |
| std::string_view | sep = " ", | ||
| bool | skipEmpty = true, | ||
| bool | shouldTrim = false ) |
Split a string into substrings separated by sep.
| str | Input string to split. |
| sep | Separator string. May contain multiple characters. |
| skipEmpty | If true, empty tokens are omitted. |
| shouldTrim | If true, each produced token is trimmed (whitespace) before being returned. |
std::string tokens. If you want zero-allocation views over the original text, use splitView. | std::vector< std::string_view > dfx::Utils::splitView | ( | std::string_view | str, |
| std::string_view | sep = " ", | ||
| bool | skipEmpty = true, | ||
| bool | shouldTrim = false ) |
Split a string view into substring views separated by sep.
| str | Input string view to split. |
| sep | Separator string. May contain multiple characters. |
| skipEmpty | If true, empty tokens are omitted. |
| shouldTrim | If true, each produced token view is trimmed (whitespace) before being returned. |
std::string_view tokens.str. The caller must ensure the referenced character storage remains valid for as long as the returned views are used.
|
noexcept |
Convert a signal number to a stringified version.
Unlike strsignal(3), this function doesn't return a description of the signal number but the stringified version of its macro. Example:
| Signal | dfx::Utils::strsignal | strsignal(3) |
|---|---|---|
| SIGKILL | "SIGKILL" | "Killed" |
| SIGTERM | "SIGTERM" | "Terminated" |
| SIGSEGV | "SIGSEGV" | "Segmentation fault" |
This function returns the string "Unknown" for unrecognized signal number
| sig | Signal number (e.g., SIGTERM). |
| std::string dfx::Utils::toLower | ( | std::string_view | str | ) |
Convert a string to lower case.
| str | Input text. |
| std::string dfx::Utils::toUpper | ( | std::string_view | str | ) |
Convert a string to upper case.
| str | Input text. |
|
noexcept |
|
noexcept |
Trim leading and trailing whitespace from a string view by adjusting its boundaries.
| str | String view to trim. |
str (updated to the trimmed view).This does not modify the underlying character storage; it only adjusts the view.