chronon::ParameterSet
Base for parameter sets backed by self-registering Param
#include <ParameterSet.hpp>
Public Functions
| Name | |
|---|---|
| virtual | ~ParameterSet() =default |
| virtual bool | validate() const |
| virtual void | setParamString(const std::string & name, const std::string & value) Parse and assign a parameter's value by name. |
| const std::vector< ParamBase * > & | registeredParams() const |
| void | registerParam(ParamBase * param) Register a parameter (called from Param |
| virtual std::string | getParamString(const std::string & name) const Look up a parameter's value by name. |
| virtual void | forEachParam(std::function< void(const std::string &, const std::string &)> callback) const Invoke callback with (name, value-as-string) for each registered parameter. |
| virtual void | deserializeYAML(const void * yaml_node) Load every registered parameter from a YAML node (type-erased). |
Protected Attributes
| Name | |
|---|---|
| std::vector< ParamBase * > | params_ Non-owning pointers to registered params. |
Detailed Description
class chronon::ParameterSet;
Base for parameter sets backed by self-registering Param
Provides validation, iteration, and YAML serialization that walk every registered parameter without manual listing.
class CPUParams : public ParameterSet {
public:
Param<uint32_t> num_requests{this, "num_requests", 100, "Number of requests"};
Param<uint32_t> request_delay{this, "request_delay", 1, "Request delay"};
};
uint32_t n = params.num_requests;
params.num_requests = 50;
Public Functions Documentation
function ~ParameterSet
virtual ~ParameterSet() =default
function validate
inline virtual bool validate() const
Return: true if every registered parameter validates.
function setParamString
inline virtual void setParamString(
const std::string & name,
const std::string & value
)
Parse and assign a parameter's value by name.
Exceptions:
- std::runtime_error if no parameter has the given name or parsing fails.
function registeredParams
inline const std::vector< ParamBase * > & registeredParams() const
function registerParam
inline void registerParam(
ParamBase * param
)
Register a parameter (called from Param
param must outlive this ParameterSet.
function getParamString
inline virtual std::string getParamString(
const std::string & name
) const
Look up a parameter's value by name.
Exceptions:
- std::runtime_error if no parameter has the given name.
function forEachParam
inline virtual void forEachParam(
std::function< void(const std::string &, const std::string &)> callback
) const
Invoke callback with (name, value-as-string) for each registered parameter.
function deserializeYAML
inline virtual void deserializeYAML(
const void * yaml_node
)
Load every registered parameter from a YAML node (type-erased).
Parameters:
- yaml_node Pointer to const YAML::Node; nullptr is a no-op.
Protected Attributes Documentation
variable params_
std::vector< ParamBase * > params_;
Non-owning pointers to registered params.
Updated on 2026-05-26 at 05:42:32 +0000