Add nameLeafProperty function

Add nameLeafProperty() to provide the function to name an object from the
object's leaf and the property name.
E.g. Below config creates the Fan0_Present on DBus:

 entityID: 29
 entityInstance: 13
 interfaces:
   xyz.openbmc_project.Inventory.Item:
     Present:
       Offsets:
         0:
           assert: true
           deassert: false
           type: bool
 mutability: Mutability::Write|Mutability::Read
 path: /xyz/openbmc_project/inventory/Fan0
 readingType: assertion
 sensorNamePattern: nameLeafProperty
 sensorReadingType: 111
 sensorType: 4
 serviceInterface: org.freedesktop.DBus.Properties

Signed-off-by: Lotus Xu <xuxiaohan@bytedance.com>
Change-Id: I58190c6041530e43f03a70c852f90ef51ebe632e
diff --git a/sensordatahandler.hpp b/sensordatahandler.hpp
index 3ec1a4d..e4eed41 100644
--- a/sensordatahandler.hpp
+++ b/sensordatahandler.hpp
@@ -101,6 +101,21 @@
 }
 
 /** @brief Populate sensor name from the D-Bus object associated with the
+ *         sensor and the property.
+ *         If the object path is /xyz/openbmc_project/inventory/Fan0 and
+ *         the property is Present, the leaf Fan0 and the Property is
+ *         joined to Fan0_Present as the sensor name.
+ *
+ *  @param[in] sensorInfo - Dbus info related to sensor.
+ *
+ *  @return On success return the sensor name for the sensor.
+ */
+inline SensorName nameLeafProperty(const Info& sensorInfo)
+{
+    return nameLeaf(sensorInfo) + "_" + nameProperty(sensorInfo);
+}
+
+/** @brief Populate sensor name from the D-Bus object associated with the
  *         sensor. If the object path is /system/chassis/motherboard/cpu0/core0
  *         then the sensor name is cpu0_core0. The leaf and the parent is put
  *         together to get the sensor name.