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 f3142eb commit 9764c4b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
9 changes: 7 additions & 2 deletions source/plugins/uda_plugin_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@ int UDAPluginBase::call(IDAM_PLUGIN_INTERFACE* plugin_interface) {

std::string function = get_function(plugin_interface);

int rc;

if (function_map_.find(function) != function_map_.end()) {
return function_map_.at(function)(plugin_interface);
rc = 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);
rc = (this->*fn)(plugin_interface);
} else {
UDA_LOG(UDA_LOG_ERROR, "Unknown function requested %s\n", function.c_str());
addIdamError(UDA_CODE_ERROR_TYPE, "UDAPluginBase::call", 999, "Unknown function requested");
concatUdaError(&plugin_interface->error_stack);
return 999;
}

concatUdaError(&plugin_interface->error_stack);
return rc;
} catch (std::exception& ex) {
UDA_LOG(UDA_LOG_ERROR, "Exception: %s\n", ex.what());
addIdamError(UDA_CODE_ERROR_TYPE, "UDAPluginBase::call", 999, ex.what());
Expand Down
22 changes: 11 additions & 11 deletions source/plugins/uda_plugin_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,6 @@ class UDAPluginBase {
template <typename T>
T required_arg(IDAM_PLUGIN_INTERFACE* plugin_interface, const std::string& name);

template <>
std::string required_arg(IDAM_PLUGIN_INTERFACE* plugin_interface, const std::string& name)
{
const char* value;
if (!findStringValue(&plugin_interface->request_data->nameValueList, &value, name.c_str())) {
auto message = (boost::format("Required argument '%1%' not given") % name).str();
error(message);
}
return value;
}

// Default method implementations
int help(IDAM_PLUGIN_INTERFACE* plugin_interface);
int version(IDAM_PLUGIN_INTERFACE* plugin_interface);
Expand All @@ -85,4 +74,15 @@ class UDAPluginBase {
std::unordered_map<std::string, plugin_function_type> function_map_;
};

template <>
std::string UDAPluginBase::required_arg(IDAM_PLUGIN_INTERFACE* plugin_interface, const std::string& name)
{
const char* value;
if (!findStringValue(&plugin_interface->request_data->nameValueList, &value, name.c_str())) {
auto message = (boost::format("Required argument '%1%' not given") % name).str();
error(message);
}
return value;
}

#endif //UDA_UDA_PLUGIN_H

0 comments on commit 9764c4b

Please sign in to comment.