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-2019 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 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class dlLibraryTable Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class dlLibraryTable
51 {
52  // Private Member Functions
53 
54  DynamicList<void*> libPtrs_;
55 
56  DynamicList<fileName> libNames_;
57 
58 
59 public:
60 
61  // Declare name of the class and its debug switch
62  ClassName("dlLibraryTable");
63 
64  // Constructors
65 
66  //- Construct null
68 
69  //- Construct from dictionary and name of 'libs' entry giving
70  // the libraries to load
71  dlLibraryTable(const dictionary&, const word&);
72 
73  //- Disallow default bitwise copy construction
74  dlLibraryTable(const dlLibraryTable&) = delete;
75 
76 
77  //- Destructor
79 
80 
81  // Member Functions
82 
83  //- Open the named library, optionally with warnings if problems occur
84  bool open(const fileName& name, const bool verbose = true);
85 
86  //- Close the named library, optionally with warnings if problems occur
87  bool close(const fileName& name, const bool verbose = true);
88 
89  //- Find the handle of the named library
90  void* findLibrary(const fileName& name);
91 
92  //- Open all the libraries listed in the 'libsEntry' entry in the
93  // given dictionary if present
94  bool open(const dictionary&, const word& libsEntry);
95 
96  //- Open all the libraries listed in the 'libsEntry' entry in the
97  // given dictionary if present and check the additions
98  // to the given constructor table
99  template<class TablePtr>
100  bool open
101  (
102  const dictionary&,
103  const word& libsEntry,
104  const TablePtr& tablePtr
105  );
106 
107 
108  // Member Operators
109 
110  //- Disallow default bitwise assignment
111  void operator=(const dlLibraryTable&) = delete;
112 };
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace Foam
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 #ifdef NoRepository
122  #include "dlLibraryTableTemplates.C"
123 #endif
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 #endif
128 
129 // ************************************************************************* //
bool open(const fileName &name, const bool verbose=true)
Open the named library, optionally with warnings if problems occur.
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.
void * findLibrary(const fileName &name)
Find the handle of the named library.
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.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Namespace for OpenFOAM.