OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen OpenCFD Solutions Contact OpenFOAM

dlLibraryTable.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2007 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     dlLibraryTable
00027 
00028 Description
00029 
00030 SourceFiles
00031     dlLibraryTable.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef dlLibraryTable_H
00036 #define dlLibraryTable_H
00037 
00038 #include "HashTable.H"
00039 #include "label.H"
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 namespace Foam
00044 {
00045 
00046 /*---------------------------------------------------------------------------*\
00047                            Class dlLibraryTable Declaration
00048 \*---------------------------------------------------------------------------*/
00049 
00050 template<>
00051 class Hash<void*>
00052 {
00053 
00054 public:
00055 
00056     Hash()
00057     {}
00058 
00059     long operator()(const void* const& p) const
00060     {
00061         return long(p);
00062     }
00063 
00064     label operator()(const void* const& p, const label tableSize) const
00065     {
00066         return abs(operator()(p)) % tableSize;
00067     }
00068 };
00069 
00070 
00071 class dlLibraryTable
00072 :
00073     public HashTable<fileName, void*, Hash<void*> >
00074 {
00075     // Private Member Functions
00076 
00077         //- Disallow default bitwise copy construct
00078         dlLibraryTable(const dlLibraryTable&);
00079 
00080         //- Disallow default bitwise assignment
00081         void operator=(const dlLibraryTable&);
00082 
00083 
00084 public:
00085 
00086     // Static data members
00087 
00088         //- Static data someStaticData
00089         static dlLibraryTable loadedLibraries;
00090 
00091 
00092     // Public classes
00093 
00094         //- Class whose construction causes the reading of dynamic libraries
00095         class readDlLibrary
00096         {
00097         public:
00098 
00099             //- Read all the libraries listed in the 'libsEntry' entry in the
00100             //  given dictionary if present
00101             readDlLibrary(const dictionary&, const word& libsEntry);
00102         };
00103 
00104 
00105     // Constructors
00106 
00107         //- Construct null
00108         dlLibraryTable();
00109 
00110 
00111     // Destructor
00112 
00113         ~dlLibraryTable();
00114 
00115 
00116     // Member Functions
00117 
00118         //- Open the named library
00119         static bool open(const fileName& name);
00120 
00121         //- Open all the libraries listed in the 'libsEntry' entry in the
00122         //  given dictionary if present
00123         static bool open(const dictionary&, const word& libsEntry);
00124 
00125         //- Open all the libraries listed in the 'libsEntry' entry in the
00126         //  given dictionary if present and check the additions
00127         //  to the give constructor table
00128         template<class TablePtr>
00129         static bool open
00130         (
00131             const dictionary&,
00132             const word& libsEntry,
00133             const TablePtr& tablePtr
00134         );
00135 };
00136 
00137 
00138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00139 
00140 } // End namespace Foam
00141 
00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00143 
00144 #ifdef NoRepository
00145 #   include "dlLibraryTableTemplates.C"
00146 #endif
00147 
00148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00149 
00150 #endif
00151 
00152 // ************************************************************************* //
Copyright © 2000-2007 OpenCFD Ltd