1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
28 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
30 inline const Foam::word& Foam::argList::executable() const
36 inline const Foam::fileName& Foam::argList::rootPath() const
42 inline const Foam::fileName& Foam::argList::caseName() const
48 inline const Foam::fileName& Foam::argList::globalCaseName() const
54 inline Foam::fileName Foam::argList::path() const
56 return rootPath()/caseName();
60 inline const Foam::stringList& Foam::argList::args() const
66 inline const Foam::string& Foam::argList::arg(const label index) const
72 inline Foam::label Foam::argList::size() const
78 inline const Foam::HashTable<Foam::string>& Foam::argList::options() const
84 inline const Foam::string& Foam::argList::option(const word& opt) const
90 inline bool Foam::argList::optionFound(const word& opt) const
92 return options_.found(opt);
96 inline Foam::IStringStream Foam::argList::optionLookup(const word& opt) const
98 return IStringStream(options_[opt]);
102 // * * * * * * * * * * * * Template Specializations * * * * * * * * * * * * //
106 // Template specialization for string
109 Foam::argList::argRead<Foam::string>(const label index) const
114 // Template specialization for word
117 Foam::argList::argRead<Foam::word>(const label index) const
122 // Template specialization for fileName
124 inline Foam::fileName
125 Foam::argList::argRead<Foam::fileName>(const label index) const
130 // Template specialization for string
133 Foam::argList::optionRead<Foam::string>(const word& opt) const
135 return options_[opt];
138 // Template specialization for word
141 Foam::argList::optionRead<Foam::word>(const word& opt) const
143 return options_[opt];
146 // Template specialization for fileName
148 inline Foam::fileName
149 Foam::argList::optionRead<Foam::fileName>(const word& opt) const
151 return options_[opt];
156 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
159 inline T Foam::argList::argRead(const label index) const
163 IStringStream(args_[index])() >> val;
169 inline T Foam::argList::optionRead(const word& opt) const
173 optionLookup(opt)() >> val;
179 inline bool Foam::argList::optionReadIfPresent
185 if (optionFound(opt))
187 val = optionRead<T>(opt);
198 inline bool Foam::argList::optionReadIfPresent
205 if (optionReadIfPresent<T>(opt, val))
218 inline T Foam::argList::optionLookupOrDefault
224 if (optionFound(opt))
226 return optionRead<T>(opt);
235 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
237 inline const Foam::string& Foam::argList::operator[](const label index) const
243 inline const Foam::string& Foam::argList::operator[](const word& opt) const
245 return options_[opt];
249 // ************************************************************************* //