PerformProbe: remove forward declaration
This was unnecessary and generally considered bad
practice. We can remove it by moving the code to the
header.
Tested: No functional change, code compiles
Change-Id: I1059a8fbd5ce03dfa0f4512b89eb3bb7a57f529c
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/include/EntityManager.hpp b/include/EntityManager.hpp
index ae12014..524fa5d 100644
--- a/include/EntityManager.hpp
+++ b/include/EntityManager.hpp
@@ -30,6 +30,9 @@
std::string,
std::vector<boost::container::flat_map<std::string, BasicVariantType>>>;
+using FoundDeviceT =
+ std::vector<boost::container::flat_map<std::string, BasicVariantType>>;
+
struct PerformScan : std::enable_shared_from_this<PerformScan>
{
@@ -49,6 +52,19 @@
std::vector<std::string> passedProbes;
};
+// this class finds the needed dbus fields and on destruction runs the probe
+struct PerformProbe : std::enable_shared_from_this<PerformProbe>
+{
+ PerformProbe(const std::vector<std::string>& probeCommand,
+ std::shared_ptr<PerformScan>& scanPtr,
+ std::function<void(FoundDeviceT&)>&& callback);
+ virtual ~PerformProbe();
+
+ std::vector<std::string> _probeCommand;
+ std::shared_ptr<PerformScan> scan;
+ std::function<void(FoundDeviceT&)> _callback;
+};
+
inline void logDeviceAdded(const nlohmann::json& record)
{
diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp
index 3c9d39d..53a34bc 100644
--- a/src/EntityManager.cpp
+++ b/src/EntityManager.cpp
@@ -55,8 +55,6 @@
}
};
-struct PerformProbe;
-
// underscore T for collison with dbus c api
enum class probe_type_codes
{
@@ -91,9 +89,6 @@
std::string,
boost::container::flat_map<std::string, BasicVariantType>>>;
-using FoundDeviceT =
- std::vector<boost::container::flat_map<std::string, BasicVariantType>>;
-
// store reference to all interfaces so we can destroy them later
boost::container::flat_map<
std::string, std::vector<std::shared_ptr<sdbusplus::asio::dbus_interface>>>
@@ -455,29 +450,22 @@
}
return ret;
}
-// this class finds the needed dbus fields and on destruction runs the probe
-struct PerformProbe : std::enable_shared_from_this<PerformProbe>
-{
- PerformProbe(const std::vector<std::string>& probeCommand,
- std::shared_ptr<PerformScan>& scanPtr,
- std::function<void(FoundDeviceT&)>&& callback) :
- _probeCommand(probeCommand),
- scan(scanPtr), _callback(std::move(callback))
+PerformProbe::PerformProbe(const std::vector<std::string>& probeCommand,
+ std::shared_ptr<PerformScan>& scanPtr,
+ std::function<void(FoundDeviceT&)>&& callback) :
+ _probeCommand(probeCommand),
+ scan(scanPtr), _callback(std::move(callback))
+{
+}
+PerformProbe::~PerformProbe()
+{
+ FoundDeviceT foundDevs;
+ if (probe(_probeCommand, scan, foundDevs))
{
+ _callback(foundDevs);
}
- ~PerformProbe()
- {
- FoundDeviceT foundDevs;
- if (probe(_probeCommand, scan, foundDevs))
- {
- _callback(foundDevs);
- }
- }
- std::vector<std::string> _probeCommand;
- std::shared_ptr<PerformScan> scan;
- std::function<void(FoundDeviceT&)> _callback;
-};
+}
// writes output files to persist data
bool writeJsonFiles(const nlohmann::json& systemConfiguration)