Classes | Typedefs | Functions
rapidsmpf::config Namespace Reference

Classes

class  OptionValue
 Configuration option value. More...
 
class  Options
 Manages configuration options for RapidsMPF operations. More...
 

Typedefs

template<typename T >
using OptionFactory = std::function< T(std::string const &)>
 Type alias for a factory function that constructs options from strings. More...
 

Functions

void get_environment_variables (std::unordered_map< std::string, std::string > &output, std::string const &key_regex="RAPIDSMPF_(.*)")
 Populates a map with environment variables matching a given regular expression. More...
 
std::unordered_map< std::string, std::string > get_environment_variables (std::string const &key_regex="RAPIDSMPF_(.*)")
 Returns a map of environment variables matching a given regular expression. More...
 

Detailed Description

SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. SPDX-License-Identifier: Apache-2.0

Typedef Documentation

◆ OptionFactory

template<typename T >
using rapidsmpf::config::OptionFactory = typedef std::function<T(std::string const&)>

Type alias for a factory function that constructs options from strings.

The factory receives the string representation of an option value and returns an instance of the option type. If the option is unset, the function receives an empty string and should either return a meaningful default value or throw std::invalid_argument.

Note
The factory must not access other options, as a lock is held during option initialization and doing so may cause a deadlock.

Definition at line 32 of file config.hpp.

Function Documentation

◆ get_environment_variables() [1/2]

std::unordered_map<std::string, std::string> rapidsmpf::config::get_environment_variables ( std::string const &  key_regex = "RAPIDSMPF_(.*)")

Returns a map of environment variables matching a given regular expression.

This is a convenience overload. See the documentation for the first variant of get_environment_variables() for details on matching and behavior.

Parameters
key_regexA regular expression with a single capture group to match and extract the environment variable keys.
Returns
A map containing all matching environment variables, with keys as extracted by the capture group.
Exceptions
std::invalid_argumentIf key_regex doesn't contain exactly one capture group.
See also
get_environment_variables(std::unordered_map<std::string, std::string>&, std::string const&)

◆ get_environment_variables() [2/2]

void rapidsmpf::config::get_environment_variables ( std::unordered_map< std::string, std::string > &  output,
std::string const &  key_regex = "RAPIDSMPF_(.*)" 
)

Populates a map with environment variables matching a given regular expression.

This function scans the current process's environment variables and inserts those whose keys match the provided regular expression into the output map. Only variables with keys not already present in output are inserted; existing keys are left unchanged.

The key_regex should contain a single capture group that extracts the portion of the environment variable key you want to use as the map key. For example, to strip the RAPIDSMPF_ prefix, use RAPIDSMPF_(.*) as the regex. The captured group will be used as the key in the output map.

Example:

  • Environment variable: RAPIDSMPF_FOO=bar
  • key_regex: "RAPIDSMPF_(.*)"
  • Resulting map entry: { "FOO", "bar" }
Parameters
[out]outputThe map to populate with matching environment variables. Only keys that do not already exist in the map will be added.
[in]key_regexA regular expression with a single capture group to match and extract the environment variable keys. Only environment variables with keys matching this pattern will be considered.
Exceptions
std::invalid_argumentIf key_regex doesn't contain exactly one capture group.
Warning
This function uses std::regex and relies on the global environ symbol, which is POSIX-specific and is not thread-safe.