47 void Foam::functionEntry::readRestOfArgs(
string& fNameArgs, Istream& is)
const
52 if (
dynamic_cast<ISstream*
>(&is))
56 ISstream& iss =
dynamic_cast<ISstream&
>(is);
82 fNameArgs.resize(fNameArgs.size() - 1);
87 OStringStream argStream;
93 !is.read(currToken).bad()
112 argStream << currToken;
115 fNameArgs.append(argStream.str());
133 const token nextToken(is);
143 const token nextToken(is);
151 const token endListToken(is);
163 <<
"Unclosed argument list " << nextToken
164 <<
" in functionEntry " <<
argList
171 readRestOfArgs(fArgs, is);
182 <<
" to open argument list, but found " << nextToken
183 <<
" in functionEntry " << functionType
204 const token fName(is);
211 funcNameArgList.
append(fName);
220 if (argsStart != string::npos)
222 const word fName(fNameArgs(0, argsStart));
223 funcNameArgList.
append(
token(fName, fNameLineNumber));
231 fNameArgs(argsStart + 1, fNameArgs.size() - argsStart)
233 readRestOfArgs(fArgs, is);
235 funcNameArgList.
append(
token(fArgs, fNameLineNumber));
240 funcNameArgList.
append(
token(fNameArgs, fNameLineNumber));
244 if (argsStart == string::npos)
246 funcNameArgList.
append(readArgList(functionType, is,
true));
252 funcNameArgList.
append(fName);
255 return funcNameArgList;
268 const token fName(is);
274 fileNameArgList.
append(fName);
277 fileNameArgList.
append(readArgList(functionType, is,
true));
282 fileNameArgList.
append(fName);
285 return fileNameArgList;
325 <<
"Unclosed argument list " << currToken
326 <<
" in functionEntry " << functionType
360 contextEntry.append(t, parentDict, is);
416 const label lineNumber,
427 const label lineNumber,
445 const label lineNumber,
472 if (!dictionaryConstructorTablePtr_)
474 cerr<<
"--> FOAM Error: Found " << functionType
475 <<
" while reading configuration dictionary " << is.
name()
477 <<
" Function entries cannot be used in "
478 "configuration dictionaries."
485 dictionaryConstructorTable::iterator cstrIter =
486 dictionaryConstructorTablePtr_->find(functionType);
488 if (cstrIter == dictionaryConstructorTablePtr_->end())
491 <<
"Unknown functionEntry "
492 << functionType <<
nl <<
nl
493 <<
"Valid functions are : " <<
nl
494 << dictionaryConstructorTablePtr_->sortedToc()
516 "functionEntry::execute"
517 "(const word&, const dictionary&, primitiveEntry&, Istream&)"
520 if (!executeprimitiveEntryIstreamMemberFunctionTablePtr_)
522 cerr<<
"functionEntry::execute"
523 <<
"(const word&, const dictionary&, primitiveEntry&, Istream&)"
524 <<
" not yet initialised, function = "
531 executeprimitiveEntryIstreamMemberFunctionTable::iterator mfIter =
532 executeprimitiveEntryIstreamMemberFunctionTablePtr_->find(
functionName);
534 if (mfIter == executeprimitiveEntryIstreamMemberFunctionTablePtr_->end())
540 <<
"Valid functionEntries are :" <<
endl
541 << executeprimitiveEntryIstreamMemberFunctionTablePtr_->toc()
545 return mfIter()(contextDict, contextEntry, is);
graph_traits< Graph >::vertices_size_type size_type
label lineNumber() const
Return current stream line number.
virtual const fileName & name() const
Return the name of the stream.
void fatalCheck(const char *operation) const
Check IOstream status for given operation.
bool bad() const
Return true if stream is corrupted.
Input from memory buffer stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
virtual Istream & read(token &)=0
Return next token from stream.
void putBack(const token &)
Put back token.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &)
Append an element at the end of the list.
virtual const fileName & name() const
Return the name of the stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Extract command arguments and options from the supplied argc and argv parameters.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
bool read(Istream &, const bool keepHeader=false)
Read dictionary from Istream, optionally keeping the header.
static bool New(dictionary &parentDict, Istream &)
Construct from Istream and insert into dictionary.
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
tokenList readArgOrList(const functionName &functionType, Istream &is) const
Read a single argument or list.
virtual void write(Ostream &) const
Write.
virtual bool execute(dictionary &contextDict, Istream &is)=0
Expand the functionEntry into the contextDict.
static bool insert(const dictionary &parentDict, dictionary &contextDict, const token &t, Istream &is)
Read entry starting from token t and insert into contextDict.
tokenList readFuncNameArgList(const functionName &functionType, Istream &is) const
Read the function name and optional argument list.
tokenList readArgList(const functionName &functionType, Istream &is, const bool optional=false) const
tokenList readFileNameArgList(const functionName &functionType, Istream &is) const
Read the filen name and optional argument list.
static autoPtr< functionEntry > New(const keyType &functionName, const dictionary &parentDict, Istream &is)
Construct from Istream and insert into dictionary.
A functionName is a word starting with '#'.
A class for handling keywords in dictionaries.
A keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read,...
void write(Ostream &) const
Write.
friend class functionEntry
virtual bool read(const dictionary &, Istream &)
Read tokens from the given stream.
A token holds items read from Istream.
bool isPunctuation() const
punctuationToken pToken() const
const string & anyStringToken() const
const word & wordToken() const
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const dimensionedScalar c
Speed of light in a vacuum.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
defineFunctionTypeName(functionEntry)
defineRunTimeSelectionTable(fvConstraint, dictionary)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
Ostream & writeKeyword(Foam::Ostream &os, const keyType &kw)
Write the keyword to the Ostream with the current level of indentation.
defineMemberFunctionSelectionTable(edgeMesh, write, fileExtension)