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

@@ -176,6 +176,9 @@ The compiler warns for these members too. The column "Declared in" names the hea
| [`Device::Deserialize<D>(msg, data, args...)`](/api/fair/mq/Device/#Deserialize) | `D().Deserialize(msg, data, args...)` | `Device.h` |
| [`Parts::AddPart(Message* msg)`](/api/fair/mq/Parts/#AddPart) | [`Parts::AddPart(MessagePtr msg)`](/api/fair/mq/Parts/#AddPart-2) | `Parts.h` |
| [`Parts::AtRef(index)`](/api/fair/mq/Parts/#AtRef) | `*(parts.At(index))` with [`At()`](/api/fair/mq/Parts/#At) | `Parts.h` |
| [`ProgOptions::GetValue<T>(key)`](/api/fair/mq/ProgOptions/#GetValue) | [`GetProperty<T>(key)`](/api/fair/mq/ProgOptions/#GetProperty), or `GetProperty<T>(key, {})` if the key can be missing | `ProgOptions.h` |
| [`ProgOptions::GetStringValue(key)`](/api/fair/mq/ProgOptions/#GetStringValue) | [`GetPropertyAsString(key)`](/api/fair/mq/ProgOptions/#GetPropertyAsString), or `GetPropertyAsString(key, {})` if the key can be missing | `ProgOptions.h` |
| [`ProgOptions::SetValue(key, value)`](/api/fair/mq/ProgOptions/#SetValue) | [`SetProperty(key, value)`](/api/fair/mq/ProgOptions/#SetProperty) | `ProgOptions.h` |
| [`Socket::Close()`](/api/fair/mq/Socket/#Close) | Destroy the socket. Its destructor closes it. | `Socket.h` |
| [`shmem::Socket::GetConstant()`](/api/fair/mq/shmem/Socket/#GetConstant) and `zmq::Socket::GetConstant()` | `fair::mq::zmq::getConstant()` of `<fairmq/zeromq/Common.h>` | `shmem/Socket.h`, `zeromq/Socket.h` |

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();