feat(options): deprecate the old ProgOptions accessors

- Mark GetValue<T>(), SetValue() and GetStringValue() as deprecated in
  favour of the property API, as the TODO comments ask.
- fairmq-modernize-progoptions-accessors migrates the calls.
- List them in the migration guide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-11-09 22:58:27 +00:00
parent aed31b4090
commit 8ee2518fb1
2 changed files with 9 additions and 3 deletions

View File

@@ -228,7 +228,8 @@ class ProgOptions
/// @param key
/// @return config property
template<typename T>
T GetValue(const std::string& key) const /* TODO: deprecate this */
[[deprecated("Use GetProperty<T>(key, {})")]]
T GetValue(const std::string& key) const
{
std::lock_guard<std::mutex> lock(fMtx);
if (fVarMap.count(key)) {
@@ -239,11 +240,13 @@ class ProgOptions
}
}
template<typename T>
int SetValue(const std::string& key, T val) /* TODO: deprecate this */ { SetProperty(key, val); return 0; }
[[deprecated("Use SetProperty(key, val)")]]
int SetValue(const std::string& key, T val) { SetProperty(key, val); return 0; }
/// @brief Read config property as string, return default-constructed object if key doesn't exist
/// @param key
/// @return config property
std::string GetStringValue(const std::string& key) const; /* TODO: deprecate this */
[[deprecated("Use GetPropertyAsString(key, {})")]]
std::string GetStringValue(const std::string& key) const;
private:
void ParseDefaults();