A keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read, written and printed, and the types and values of its tokens analysed. More...
#include <OpenFOAM/primitiveEntry.H>
A keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read, written and printed, and the types and values of its tokens analysed.
A primitiveEntry is a high-level building block for data description. It is a front-end for the token parser. A list of entries can be used as a set of keyword syntax elements, for example.
Definition at line 63 of file primitiveEntry.H.
Public Member Functions | |
primitiveEntry (const keyType &, Istream &) | |
Construct from keyword and a Istream. | |
primitiveEntry (const keyType &, const dictionary &parentDict, Istream &) | |
Construct from keyword, parent dictionary and Istream. | |
primitiveEntry (const keyType &, const ITstream &) | |
Construct from keyword and a ITstream. | |
primitiveEntry (const keyType &, const token &) | |
Construct from keyword and a token. | |
primitiveEntry (const keyType &, const tokenList &) | |
Construct from keyword and a tokenList. | |
template<class T > | |
primitiveEntry (const keyType &, const T &) | |
Construct from keyword and a T. | |
autoPtr< entry > | clone (const dictionary &) const |
Construct on freestore as copy with reference to the. | |
const fileName & | name () const |
Return the dictionary name. | |
fileName & | name () |
Return the dictionary name. | |
label | startLineNumber () const |
Return line number of first token in dictionary. | |
label | endLineNumber () const |
Return line number of last token in dictionary. | |
bool | isStream () const |
Return true because this entry is a stream. | |
ITstream & | stream () const |
Return token stream if this entry is a primitive entry. | |
const dictionary & | dict () const |
This entry is not a dictionary,. | |
dictionary & | dict () |
This entry is not a dictionary,. | |
bool | read (const dictionary &, Istream &) |
Read tokens from the given stream. | |
void | write (Ostream &) const |
Write. | |
InfoProxy< primitiveEntry > | info () const |
Return info proxy. | |
![]() | |
entry (const keyType &) | |
Construct from keyword. | |
entry (const entry &) | |
Construct as copy. | |
virtual autoPtr< entry > | clone () const |
Construct on freestore as copy. | |
virtual | ~entry () |
Destructor. | |
const keyType & | keyword () const |
Return keyword. | |
keyType & | keyword () |
Return non-const access to keyword. | |
virtual bool | isDict () const |
Return true if this entry is a dictionary. | |
void | operator= (const entry &) |
bool | operator== (const entry &) const |
bool | operator!= (const entry &) const |
![]() | |
link () | |
Null construct. | |
bool | registered () const |
Check if the link is registered with the DLListBase. | |
void | deregister () |
Deregister the link after removal. | |
![]() | |
ITstream (const string &name, const tokenList &tokens, streamFormat format=ASCII, versionNumber version=currentVersion) | |
Construct from components. | |
ITstream (const ITstream &its) | |
Construct as copy. | |
virtual | ~ITstream () |
label | tokenIndex () const |
Return the current token index. | |
label & | tokenIndex () |
Return non-const access to the current token index. | |
label | nRemainingTokens () const |
Return the number of remaining tokens. | |
ios_base::fmtflags | flags () const |
Return flags of output stream. | |
virtual Istream & | read (token &) |
Return next token from stream. | |
virtual Istream & | read (char &) |
Read a character. | |
virtual Istream & | read (word &) |
Read a word. | |
virtual Istream & | read (string &) |
virtual Istream & | read (label &) |
Read a label. | |
virtual Istream & | read (floatScalar &) |
Read a floatScalar. | |
virtual Istream & | read (doubleScalar &) |
Read a doubleScalar. | |
virtual Istream & | read (char *, std::streamsize) |
Read binary block. | |
virtual Istream & | rewind () |
Rewind and return the stream so that it may be read again. | |
ios_base::fmtflags | flags (const ios_base::fmtflags) |
Set flags of stream. | |
void | print (Ostream &) const |
Print description of IOstream to Ostream. | |
![]() | |
Istream (streamFormat format=ASCII, versionNumber version=currentVersion, compressionType compression=UNCOMPRESSED) | |
Set stream status. | |
virtual | ~Istream () |
void | putBack (const token &) |
Put back token. | |
bool | getBack (token &) |
Get the put back token. | |
Istream & | readBegin (const char *funcName) |
Istream & | readEnd (const char *funcName) |
Istream & | readEndBegin (const char *funcName) |
char | readBeginList (const char *funcName) |
char | readEndList (const char *funcName) |
Istream & | operator() () const |
Return a non-const reference to const Istream. | |
![]() | |
IOstream (streamFormat format, versionNumber version, compressionType compression=UNCOMPRESSED) | |
Construct setting format and version. | |
virtual | ~IOstream () |
virtual bool | check (const char *operation) const |
Check IOstream status for given operation. | |
void | fatalCheck (const char *operation) const |
Check IOstream status for given operation. | |
bool | opened () const |
Return true if stream has been opened. | |
bool | closed () const |
Return true if stream is closed. | |
bool | good () const |
Return true if next operation might succeed. | |
bool | eof () const |
Return true if end of input seen. | |
bool | fail () const |
Return true if next operation will fail. | |
bool | bad () const |
Return true if stream is corrupted. | |
operator void * () const | |
Return non-zero if the stream has not failed. | |
bool | operator! () const |
Return true if the stream has failed. | |
streamFormat | format () const |
Return current stream format. | |
streamFormat | format (const streamFormat fmt) |
Set the stream format. | |
streamFormat | format (const word &fmt) |
Set the stream format from word. | |
versionNumber | version () const |
Return the stream version. | |
versionNumber | version (const versionNumber ver) |
Set the stream version. | |
compressionType | compression () const |
Return the stream compression. | |
compressionType | compression (const compressionType cmp) |
Set the stream compression. | |
compressionType | compression (const word &cmp) |
Set the stream compression from word. | |
label | lineNumber () const |
Return current stream line number. | |
label & | lineNumber () |
Return current stream line number. | |
label | lineNumber (const label ln) |
Set the stream line number. | |
void | setEof () |
Set stream to have reached eof. | |
void | setFail () |
Set stream to have failed. | |
void | setBad () |
Set stream to be bad. | |
virtual ios::fmtflags | flags (const ios::fmtflags f)=0 |
Set flags of stream. | |
ios::fmtflags | setf (const ios::fmtflags f) |
Set flags of stream. | |
ios::fmtflags | setf (const ios::fmtflags f, const ios::fmtflags mask) |
Set flags of given field of stream. | |
void | unsetf (const ios::fmtflags uf) |
Unset flags of stream. | |
void | print (Ostream &, const int streamState) const |
Check given stream state bits. | |
![]() | |
List () | |
Null constructor. | |
List (const label) | |
Construct with given size. | |
List (const label, const T &) | |
Construct with given size and value for all elements. | |
List (const List< T > &) | |
Copy constructor. | |
List (const Xfer< List< T > > &) | |
Construct by transferring the parameter contents. | |
List (List< T > &, bool reUse) | |
Construct as copy or re-use as specified. | |
List (const UList< T > &, const unallocLabelList &mapAddressing) | |
Construct as subset. | |
template<class InputIterator > | |
List (InputIterator first, InputIterator last) | |
Construct given start and end iterators. | |
template<unsigned Size> | |
List (const FixedList< T, Size > &) | |
Construct as copy of FixedList<T, Size> | |
List (const PtrList< T > &) | |
Construct as copy of PtrList<T> | |
List (const SLList< T > &) | |
Construct as copy of SLList<T> | |
List (const IndirectList< T > &) | |
Construct as copy of IndirectList<T> | |
List (const UIndirectList< T > &) | |
Construct as copy of UIndirectList<T> | |
List (const BiIndirectList< T > &) | |
Construct as copy of BiIndirectList<T> | |
List (Istream &) | |
Construct from Istream. | |
autoPtr< List< T > > | clone () const |
Clone. | |
~List () | |
label | size () const |
Return the number of elements in the UList. | |
void | resize (const label) |
Reset size of List. | |
void | resize (const label, const T &) |
Reset size of List and value for new elements. | |
void | setSize (const label) |
Reset size of List. | |
void | setSize (const label, const T &) |
Reset size of List and value for new elements. | |
void | clear () |
Clear the list, i.e. set size to zero. | |
void | append (const UList< T > &) |
Append a List at the end of this list. | |
void | append (const UIndirectList< T > &) |
Append a UIndirectList at the end of this list. | |
void | transfer (List< T > &) |
Transfer the contents of the argument List into this list. | |
template<unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> | |
void | transfer (DynamicList< T, SizeInc, SizeMult, SizeDiv > &) |
Transfer the contents of the argument List into this list. | |
void | transfer (SortableList< T > &) |
Transfer the contents of the argument List into this list. | |
Xfer< List< T > > | xfer () |
Transfer contents to the Xfer container. | |
T & | newElmt (const label) |
Return subscript-checked element of UList. | |
void | operator= (const UList< T > &) |
Assignment from UList operator. Takes linear time. | |
void | operator= (const List< T > &) |
Assignment operator. Takes linear time. | |
void | operator= (const SLList< T > &) |
Assignment from SLList operator. Takes linear time. | |
void | operator= (const IndirectList< T > &) |
Assignment from IndirectList operator. Takes linear time. | |
void | operator= (const UIndirectList< T > &) |
Assignment from UIndirectList operator. Takes linear time. | |
void | operator= (const BiIndirectList< T > &) |
Assignment from BiIndirectList operator. Takes linear time. | |
void | operator= (const T &) |
Assignment of all entries to the given value. | |
![]() | |
UList () | |
Null constructor. | |
UList (T *__restrict__ v, label size) | |
Construct from components. | |
label | fcIndex (const label i) const |
Return the forward circular index, i.e. the next index. | |
label | rcIndex (const label i) const |
Return the reverse circular index, i.e. the previous index. | |
label | byteSize () const |
Return the binary size in number of characters of the UList. | |
const T * | cdata () const |
Return a const pointer to the first data element,. | |
T * | data () |
Return a pointer to the first data element,. | |
void | checkStart (const label start) const |
Check start is within valid range (0 ... size-1). | |
void | checkSize (const label size) const |
Check size is within valid range (0 ... size). | |
void | checkIndex (const label i) const |
Check index i is within valid range (0 ... size-1). | |
void | writeEntry (Ostream &) const |
Write the UList as a dictionary entry. | |
void | writeEntry (const word &keyword, Ostream &) const |
Write the UList as a dictionary entry with keyword. | |
void | assign (const UList< T > &) |
Assign elements to those from UList. | |
T & | operator[] (const label) |
Return element of UList. | |
const T & | operator[] (const label) const |
Return element of constant UList. | |
operator const Foam::List< T > & () const | |
Allow cast to a const List<T>&. | |
iterator | begin () |
Return an iterator to begin traversing the UList. | |
iterator | end () |
Return an iterator to end traversing the UList. | |
const_iterator | cbegin () const |
Return const_iterator to begin traversing the constant UList. | |
const_iterator | cend () const |
Return const_iterator to end traversing the constant UList. | |
const_iterator | begin () const |
Return const_iterator to begin traversing the constant UList. | |
const_iterator | end () const |
Return const_iterator to end traversing the constant UList. | |
reverse_iterator | rbegin () |
Return reverse_iterator to begin reverse traversing the UList. | |
reverse_iterator | rend () |
Return reverse_iterator to end reverse traversing the UList. | |
const_reverse_iterator | crbegin () const |
Return const_reverse_iterator to begin reverse traversing the UList. | |
const_reverse_iterator | crend () const |
Return const_reverse_iterator to end reverse traversing the UList. | |
const_reverse_iterator | rbegin () const |
Return const_reverse_iterator to begin reverse traversing the UList. | |
const_reverse_iterator | rend () const |
Return const_reverse_iterator to end reverse traversing the UList. | |
label | max_size () const |
Return size of the largest possible UList. | |
bool | empty () const |
Return true if the UList is empty (ie, size() is zero). | |
void | swap (UList< T > &) |
Swap two ULists of the same type in constant time. | |
bool | operator== (const UList< T > &) const |
Equality operation on ULists of the same type. | |
bool | operator!= (const UList< T > &) const |
The opposite of the equality operation. Takes linear time. | |
bool | operator< (const UList< T > &) const |
Compare two ULists lexicographically. Takes linear time. | |
bool | operator> (const UList< T > &) const |
Compare two ULists lexicographically. Takes linear time. | |
bool | operator<= (const UList< T > &) const |
Return true if !(a > b). Takes linear time. | |
bool | operator>= (const UList< T > &) const |
Return true if !(a < b). Takes linear time. | |
template<> | |
const bool & | operator[] (const label i) const |
Additional Inherited Members | |
![]() | |
static bool | New (dictionary &parentDict, Istream &) |
Construct from Istream and insert into dictionary. | |
static autoPtr< entry > | New (Istream &is) |
Construct on freestore from Istream and return. |
primitiveEntry | ( | const keyType & | key, |
Istream & | is | ||
) |
Construct from keyword and a Istream.
Definition at line 243 of file primitiveEntryIO.C.
References dictionary::null.
Referenced by primitiveEntry::clone().
primitiveEntry | ( | const keyType & | key, |
const dictionary & | parentDict, | ||
Istream & | is | ||
) |
Construct from keyword, parent dictionary and Istream.
Definition at line 224 of file primitiveEntryIO.C.
primitiveEntry | ( | const keyType & | key, |
const ITstream & | tokens | ||
) |
Construct from keyword and a ITstream.
Definition at line 31 of file primitiveEntry.C.
References entry::keyword(), and primitiveEntry::name().
primitiveEntry | ( | const keyType & | keyword, |
const token & | t | ||
) |
Construct from keyword and a token.
Definition at line 40 of file primitiveEntry.C.
primitiveEntry | ( | const keyType & | keyword, |
const tokenList & | tokens | ||
) |
Construct from keyword and a tokenList.
Definition at line 48 of file primitiveEntry.C.
primitiveEntry | ( | const keyType & | keyword, |
const T & | t | ||
) |
Construct from keyword and a T.
Definition at line 32 of file primitiveEntryTemplates.C.
References token::END_STATEMENT, dictionary::null, and OStringStream::str().
|
inlinevirtual |
Construct on freestore as copy with reference to the.
dictionary the copy belongs to
Implements entry.
Definition at line 122 of file primitiveEntry.H.
References primitiveEntry::primitiveEntry().
|
inlinevirtual |
Return the dictionary name.
Implements entry.
Definition at line 131 of file primitiveEntry.H.
Referenced by primitiveEntry::name(), and primitiveEntry::primitiveEntry().
|
inlinevirtual |
Return the dictionary name.
Implements entry.
Definition at line 137 of file primitiveEntry.H.
References primitiveEntry::name().
|
virtual |
Return line number of first token in dictionary.
Implements entry.
Definition at line 60 of file primitiveEntry.C.
|
virtual |
Return line number of last token in dictionary.
Implements entry.
Definition at line 72 of file primitiveEntry.C.
|
inlinevirtual |
Return true because this entry is a stream.
Reimplemented from entry.
Definition at line 149 of file primitiveEntry.H.
|
virtual |
Return token stream if this entry is a primitive entry.
Implements entry.
Definition at line 85 of file primitiveEntry.C.
References ITstream::rewind().
|
virtual |
This entry is not a dictionary,.
calling this function generates a FatalError
Implements entry.
Definition at line 93 of file primitiveEntry.C.
References Foam::abort(), Foam::FatalError, FatalErrorIn, and dictionary::null.
|
virtual |
This entry is not a dictionary,.
calling this function generates a FatalError
Implements entry.
Definition at line 104 of file primitiveEntry.C.
References Foam::abort(), Foam::FatalError, FatalErrorIn, and dictionary::null.
bool read | ( | const dictionary & | dict, |
Istream & | is | ||
) |
Read tokens from the given stream.
Definition at line 126 of file primitiveEntryIO.C.
References append(), IOstream::bad(), token::BEGIN_BLOCK, token::BEGIN_LIST, token::END_BLOCK, token::END_LIST, token::END_STATEMENT, IOstream::fatalCheck(), token::good(), and Istream::read().
Referenced by includeIfPresentEntry::execute(), and includeEntry::execute().
|
virtual |
Write.
Implements entry.
Definition at line 260 of file primitiveEntryIO.C.
References token::END_STATEMENT, Foam::endl(), token::SPACE, and Ostream::writeKeyword().
|
inline |
Return info proxy.
Used to print token information to a stream
Reimplemented from IOstream.
Definition at line 173 of file primitiveEntry.H.
Referenced by Foam::operator<<().