All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dlLibraryTable.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::dlLibraryTable
26 
27 Description
28  A table of dynamically loaded libraries
29 
30 SourceFiles
31  dlLibraryTable.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef dlLibraryTable_H
36 #define dlLibraryTable_H
37 
38 #include "label.H"
39 #include "DynamicList.H"
40 #include "fileNameList.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class dlLibraryTable Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class dlLibraryTable
52 {
53  // Private Member Functions
54 
55  //- List of pointers to the loaded dynamic libraries
56  DynamicList<void*> libPtrs_;
57 
58  //- List of names of the loaded dynamic libraries
59  DynamicList<fileName> libNames_;
60 
61 
62 public:
63 
64  // Declare name of the class and its debug switch
65  ClassName("dlLibraryTable");
66 
67 
68  // Constructors
69 
70  //- Construct null
72 
73  //- Construct from dictionary and name of 'libs' entry giving
74  // the libraries to load
75  dlLibraryTable(const dictionary&, const word&);
76 
77  //- Disallow default bitwise copy construction
78  dlLibraryTable(const dlLibraryTable&) = delete;
79 
80 
81  //- Destructor
83 
84 
85  // Member Functions
86 
87  //- Open the named library, optionally with warnings if problems occur
88  bool open(const fileName& libName, const bool verbose = true);
89 
90  //- Open the named libraries, optionally with warnings if problems occur
91  bool open(const fileNameList& libNames, const bool verbose = true);
92 
93  //- Open all the libraries listed in the 'libsEntry' entry in the
94  // given dictionary if present
95  bool open(const dictionary&, const word& libsEntry);
96 
97  //- Open all the libraries listed in the 'libsEntry' entry in the
98  // given dictionary if present and check the additions
99  // to the given constructor table
100  template<class TablePtr>
101  bool open
102  (
103  const dictionary&,
104  const word& libsEntry,
105  const TablePtr& tablePtr
106  );
107 
108  //- Find the handle of the named library
109  void* findLibrary(const fileName& libName);
110 
111  //- Close the named library, optionally with warnings if problems occur
112  bool close(const fileName& name, const bool verbose = true);
113 
114 
115  // Member Operators
116 
117  //- Disallow default bitwise assignment
118  void operator=(const dlLibraryTable&) = delete;
119 };
120 
121 
122 //- Table of loaded dynamic libraries
123 extern dlLibraryTable libs;
124 
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #ifdef NoRepository
133  #include "dlLibraryTableTemplates.C"
134 #endif
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #endif
139 
140 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:79
ClassName("dlLibraryTable")
void operator=(const dlLibraryTable &)=delete
Disallow default bitwise assignment.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
dlLibraryTable()
Construct null.
~dlLibraryTable()
Destructor.
dlLibraryTable libs
Table of loaded dynamic libraries.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
A class for handling words, derived from string.
Definition: word.H:59
A table of dynamically loaded libraries.
bool close(const fileName &name, const bool verbose=true)
Close the named library, optionally with warnings if problems occur.
bool open(const fileName &libName, const bool verbose=true)
Open the named library, optionally with warnings if problems occur.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
void * findLibrary(const fileName &libName)
Find the handle of the named library.
Namespace for OpenFOAM.