XVector
xvec::host::ConfigManager Class Reference

Thread-safe singleton for centralized configuration management. More...

#include <xvec_config.hpp>

Public Member Functions

 ConfigManager (const ConfigManager &)=delete
 
ConfigManager & operator= (const ConfigManager &)=delete
 
 ConfigManager (ConfigManager &&)=delete
 
ConfigManager & operator= (ConfigManager &&)=delete
 
uint32_t getDeviceId () const
 Get the device ID. More...
 
uint32_t getNumSub () const
 Get the number of Subs to build device Jobs from. More...
 
uint32_t getTaskCount () const
 Get the task count. More...
 
uint32_t getHostLogLevel () const
 Get the host runtime log level (0=NONE, 1=ERROR, 2=WARN, 3=INFO, 4=DEBUG, 5=TRACE). More...
 
uint32_t getDeviceLogLevel () const
 Get the device runtime log level (0=NONE, 1=ERROR, 2=WARN, 3=INFO, 4=DEBUG, 5=TRACE). More...
 
bool isHostLogEnabled () const
 Check if host logging is enabled. More...
 
bool isDeviceLogEnabled () const
 Check if device logging is enabled. More...
 
std::optional< uint32_t > getUint32 (const std::string &key) const
 Get a uint32 configuration value by key. More...
 
std::optional< uint64_t > getUint64 (const std::string &key) const
 Get a uint64 configuration value by key. More...
 
std::optional< bool > getBool (const std::string &key) const
 Get a boolean configuration value by key. More...
 

Static Public Member Functions

static ConfigManager & instance ()
 Get the singleton instance. More...
 

Detailed Description

Thread-safe singleton for centralized configuration management.

ConfigManager uses Meyer's singleton pattern for thread-safe initialization. All getters are protected by a mutex and return copies (not references) for thread safety.

Configuration sources (in priority order):

  1. Environment variables (highest priority)
  2. Default values (lowest priority)

See xvec_config.hpp for supported environment variables and validation rules. Values are read on the first instance() call and are not refreshed by later environment changes. Initialization sets the host logger level.

Creating a context with xvecCreateContext() or xvec::Context does not automatically apply these settings. Pass getDeviceId() when creating the context, and apply resource and device-log settings from the getters with xvecSetContextProperty().

Definition at line 86 of file xvec_config.hpp.

Constructor & Destructor Documentation

◆ ConfigManager() [1/2]

xvec::host::ConfigManager::ConfigManager ( const ConfigManager &  )
delete

◆ ConfigManager() [2/2]

xvec::host::ConfigManager::ConfigManager ( ConfigManager &&  )
delete

Member Function Documentation

◆ getBool()

std::optional<bool> xvec::host::ConfigManager::getBool ( const std::string &  key) const

Get a boolean configuration value by key.

Parameters
keyConfiguration key name.
Returns
The value if found, std::nullopt otherwise.

◆ getDeviceId()

uint32_t xvec::host::ConfigManager::getDeviceId ( ) const

Get the device ID.

◆ getDeviceLogLevel()

uint32_t xvec::host::ConfigManager::getDeviceLogLevel ( ) const

Get the device runtime log level (0=NONE, 1=ERROR, 2=WARN, 3=INFO, 4=DEBUG, 5=TRACE).

◆ getHostLogLevel()

uint32_t xvec::host::ConfigManager::getHostLogLevel ( ) const

Get the host runtime log level (0=NONE, 1=ERROR, 2=WARN, 3=INFO, 4=DEBUG, 5=TRACE).

◆ getNumSub()

uint32_t xvec::host::ConfigManager::getNumSub ( ) const

Get the number of Subs to build device Jobs from.

Read from the device when the config is built, so it matches the part in use; never 0. PXL_NUM_SUB overrides it, PXL_NUM_SUB=0 means "ask the device".

◆ getTaskCount()

uint32_t xvec::host::ConfigManager::getTaskCount ( ) const

Get the task count.

◆ getUint32()

std::optional<uint32_t> xvec::host::ConfigManager::getUint32 ( const std::string &  key) const

Get a uint32 configuration value by key.

Parameters
keyConfiguration key name.
Returns
The value if found, std::nullopt otherwise.

◆ getUint64()

std::optional<uint64_t> xvec::host::ConfigManager::getUint64 ( const std::string &  key) const

Get a uint64 configuration value by key.

Parameters
keyConfiguration key name.
Returns
The value if found, std::nullopt otherwise.

◆ instance()

static ConfigManager& xvec::host::ConfigManager::instance ( )
static

Get the singleton instance.

Returns
Reference to the ConfigManager singleton.

◆ isDeviceLogEnabled()

bool xvec::host::ConfigManager::isDeviceLogEnabled ( ) const

Check if device logging is enabled.

◆ isHostLogEnabled()

bool xvec::host::ConfigManager::isHostLogEnabled ( ) const

Check if host logging is enabled.

◆ operator=() [1/2]

ConfigManager& xvec::host::ConfigManager::operator= ( ConfigManager &&  )
delete

◆ operator=() [2/2]

ConfigManager& xvec::host::ConfigManager::operator= ( const ConfigManager &  )
delete

The documentation for this class was generated from the following file: