OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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