XVector
xvec_config.hpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2026 XCENA Inc.
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
51 #pragma once
52 
53 #ifdef __cplusplus
54 
55 #include <cstdint>
56 #include <memory>
57 #include <optional>
58 #include <string>
59 #include <utility>
60 
61 namespace xvec
62 {
63 namespace host
64 {
65 
87 {
88 public:
94 
95  // Delete copy and move operations
96  ConfigManager(const ConfigManager&) = delete;
100 
101  // =========================================================================
102  // Typed Getters (Thread-Safe)
103  // =========================================================================
104 
106  uint32_t getDeviceId() const;
107 
114  uint32_t getNumSub() const;
115 
117  uint32_t getTaskCount() const;
118 
120  uint32_t getHostLogLevel() const;
121 
123  uint32_t getDeviceLogLevel() const;
124 
126  bool isHostLogEnabled() const;
127 
129  bool isDeviceLogEnabled() const;
130 
131  // =========================================================================
132  // Generic Getters (Thread-Safe)
133  // =========================================================================
134 
140  std::optional<uint32_t> getUint32(const std::string& key) const;
141 
147  std::optional<uint64_t> getUint64(const std::string& key) const;
148 
154  std::optional<bool> getBool(const std::string& key) const;
155 
156 private:
157  ConfigManager();
158  ~ConfigManager(); // Non-virtual: singleton is not intended for inheritance
159 
160  class Impl;
161  std::unique_ptr<Impl> impl_;
162 };
163 
164 } // namespace host
165 
166 } // namespace xvec
167 
168 #endif // __cplusplus
Thread-safe singleton for centralized configuration management.
Definition: xvec_config.hpp:87
bool isHostLogEnabled() const
Check if host logging is enabled.
uint32_t getHostLogLevel() const
Get the host runtime log level (0=NONE, 1=ERROR, 2=WARN, 3=INFO, 4=DEBUG, 5=TRACE).
ConfigManager(const ConfigManager &)=delete
ConfigManager & operator=(const ConfigManager &)=delete
bool isDeviceLogEnabled() const
Check if device logging is enabled.
ConfigManager(ConfigManager &&)=delete
std::optional< uint32_t > getUint32(const std::string &key) const
Get a uint32 configuration value by key.
uint32_t getDeviceId() const
Get the device ID.
uint32_t getDeviceLogLevel() const
Get the device runtime log level (0=NONE, 1=ERROR, 2=WARN, 3=INFO, 4=DEBUG, 5=TRACE).
static ConfigManager & instance()
Get the singleton instance.
uint32_t getNumSub() const
Get the number of Subs to build device Jobs from.
uint32_t getTaskCount() const
Get the task count.
ConfigManager & operator=(ConfigManager &&)=delete
std::optional< uint64_t > getUint64(const std::string &key) const
Get a uint64 configuration value by key.
std::optional< bool > getBool(const std::string &key) const
Get a boolean configuration value by key.