Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::plugin::Module Class Reference

Plugin module object. More...

#include <Module.h>

Public Types

using Ptr = std::unique_ptr<Module>
 
using LibraryObject = sese::system::LibraryObject
 

Public Member Functions

const char * getName () noexcept
 Get the module name.
 
const char * getVersion () noexcept
 Get the module version.
 
const char * getDescription () noexcept
 Get the module description.
 
BaseClass::Ptr createClass (const std::string &id) noexcept
 Construct an object using the class factory of the module.
 
template<typename TYPE >
std::shared_ptr< TYPE > createClassAs (const std::string &name)
 Construct an object using the class factory of the module and cast to a specified type.
 
const ClassFactory::RegisterInfoMapTypegetRegisterClassInfo () noexcept
 Get the type information of registered classes in the module.
 

Static Public Member Functions

static Module::Ptr open (const std::string &path) noexcept
 Attempt to load a module from a dynamic library.
 
static Result< Ptr, ErrorCodeopenEx (const std::string &path) noexcept
 
static Module::Ptr openWithPath (const system::Path &path) noexcept
 Attempt to load a module from a dynamic library.
 

Private Member Functions

 Module ()=default
 

Private Attributes

LibraryObject::Ptr object = nullptr
 
ModuleInfoinfo = nullptr
 
ClassFactoryfactory = nullptr
 

Detailed Description

Plugin module object.

Member Typedef Documentation

◆ LibraryObject

◆ Ptr

using sese::plugin::Module::Ptr = std::unique_ptr<Module>

Constructor & Destructor Documentation

◆ Module()

sese::plugin::Module::Module ( )
privatedefault

Member Function Documentation

◆ createClass()

sese::plugin::BaseClass::Ptr sese::plugin::Module::createClass ( const std::string & id)
noexcept

Construct an object using the class factory of the module.

Parameters
idObject identifier
Return values
nullptrInstantiation error

Referenced by createClassAs().

◆ createClassAs()

template<typename TYPE >
std::shared_ptr< TYPE > sese::plugin::Module::createClassAs ( const std::string & name)
inline

Construct an object using the class factory of the module and cast to a specified type.

Template Parameters
TYPESpecified type
Parameters
nameObject identifier
Return values
nullptrInstantiation error or type error

References createClass().

◆ getDescription()

const char * sese::plugin::Module::getDescription ( )
noexcept

Get the module description.

Returns
Module description

◆ getName()

const char * sese::plugin::Module::getName ( )
noexcept

Get the module name.

Returns
Module name

References info, and sese::plugin::ModuleInfo::moduleName.

◆ getRegisterClassInfo()

const sese::plugin::ClassFactory::RegisterInfoMapType & sese::plugin::Module::getRegisterClassInfo ( )
noexcept

Get the type information of registered classes in the module.

Returns
Type information

◆ getVersion()

const char * sese::plugin::Module::getVersion ( )
noexcept

Get the module version.

Returns
Module version

◆ open()

sese::plugin::Module::Ptr sese::plugin::Module::open ( const std::string & path)
staticnoexcept

Attempt to load a module from a dynamic library.

Parameters
pathDynamic library path
Return values
nullptrLoading error

References GET_CLASS_FACTORY_FUNC_NAME, GET_MODULE_INFO_FUNC_NAME, MAKE_UNIQUE_PRIVATE, and STR2.

Referenced by openWithPath().

◆ openEx()

sese::Result< sese::plugin::Module::Ptr, sese::ErrorCode > sese::plugin::Module::openEx ( const std::string & path)
staticnoexcept

◆ openWithPath()

sese::plugin::Module::Ptr sese::plugin::Module::openWithPath ( const system::Path & path)
staticnoexcept

Attempt to load a module from a dynamic library.

Parameters
pathDynamic library path
Return values
nullptrLoading error

References open().

Member Data Documentation

◆ factory

ClassFactory* sese::plugin::Module::factory = nullptr
private

◆ info

ModuleInfo* sese::plugin::Module::info = nullptr
private

Referenced by getName().

◆ object

LibraryObject::Ptr sese::plugin::Module::object = nullptr
private

The documentation for this class was generated from the following files: