Skip to content

Commit

Permalink
Fixing linux CI build
Browse files Browse the repository at this point in the history
  • Loading branch information
jholloc committed Dec 5, 2023
1 parent 1930950 commit e5f4b78
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 34 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
git
libboost-dev
libboost-program-options-dev
libboost-filesystem
libssl-dev
cmake
build-essential
Expand Down
36 changes: 18 additions & 18 deletions source/plugins/uda_plugin_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
Expand All @@ -50,37 +50,37 @@ 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;
}
return 0;
}

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());
Expand All @@ -95,27 +95,27 @@ 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) {
return setReturnDataString(plugin_interface->data_block, __DATE__, "Plugin build date");
}

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) {
Expand Down
32 changes: 16 additions & 16 deletions source/plugins/uda_plugin_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<std::string, plugin_member_type> m_method_map;
std::unordered_map<std::string, plugin_function_type> m_function_map;
bool init_;
std::string name_;
int version_;
int interface_version_;
std::string default_method_;
std::string help_file_;
std::unordered_map<std::string, plugin_member_type> method_map_;
std::unordered_map<std::string, plugin_function_type> function_map_;
};

#endif //UDA_UDA_PLUGIN_H

0 comments on commit e5f4b78

Please sign in to comment.