FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

inputModeEntry.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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::functionEntries::inputModeEntry
00026 
00027 Description
00028     Specify the input mode when reading dictionaries, expects
00029     a single word to follow.
00030 
00031     An example of @c \#inputMode directive:
00032     @verbatim
00033         #inputMode merge
00034     @endverbatim
00035 
00036     The possible input modes:
00037     @param merge      merge sub-dictionaries when possible
00038     @param overwrite  keep last entry and silently remove previous ones
00039     @param protect    keep initial entry and silently ignore subsequent ones
00040     @param warn       keep initial entry and warn about subsequent ones
00041     @param error      issue a FatalError for duplicate entries
00042     @param default    currently identical to merge
00043 
00044 SourceFiles
00045     inputModeEntry.C
00046 
00047 \*---------------------------------------------------------------------------*/
00048 
00049 #ifndef inputModeEntry_H
00050 #define inputModeEntry_H
00051 
00052 #include <OpenFOAM/functionEntry.H>
00053 
00054 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00055 
00056 namespace Foam
00057 {
00058 namespace functionEntries
00059 {
00060 
00061 /*---------------------------------------------------------------------------*\
00062                         Class inputModeEntry Declaration
00063 \*---------------------------------------------------------------------------*/
00064 
00065 class inputModeEntry
00066 :
00067     public functionEntry
00068 {
00069         //- The input mode options
00070         enum inputMode
00071         {
00072             MERGE,
00073             OVERWRITE,
00074             PROTECT,
00075             WARN,
00076             ERROR
00077         };
00078 
00079         //- The current input mode
00080         static inputMode mode_;
00081 
00082 
00083     // Private Member Functions
00084 
00085         //- Read the mode as a word and set enum appropriately
00086         static void setMode(Istream&);
00087 
00088         //- Disallow default bitwise copy construct
00089         inputModeEntry(const inputModeEntry&);
00090 
00091         //- Disallow default bitwise assignment
00092         void operator=(const inputModeEntry&);
00093 
00094 
00095 public:
00096 
00097     //- Runtime type information
00098     ClassName("inputMode");
00099 
00100 
00101     // Member Functions
00102 
00103         //- Execute the functionEntry in a sub-dict context
00104         static bool execute(dictionary& parentDict, Istream&);
00105 
00106         //- Reset the inputMode to %default (ie, %merge)
00107         static void clear();
00108 
00109         //- Return true if the inputMode is %merge
00110         static bool merge();
00111 
00112         //- Return true if the inputMode is %overwrite
00113         static bool overwrite();
00114 
00115         //- Return true if the inputMode is %protect
00116         static bool protect();
00117 
00118         //- Return true if the inputMode is %error
00119         static bool error();
00120 };
00121 
00122 
00123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00124 
00125 } // End namespace functionEntries
00126 } // End namespace Foam
00127 
00128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00129 
00130 #endif
00131 
00132 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines