A table of dynamically loaded libraries. More...
#include <dlLibraryTable.H>
Public Types | |
| typedef void(* | loaderType) (bool) |
| Global loader/unloader function type (C-linkage). | |
Public Member Functions | |
| ClassName ("dlLibraryTable") | |
| Declare name of the class and its debug switch. | |
| dlLibraryTable ()=default | |
| Default construct. | |
| dlLibraryTable (const dlLibraryTable &)=delete | |
| No copy construct. | |
| dlLibraryTable (dlLibraryTable &&)=default | |
| Move construct. | |
| void | operator= (const dlLibraryTable &)=delete |
| No copy assignment. | |
| dlLibraryTable & | operator= (dlLibraryTable &&)=default |
| Move assignment. | |
| dlLibraryTable (const UList< fileName > &libNames, bool verbose=true) | |
| Open specified libraries, warn by default if problems occur. | |
| dlLibraryTable (std::initializer_list< fileName > libNames, bool verbose=true) | |
| Open specified libraries, warn by default if problems occur. | |
| dlLibraryTable (const word &libsEntry, const dictionary &dict, bool verbose=true) | |
| Open libraries listed in 'libsEntry' entry in the dictionary, warn by default if problems occur. | |
| dlLibraryTable (const dictionary &dict, const word &libsEntry, bool verbose=true) | |
| Open libraries listed in 'libsEntry' entry in the dictionary, warn by default if problems occur. | |
| ~dlLibraryTable () | |
| Destructor. Closes all libraries loaded by the table. | |
| bool | empty () const noexcept |
| True if there are no libraries loaded by the table. | |
| label | size () const noexcept |
| The number of libraries loaded by the table. | |
| List< fileName > | loaded () const |
| Names of the libraries in use. | |
| const UList< fileName > & | names () const noexcept |
| Names of the libraries in use, or requested. | |
| const UList< void * > & | pointers () const noexcept |
| Pointers to the libraries in use. Access with caution. | |
| void | clear () |
| Clears the table, without attempting to close the libraries. | |
| bool | push_back (const fileName &libName) |
| Add to the list of names, but do not yet open. | |
| label | push_back (const UList< fileName > &libNames) |
| Add to the list of names, but do not yet open. | |
| bool | open (bool verbose=true) |
| Open named, but unopened libraries. These names will normally have been added with push_back(). | |
| void * | open (const fileName &libName, bool verbose=true) |
| Open the named library, warn by default if problems occur. | |
| bool | open (const UList< fileName > &libNames, bool verbose=true) |
| Open the named libraries, warn by default if problems occur. | |
| bool | open (std::initializer_list< fileName > libNames, bool verbose=true) |
| Open the named libraries, warn by default if problems occur. | |
| void | close (bool verbose=true) |
| Close all libraries loaded by the table and remove the closed functions from the table. | |
| bool | close (const fileName &libName, bool verbose=true) |
| Close the named library, optionally warn if problems occur. | |
| void * | findLibrary (const fileName &libName) |
| Find the handle of the named library. | |
| bool | open (const word &libsEntry, const dictionary &dict, bool verbose=true) |
| Open libraries listed in the 'libsEntry' entry in the dictionary. | |
| bool | open (const dictionary &dict, const word &libsEntry) |
| Open libraries listed in the 'libsEntry' entry in the dictionary. | |
| template<class TablePtr> | |
| bool | open (const dictionary &dict, const word &libsEntry, const TablePtr &tablePtr, bool verbose=true) |
| Open all libraries listed in the 'libsEntry' entry in the given dictionary and check the additions to the given constructor table. | |
| InfoProxy< dlLibraryTable > | info () const noexcept |
| Return info proxy, used to print library table information to a stream. | |
| bool | append (const fileName &libName) |
| Add to the list of names, but do not yet open. | |
| label | append (const UList< fileName > &libNames) |
| Add to the list of names, but do not yet open. | |
Static Public Member Functions | |
| static word | basename (const fileName &libPath) |
| Library basename without leading 'lib' or trailing '.so'. | |
| static word | fullname (word libName) |
| Library fullname, prefix with 'lib', suffix with '.so'. | |
| static dlLibraryTable & | libs () |
| Table of global libraries. | |
| static bool | loadHook (void *handle, const std::string &funcName, const bool verbose=false, const std::string &context="") |
| Low-level interface to execute global "void funcName(true)" from the library, typically for additional loading. | |
| static bool | unloadHook (void *handle, const std::string &funcName, const bool verbose=false, const std::string &context="") |
| Low-level interface to execute global "void funcName(false)" from the library, typically for unloading. | |
Static Public Attributes | |
| static int | dlcloseOnTerminate |
| Use dlclose() when clearing the dlLibraryTable. | |
A table of dynamically loaded libraries.
Definition at line 60 of file dlLibraryTable.H.
| typedef void(* loaderType) (bool) |
Global loader/unloader function type (C-linkage).
Called with true on load, false on unload.
Definition at line 128 of file dlLibraryTable.H.
|
default |
Default construct.
Referenced by dlLibraryTable(), dlLibraryTable(), dlLibraryTable(), libs(), operator=(), and operator=().

|
delete |
|
default |
Open specified libraries, warn by default if problems occur.
Ignores duplicate names.
Definition at line 191 of file dlLibraryTable.C.
References open().

|
explicit |
Open specified libraries, warn by default if problems occur.
Ignores duplicate names.
Definition at line 201 of file dlLibraryTable.C.
References open().

| dlLibraryTable | ( | const word & | libsEntry, |
| const dictionary & | dict, | ||
| bool | verbose = true ) |
Open libraries listed in 'libsEntry' entry in the dictionary, warn by default if problems occur.
Definition at line 211 of file dlLibraryTable.C.
References dict, keyType::LITERAL, and open().

| dlLibraryTable | ( | const dictionary & | dict, |
| const word & | libsEntry, | ||
| bool | verbose = true ) |
Open libraries listed in 'libsEntry' entry in the dictionary, warn by default if problems occur.
Definition at line 224 of file dlLibraryTable.C.
References dict, and dlLibraryTable().

| ~dlLibraryTable | ( | ) |
Destructor. Closes all libraries loaded by the table.
Definition at line 238 of file dlLibraryTable.C.
References close(), and dlcloseOnTerminate.

| ClassName | ( | "dlLibraryTable" | ) |
Declare name of the class and its debug switch.
|
delete |
|
default |
Move assignment.
References dict, dlLibraryTable(), loaded(), Foam::noexcept, and size().

|
static |
Library basename without leading 'lib' or trailing '.so'.
Definition at line 53 of file dlLibraryTable.C.
References string::removeStart(), and fileName::stem().
Referenced by codedBase::updateLibrary().


|
static |
Library fullname, prefix with 'lib', suffix with '.so'.
Definition at line 61 of file dlLibraryTable.C.
References word::ext(), and EXT_SO.
Referenced by dynamicCode::libPath(), and dynamicCode::libRelPath().


|
static |
Table of global libraries.
Definition at line 73 of file dlLibraryTable.C.
References dlLibraryTable().
Referenced by renumberMethod::New().


|
static |
Low-level interface to execute global "void funcName(true)" from the library, typically for additional loading.
If called, it should be the first step after opening a library.
| context | Calling context for warnings |
Definition at line 134 of file dlLibraryTable.C.
|
static |
Low-level interface to execute global "void funcName(false)" from the library, typically for unloading.
If called, it should be the last step before closing a library.
| context | Calling context for warnings |
Definition at line 146 of file dlLibraryTable.C.
|
noexcept |
True if there are no libraries loaded by the table.
Definition at line 249 of file dlLibraryTable.C.
References Foam::noexcept.
|
noexcept |
The number of libraries loaded by the table.
Definition at line 263 of file dlLibraryTable.C.
References Foam::noexcept.
Referenced by operator=().

| Foam::List< Foam::fileName > loaded | ( | ) | const |
Names of the libraries in use.
Definition at line 286 of file dlLibraryTable.C.
References forAll, and List< T >::resize().
Referenced by operator=().


Names of the libraries in use, or requested.
Definition at line 288 of file dlLibraryTable.H.
References names(), and Foam::noexcept.
Referenced by names().


|
inlinenoexcept |
Pointers to the libraries in use. Access with caution.
Definition at line 296 of file dlLibraryTable.H.
References Foam::noexcept.
| void clear | ( | ) |
Clears the table, without attempting to close the libraries.
Definition at line 279 of file dlLibraryTable.C.
| bool push_back | ( | const fileName & | libName | ) |
Add to the list of names, but do not yet open.
Ignores empty and duplicate names.
Definition at line 372 of file dlLibraryTable.C.
References string::contains().
Referenced by append(), append(), and push_back().


Add to the list of names, but do not yet open.
Ignores empty and duplicate names.
Definition at line 386 of file dlLibraryTable.C.
References push_back().

| bool open | ( | bool | verbose = true | ) |
Open named, but unopened libraries. These names will normally have been added with push_back().
Definition at line 402 of file dlLibraryTable.C.
References forAll.
Referenced by dlLibraryTable(), dlLibraryTable(), dlLibraryTable(), GAMGAgglomeration::New(), renumberMethod::New(), open(), open(), open(), open(), and open().

| void * open | ( | const fileName & | libName, |
| bool | verbose = true ) |
Open the named library, warn by default if problems occur.
An empty name is a silent no-op and always returns nullptr.
Definition at line 434 of file dlLibraryTable.C.
Open the named libraries, warn by default if problems occur.
Ignores duplicate names.
Definition at line 453 of file dlLibraryTable.C.
References open(), and UList< T >::size().

| bool open | ( | std::initializer_list< fileName > | libNames, |
| bool | verbose = true ) |
Open the named libraries, warn by default if problems occur.
Ignores duplicate names.
Definition at line 480 of file dlLibraryTable.C.
References open().

| void close | ( | bool | verbose = true | ) |
Close all libraries loaded by the table and remove the closed functions from the table.
Definition at line 310 of file dlLibraryTable.C.
References DebugInFunction, Foam::dlClose(), Foam::endl(), forAll, forAllReverse, Foam::name(), Foam::nl, List< T >::resize(), and WarningInFunction.
Referenced by ~dlLibraryTable().


| bool close | ( | const fileName & | libName, |
| bool | verbose = true ) |
Close the named library, optionally warn if problems occur.
Using an empty name is a no-op and always returns false.
Definition at line 507 of file dlLibraryTable.C.
References DebugInFunction, Foam::dlClose(), Foam::endl(), Foam::name(), Foam::nl, and WarningInFunction.

| void * findLibrary | ( | const fileName & | libName | ) |
Find the handle of the named library.
Using an empty name is a no-op and always returns nullptr.
Definition at line 563 of file dlLibraryTable.C.
| bool open | ( | const word & | libsEntry, |
| const dictionary & | dict, | ||
| bool | verbose = true ) |
Open libraries listed in the 'libsEntry' entry in the dictionary.
Definition at line 576 of file dlLibraryTable.C.
References dict, keyType::LITERAL, and open().

| bool open | ( | const dictionary & | dict, |
| const word & | libsEntry ) |
Open libraries listed in the 'libsEntry' entry in the dictionary.
Verbose = true
Definition at line 592 of file dlLibraryTable.C.

| bool open | ( | const dictionary & | dict, |
| const word & | libsEntry, | ||
| const TablePtr & | tablePtr, | ||
| bool | verbose = true ) |
Open all libraries listed in the 'libsEntry' entry in the given dictionary and check the additions to the given constructor table.
Definition at line 28 of file dlLibraryTableTemplates.C.
References dict, Foam::endl(), keyType::LITERAL, Foam::nl, open(), UList< T >::size(), and WarningInFunction.

|
inlinenoexcept |
Return info proxy, used to print library table information to a stream.
Definition at line 412 of file dlLibraryTable.H.
References Foam::noexcept.
|
inline |
Add to the list of names, but do not yet open.
FOAM_DEPRECATED_FOR(2024-04, "push_back()")
Definition at line 422 of file dlLibraryTable.H.
References push_back().

Add to the list of names, but do not yet open.
FOAM_DEPRECATED_FOR(2024-04, "push_back()")
Definition at line 432 of file dlLibraryTable.H.
References push_back().

|
static |
Use dlclose() when clearing the dlLibraryTable.
This is presumably cleaner, but can also remove functions that are still needed (eg, to terminate the library itself)
Definition at line 118 of file dlLibraryTable.H.
Referenced by ~dlLibraryTable().