CatapultServer  v0.5.0.1 (Elephant)
PluginModule.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include <memory>
23 #include <string>
24 
25 namespace catapult { namespace plugins {
26 
28  class PluginModule {
29  public:
31  PluginModule() = default;
32 
34  PluginModule(const std::string& directory, const std::string& name);
35 
36  public:
38  bool isLoaded() const {
39  return !!m_pModule;
40  }
41 
43  template<typename TFunc>
44  TFunc symbol(const char* symbolName) const {
45  return reinterpret_cast<TFunc>(symbolVoid(symbolName));
46  }
47 
48  private:
49  void* symbolVoid(const char* symbolName) const;
50 
51  public:
53  void release();
54 
55  private:
56  std::shared_ptr<void> m_pModule; // the system module
57  };
58 }}
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
exceptions.h
catapult::plugins::PluginModule::m_pModule
std::shared_ptr< void > m_pModule
Definition: PluginModule.h:56
Parser.debug
def debug(*args)
Definition: Parser.py:46
catapult::plugins::PluginModule::isLoaded
bool isLoaded() const
Returns true if this module wraps a loaded system module.
Definition: PluginModule.h:38
catapult::plugins::PluginModule
A plugin module.
Definition: PluginModule.h:28
PluginModule.h
CATAPULT_THROW_RUNTIME_ERROR_1
#define CATAPULT_THROW_RUNTIME_ERROR_1(MESSAGE, PARAM1)
Macro used to throw a catapult runtime error with a single parameter.
Definition: exceptions.h:171
catapult::plugins::PluginModule::symbol
TFunc symbol(const char *symbolName) const
Gets a symbol of the specified type named symbolName.
Definition: PluginModule.h:44
forwardsValidation.info
def info(*args)
Definition: forwardsValidation.py:12
catapult::plugins::PluginModule::PluginModule
PluginModule()=default
Creates an unloaded module.
CATAPULT_THROW_INVALID_ARGUMENT_1
#define CATAPULT_THROW_INVALID_ARGUMENT_1(MESSAGE, PARAM1)
Macro used to throw a catapult invalid argument with a single parameter.
Definition: exceptions.h:183
CATAPULT_THROW_RUNTIME_ERROR
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)
Macro used to throw a catapult runtime error.
Definition: exceptions.h:167
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::plugins::PluginModule::symbolVoid
void * symbolVoid(const char *symbolName) const
Definition: PluginModule.cpp:95
catapult::plugins::PluginModule::release
void release()
Releases the module.
Definition: PluginModule.cpp:106