PLaSK library
Loading...
Searching...
No Matches
plask::DynamicLibraries Class Reference

Represent set of dynamically loaded library. More...

#include <plask/utils/dynlib/manager.hpp>

Public Types

typedef DynamicLibrarySet::const_iterator iterator
 Type of iterator over loaded libraries.
 
typedef DynamicLibrarySet::const_iterator const_iterator
 Type of iterator over loaded libraries.
 

Public Member Functions

 DynamicLibraries ()=default
 
 DynamicLibraries (const DynamicLibraries &)=delete
 
DynamicLibrariesoperator= (const DynamicLibraries &)=delete
 
 DynamicLibraries (DynamicLibraries &&)=default
 
DynamicLibrariesoperator= (DynamicLibraries &&)=default
 
const_iterator begin () const
 Allow to iterate over opened library included in this set.
 
const_iterator end () const
 Allow to iterate over opened library included in this set.
 
const DynamicLibraryload (const std::string &file_name, unsigned flags=0)
 Load dynamic library and add it to this or throw exception if it's not possible.
 
void close (const DynamicLibrary &to_close)
 Close given library if it is in this set.
 
void closeAll ()
 Close all holded libraries.
 

Static Public Member Functions

static DynamicLibrariesdefaultSet ()
 Return default set of dynamic libraries (this set is deleted, so all libraries in it are closed, on program exit).
 
static const DynamicLibrarydefaultLoad (const std::string &file_name, unsigned flags=0)
 Load dynamic library and add it to default set or throw exception if it's not possible.
 
static void defaultClose (const DynamicLibrary &to_close)
 Close given library if it is in default set.
 
static void defaultCloseAll ()
 Close all libraries holded in default set.
 

Detailed Description

Represent set of dynamically loaded library.

Close held libraries in destructor.

It also contains one static, singleton instance available by defaultSet(). This set is especially useful to load libraries which should be closed on program exit (see defaultLoad method).

Definition at line 30 of file manager.hpp.

Member Typedef Documentation

◆ const_iterator

typedef DynamicLibrarySet::const_iterator plask::DynamicLibraries::const_iterator

Type of iterator over loaded libraries.

Definition at line 44 of file manager.hpp.

◆ iterator

typedef DynamicLibrarySet::const_iterator plask::DynamicLibraries::iterator

Type of iterator over loaded libraries.

Definition at line 41 of file manager.hpp.

Constructor & Destructor Documentation

◆ DynamicLibraries() [1/3]

plask::DynamicLibraries::DynamicLibraries ( )
default

◆ DynamicLibraries() [2/3]

plask::DynamicLibraries::DynamicLibraries ( const DynamicLibraries )
delete

◆ DynamicLibraries() [3/3]

plask::DynamicLibraries::DynamicLibraries ( DynamicLibraries &&  )
default

Member Function Documentation

◆ begin()

const_iterator plask::DynamicLibraries::begin ( ) const
inline

Allow to iterate over opened library included in this set.

Returns
begin iterator, which point to first library

Definition at line 56 of file manager.hpp.

◆ close()

void plask::DynamicLibraries::close ( const DynamicLibrary to_close)

Close given library if it is in this set.

Parameters
to_closelibrary to close

Definition at line 26 of file manager.cpp.

◆ closeAll()

void plask::DynamicLibraries::closeAll ( )

Close all holded libraries.

Definition at line 30 of file manager.cpp.

◆ defaultClose()

static void plask::DynamicLibraries::defaultClose ( const DynamicLibrary to_close)
inlinestatic

Close given library if it is in default set.

Parameters
to_closelibrary to close

Definition at line 103 of file manager.hpp.

◆ defaultCloseAll()

static void plask::DynamicLibraries::defaultCloseAll ( )
inlinestatic

Close all libraries holded in default set.

Definition at line 106 of file manager.hpp.

◆ defaultLoad()

static const DynamicLibrary & plask::DynamicLibraries::defaultLoad ( const std::string &  file_name,
unsigned  flags = 0 
)
inlinestatic

Load dynamic library and add it to default set or throw exception if it's not possible.

Loaded library will be closed on program exit or can also be explicitly closed by defaultClose(const DynamicLibrary& to_close) method.

Parameters
file_namename of file with library to load
flagsflags which describe configuration of open/close process, one or more (or-ed) flags from DynamicLibrary::Flags set
Returns
loaded library

Definition at line 97 of file manager.hpp.

◆ defaultSet()

DynamicLibraries & plask::DynamicLibraries::defaultSet ( )
static

Return default set of dynamic libraries (this set is deleted, so all libraries in it are closed, on program exit).

Returns
default set of dynamic libraries

Definition at line 34 of file manager.cpp.

◆ end()

const_iterator plask::DynamicLibraries::end ( ) const
inline

Allow to iterate over opened library included in this set.

Returns
end iterator, which point just over last library

Definition at line 62 of file manager.hpp.

◆ load()

const DynamicLibrary & plask::DynamicLibraries::load ( const std::string &  file_name,
unsigned  flags = 0 
)

Load dynamic library and add it to this or throw exception if it's not possible.

Loaded library will be closed by destructor of this or can also be explicitly closed by close(const DynamicLibrary& to_close) method.

Parameters
file_namename of file with library to load
flagsflags which describe configuration of open/close process, one or more (or-ed) flags from DynamicLibrary::Flags set
Returns
loaded library

Definition at line 22 of file manager.cpp.

◆ operator=() [1/2]

DynamicLibraries & plask::DynamicLibraries::operator= ( const DynamicLibraries )
delete

◆ operator=() [2/2]

DynamicLibraries & plask::DynamicLibraries::operator= ( DynamicLibraries &&  )
default

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