common: make Software::objectPath const
Software::objectPath is initialized in the constructor and should not be
modified later on.
Can also be protected instead of public.
Tested: Inspection only.
Change-Id: I9404fc46b6d039d7a7e96ebb232e34ee0aa978e8
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/common/include/software.hpp b/common/include/software.hpp
index 46129da..28b1cff 100644
--- a/common/include/software.hpp
+++ b/common/include/software.hpp
@@ -64,9 +64,6 @@
// yet running).
sdbusplus::async::task<> createInventoryAssociations(bool isRunning);
- // object path of this software
- sdbusplus::message::object_path objectPath;
-
// The device we are associated to, meaning this software is either running
// on the device, or could potentially run on that device (update).
device::Device& parentDevice;
@@ -85,6 +82,9 @@
static long int getRandomId();
protected:
+ // object path of this software
+ const sdbusplus::message::object_path objectPath;
+
// @returns the version purpose
// @returns std::nullopt in case the version has not been set
std::optional<SoftwareVersion::VersionPurpose> getPurpose();
diff --git a/common/src/software.cpp b/common/src/software.cpp
index 1554b05..a82c711 100644
--- a/common/src/software.cpp
+++ b/common/src/software.cpp
@@ -28,7 +28,7 @@
SoftwareActivation(ctx, (baseObjPathSoftware + swid).c_str(),
Activation::properties_t{Activations::NotReady,
RequestedActivations::None}),
- objectPath(baseObjPathSoftware + swid), parentDevice(parent), swid(swid),
+ parentDevice(parent), swid(swid), objectPath(baseObjPathSoftware + swid),
ctx(ctx)
{
std::string objPath = baseObjPathSoftware + swid;