diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index fbc676de..b7f00cb9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -51,6 +51,7 @@ jobs: git libboost-dev libboost-program-options-dev + libboost-filesystem libssl-dev cmake build-essential diff --git a/source/plugins/uda_plugin_base.cpp b/source/plugins/uda_plugin_base.cpp index 61c63344..47d0dee0 100644 --- a/source/plugins/uda_plugin_base.cpp +++ b/source/plugins/uda_plugin_base.cpp @@ -9,11 +9,11 @@ int UDAPluginBase::call(IDAM_PLUGIN_INTERFACE* plugin_interface) { try { - if (plugin_interface->interfaceVersion > m_interface_version) { + if (plugin_interface->interfaceVersion > interface_version_) { RAISE_PLUGIN_ERROR("Plugin Interface Version Unknown to this plugin: Unable to execute the request!"); } - plugin_interface->pluginVersion = m_version; + plugin_interface->pluginVersion = version_; do_reset(); do_init(plugin_interface); @@ -24,10 +24,10 @@ int UDAPluginBase::call(IDAM_PLUGIN_INTERFACE* plugin_interface) { std::string function = get_function(plugin_interface); - if (m_function_map.find(function) != m_function_map.end()) { - return m_function_map.at(function)(plugin_interface); - } else if (m_method_map.find(function) != m_method_map.end()) { - auto fn = m_method_map.at(function); + if (function_map_.find(function) != function_map_.end()) { + return function_map_.at(function)(plugin_interface); + } else if (method_map_.find(function) != method_map_.end()) { + auto fn = method_map_.at(function); return (this->*fn)(plugin_interface); } else { UDA_LOG(UDA_LOG_ERROR, "Unknown function requested %s\n", function.c_str()); @@ -50,10 +50,10 @@ std::string UDAPluginBase::get_function(IDAM_PLUGIN_INTERFACE* plugin_interface) int UDAPluginBase::do_init(IDAM_PLUGIN_INTERFACE* plugin_interface) { std::string function = get_function(plugin_interface); - if (!m_init || (function == "init" || function == "initialise")) { + if (!init_ || (function == "init" || function == "initialise")) { int rc = init(plugin_interface); if (rc == 0) { - m_init = true; + init_ = true; } return rc; } @@ -61,26 +61,26 @@ int UDAPluginBase::do_init(IDAM_PLUGIN_INTERFACE* plugin_interface) { } int UDAPluginBase::do_reset() { - if (!m_init) { + if (!init_) { // Not previously initialised: Nothing to do! return 0; } reset(); - m_init = false; + init_ = false; return 0; } int UDAPluginBase::help(IDAM_PLUGIN_INTERFACE *plugin_interface) { - std::string desc = m_name + ": help = description of this plugin"; + std::string desc = name_ + ": help = description of this plugin"; - if (m_help_file.empty()) { + if (help_file_.empty()) { const char* help = "No help available"; return setReturnDataString(plugin_interface->data_block, help, desc.c_str()); } - auto path = boost::filesystem::path(m_help_file); + auto path = boost::filesystem::path(help_file_); if (!boost::filesystem::exists(path)) { auto help = (boost::format("help file %1% does not exist") % path).str(); return setReturnDataString(plugin_interface->data_block, help.c_str(), desc.c_str()); @@ -95,7 +95,7 @@ int UDAPluginBase::help(IDAM_PLUGIN_INTERFACE *plugin_interface) { } int UDAPluginBase::version(IDAM_PLUGIN_INTERFACE *plugin_interface) { - return setReturnDataIntScalar(plugin_interface->data_block, m_version, "Plugin version number"); + return setReturnDataIntScalar(plugin_interface->data_block, version_, "Plugin version number"); } int UDAPluginBase::build_date(IDAM_PLUGIN_INTERFACE *plugin_interface) { @@ -103,19 +103,19 @@ int UDAPluginBase::build_date(IDAM_PLUGIN_INTERFACE *plugin_interface) { } int UDAPluginBase::default_method(IDAM_PLUGIN_INTERFACE *plugin_interface) { - return setReturnDataString(plugin_interface->data_block, m_default_method.c_str(), "Plugin default method"); + return setReturnDataString(plugin_interface->data_block, default_method_.c_str(), "Plugin default method"); } int UDAPluginBase::max_interface_version(IDAM_PLUGIN_INTERFACE *plugin_interface) { - return setReturnDataIntScalar(plugin_interface->data_block, m_interface_version, "Maximum Interface Version"); + return setReturnDataIntScalar(plugin_interface->data_block, interface_version_, "Maximum Interface Version"); } void UDAPluginBase::register_method(const std::string &name, plugin_member_type plugin_method) { - m_method_map[name] = plugin_method; + method_map_[name] = plugin_method; } void UDAPluginBase::register_function(const std::string &name, plugin_function_type plugin_function) { - m_function_map[name] = plugin_function; + function_map_[name] = plugin_function; } void UDAPluginBase::debug(const std::string& message) { diff --git a/source/plugins/uda_plugin_base.hpp b/source/plugins/uda_plugin_base.hpp index 3e0892cb..4039a6e8 100644 --- a/source/plugins/uda_plugin_base.hpp +++ b/source/plugins/uda_plugin_base.hpp @@ -23,14 +23,14 @@ class UDAPluginBase { protected: UDAPluginBase(std::string name, int version, std::string default_method, std::string help_file) - : m_init{ false } - , m_name{ std::move(name) } - , m_version{ version } - , m_interface_version{ 1 } - , m_default_method{ std::move(default_method) } - , m_help_file{ std::move(help_file) } - , m_method_map{} - , m_function_map{} + : init_{false } + , name_{std::move(name) } + , version_{version } + , interface_version_{1 } + , default_method_{std::move(default_method) } + , help_file_{std::move(help_file) } + , method_map_{} + , function_map_{} { register_method("help", &UDAPluginBase::help); register_method("version", &UDAPluginBase::version); @@ -75,14 +75,14 @@ class UDAPluginBase { int do_reset(); static std::string get_function(IDAM_PLUGIN_INTERFACE* plugin_interface); - bool m_init; - std::string m_name; - int m_version; - int m_interface_version; - std::string m_default_method; - std::string m_help_file; - std::unordered_map m_method_map; - std::unordered_map m_function_map; + bool init_; + std::string name_; + int version_; + int interface_version_; + std::string default_method_; + std::string help_file_; + std::unordered_map method_map_; + std::unordered_map function_map_; }; #endif //UDA_UDA_PLUGIN_H