dlLibraryTable.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2016 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  //- Disallow default bitwise copy construct
61 
62  //- Disallow default bitwise assignment
63  void operator=(const dlLibraryTable&);
64 
65 
66 public:
67 
68  // Declare name of the class and its debug switch
69  ClassName("dlLibraryTable");
70 
71  // Constructors
72 
73  //- Construct null
75 
76  //- Construct from dictionary and name of 'libs' entry giving
77  // the libraries to load
78  dlLibraryTable(const dictionary&, const word&);
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& name, const bool verbose = true);
89 
90  //- Close the named library, optionally with warnings if problems occur
91  bool close(const fileName& name, const bool verbose = true);
92 
93  //- Find the handle of the named library
94  void* findLibrary(const fileName& name);
95 
96  //- Open all the libraries listed in the 'libsEntry' entry in the
97  // given dictionary if present
98  bool open(const dictionary&, const word& libsEntry);
99 
100  //- Open all the libraries listed in the 'libsEntry' entry in the
101  // given dictionary if present and check the additions
102  // to the given constructor table
103  template<class TablePtr>
104  bool open
105  (
106  const dictionary&,
107  const word& libsEntry,
108  const TablePtr& tablePtr
109  );
110 };
111 
112 
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 
115 } // End namespace Foam
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 #ifdef NoRepository
120  #include "dlLibraryTableTemplates.C"
121 #endif
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 #endif
126 
127 // ************************************************************************* //
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:69
ClassName("dlLibraryTable")
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
dlLibraryTable()
Construct null.
~dlLibraryTable()
Destructor.
void * findLibrary(const fileName &name)
Find the handle of the named library.
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.