return true;
}
-bool PluginsLauncher::ExecPlugin(DynamicLibHandle& dlh, ProcessType process,
+bool PluginsLauncher::ExecPlugin(const DynamicLibHandle& dlh,
+ ProcessType process,
ActionType action, const char* pkgId,
int* result) {
return ExecPluginImpl(dlh, process, action, result, pkgId);
}
-bool PluginsLauncher::ExecPlugin(DynamicLibHandle& dlh, ProcessType process,
+bool PluginsLauncher::ExecPlugin(const DynamicLibHandle& dlh,
+ ProcessType process,
ActionType action, xmlDocPtr docPtr,
const char* pkgId, int* result) {
return ExecPluginImpl(dlh, process, action, result, docPtr, pkgId);
bool FunctionName(ProcessType process, ActionType action,
std::string* result);
- bool ExecPlugin(DynamicLibHandle& dlh, ProcessType process, ActionType action,
- const char* pkgId, int* result);
+ bool ExecPlugin(const DynamicLibHandle& dlh, ProcessType process,
+ ActionType action, const char* pkgId, int* result);
- bool ExecPlugin(DynamicLibHandle& dlh, ProcessType process, ActionType action,
- xmlDocPtr docPtr, const char* pkgId, int* result);
+ bool ExecPlugin(const DynamicLibHandle& dlh, ProcessType process,
+ ActionType action, xmlDocPtr docPtr,
+ const char* pkgId, int* result);
template <typename... Args>
- bool ExecPluginImpl(DynamicLibHandle& dlh, ProcessType process,
+ bool ExecPluginImpl(const DynamicLibHandle& dlh, ProcessType process,
ActionType action, int* result, Args&&... args) {
std::string name;
if (!FunctionName(process, action, &name)) {
return true;
}
-void* DynamicLibHandle::GetSymbol(const std::string& name) {
+void* DynamicLibHandle::GetSymbol(const std::string& name) const {
return dlsym(lib_handle_, name.c_str());
}
bool Load(const boost::filesystem::path& path, int flags);
template <typename Ret, typename... Args>
- bool Exec(const std::string& name, Ret* result, Args... args) {
+ bool Exec(const std::string& name, Ret* result, Args... args) const {
using PluginFunctionPtr = Ret (*)(Args...);
PluginFunctionPtr function =
reinterpret_cast<PluginFunctionPtr>(GetSymbol(name));
SCOPE_LOG_TAG(DynamicLibHandle)
private:
- void* GetSymbol(const std::string& name);
+ void* GetSymbol(const std::string& name) const;
void* lib_handle_;
};