ArkScript
A small, fast, functional and scripting language for video games
Ark::internal::SharedLibrary Class Reference

Handling a shared library as an ArkScript plugin. More...

#include <Plugin.hpp>

+ Collaboration diagram for Ark::internal::SharedLibrary:

Public Member Functions

 SharedLibrary ()
 Construct a new Shared Library object. More...
 
 SharedLibrary (const SharedLibrary &)=delete
 Disable copy semantics as this contains a pointer. More...
 
SharedLibraryoperator= (const SharedLibrary &)=delete
 
 SharedLibrary (const std::string &path)
 Construct a new Shared Library object. More...
 
 ~SharedLibrary ()
 Destroy the Shared Library object. More...
 
void load (const std::string &path)
 Load a shared library. More...
 
void unload ()
 Unload the shared library. More...
 
const std::string & path () const
 
template<typename T >
get (const std::string &procname)
 Return a function from the shared library. More...
 

Private Attributes

std::string m_path
 
bool m_loaded
 

Detailed Description

Handling a shared library as an ArkScript plugin.

Definition at line 37 of file Plugin.hpp.

Constructor & Destructor Documentation

◆ SharedLibrary() [1/3]

Ark::internal::SharedLibrary::SharedLibrary ( )

Construct a new Shared Library object.

Definition at line 9 of file Plugin.cpp.

◆ SharedLibrary() [2/3]

Ark::internal::SharedLibrary::SharedLibrary ( const SharedLibrary )
delete

Disable copy semantics as this contains a pointer.

◆ SharedLibrary() [3/3]

Ark::internal::SharedLibrary::SharedLibrary ( const std::string &  path)
explicit

Construct a new Shared Library object.

Parameters
pathpath to the shared library

Definition at line 15 of file Plugin.cpp.

References load(), and m_path.

◆ ~SharedLibrary()

Ark::internal::SharedLibrary::~SharedLibrary ( )

Destroy the Shared Library object.

Definition at line 23 of file Plugin.cpp.

References unload().

Member Function Documentation

◆ get()

template<typename T >
T Ark::internal::SharedLibrary::get ( const std::string &  procname)
inline

Return a function from the shared library.

Template Parameters
Tthe type of the function to retrieve
Parameters
procnamethe name of the function to retrieve
Returns
T the function from the shared library, if it was found

Definition at line 89 of file Plugin.hpp.

◆ load()

void Ark::internal::SharedLibrary::load ( const std::string &  path)

Load a shared library.

Parameters
pathpath to the shared library

Definition at line 28 of file Plugin.cpp.

References m_loaded, m_path, path(), and unload().

Referenced by SharedLibrary().

◆ operator=()

SharedLibrary& Ark::internal::SharedLibrary::operator= ( const SharedLibrary )
delete

◆ path()

const std::string& Ark::internal::SharedLibrary::path ( ) const
inline

Definition at line 79 of file Plugin.hpp.

References m_path.

Referenced by load().

◆ unload()

void Ark::internal::SharedLibrary::unload ( )

Unload the shared library.

Definition at line 51 of file Plugin.cpp.

References m_loaded.

Referenced by load(), and ~SharedLibrary().

Member Data Documentation

◆ m_loaded

bool Ark::internal::SharedLibrary::m_loaded
private

Definition at line 116 of file Plugin.hpp.

Referenced by load(), and unload().

◆ m_path

std::string Ark::internal::SharedLibrary::m_path
private

Definition at line 115 of file Plugin.hpp.

Referenced by load(), path(), and SharedLibrary().


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