From 8ee2518fb1fdd34e048daf47aca64468e9d62e9e Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 9 Nov 2026 22:58:27 +0000 Subject: [PATCH] feat(options): deprecate the old ProgOptions accessors - Mark GetValue(), 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 --- docs/src/content/docs/guides/migrate-names.mdx | 3 +++ fairmq/ProgOptions.h | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/src/content/docs/guides/migrate-names.mdx b/docs/src/content/docs/guides/migrate-names.mdx index 8d7ea5ed..118385a3 100644 --- a/docs/src/content/docs/guides/migrate-names.mdx +++ b/docs/src/content/docs/guides/migrate-names.mdx @@ -176,6 +176,9 @@ The compiler warns for these members too. The column "Declared in" names the hea | [`Device::Deserialize(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(key)`](/api/fair/mq/ProgOptions/#GetValue) | [`GetProperty(key)`](/api/fair/mq/ProgOptions/#GetProperty), or `GetProperty(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 `` | `shmem/Socket.h`, `zeromq/Socket.h` | diff --git a/fairmq/ProgOptions.h b/fairmq/ProgOptions.h index f6eea35d..44fc88d0 100644 --- a/fairmq/ProgOptions.h +++ b/fairmq/ProgOptions.h @@ -228,7 +228,8 @@ class ProgOptions /// @param key /// @return config property template - T GetValue(const std::string& key) const /* TODO: deprecate this */ + [[deprecated("Use GetProperty(key, {})")]] + T GetValue(const std::string& key) const { std::lock_guard lock(fMtx); if (fVarMap.count(key)) { @@ -239,11 +240,13 @@ class ProgOptions } } template - 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();