FreeFOAM The Cross-Platform CFD Toolkit
primitiveEntry Class Reference

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>


Detailed Description

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.

Source files

Definition at line 63 of file primitiveEntry.H.

+ Inheritance diagram for primitiveEntry:
+ Collaboration diagram for primitiveEntry:

List of all members.

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< entryclone (const dictionary &) const
 Construct on freestore as copy with reference to the.
const fileNamename () const
 Return the dictionary name.
fileNamename ()
 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.
ITstreamstream () const
 Return token stream if this entry is a primitive entry.
const dictionarydict () const
 This entry is not a dictionary,.
dictionarydict ()
 This entry is not a dictionary,.
bool read (const dictionary &, Istream &)
 Read tokens from the given stream.
void write (Ostream &) const
 Write.
InfoProxy< primitiveEntryinfo () const
 Return info proxy.
- Public Member Functions inherited from entry
 entry (const keyType &)
 Construct from keyword.
 entry (const entry &)
 Construct as copy.
virtual autoPtr< entryclone () const
 Construct on freestore as copy.
virtual ~entry ()
 Destructor.
const keyTypekeyword () const
 Return keyword.
keyTypekeyword ()
 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
- Public Member Functions inherited from ITstream
 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 Istreamread (token &)
 Return next token from stream.
virtual Istreamread (char &)
 Read a character.
virtual Istreamread (word &)
 Read a word.
virtual Istreamread (string &)
virtual Istreamread (label &)
 Read a label.
virtual Istreamread (floatScalar &)
 Read a floatScalar.
virtual Istreamread (doubleScalar &)
 Read a doubleScalar.
virtual Istreamread (char *, std::streamsize)
 Read binary block.
virtual Istreamrewind ()
 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.
- Public Member Functions inherited from Istream
 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.
IstreamreadBegin (const char *funcName)
IstreamreadEnd (const char *funcName)
IstreamreadEndBegin (const char *funcName)
char readBeginList (const char *funcName)
char readEndList (const char *funcName)
Istreamoperator() () const
 Return a non-const reference to const Istream.
- Public Member Functions inherited from IOstream
 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.
- Public Member Functions inherited from List< T >
 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.
TnewElmt (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.
- Public Member Functions inherited from UList< T >
 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 Tcdata () const
 Return a const pointer to the first data element,.
Tdata ()
 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.
Toperator[] (const label)
 Return element of UList.
const Toperator[] (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 Public Member Functions inherited from entry
static bool New (dictionary &parentDict, Istream &)
 Construct from Istream and insert into dictionary.
static autoPtr< entryNew (Istream &is)
 Construct on freestore from Istream and return.

Constructor & Destructor Documentation

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().


Member Function Documentation

autoPtr<entry> clone ( const dictionary parentDict) const
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().

const fileName& name ( ) const
inlinevirtual

Return the dictionary name.

Implements entry.

Definition at line 131 of file primitiveEntry.H.

Referenced by primitiveEntry::name(), and primitiveEntry::primitiveEntry().

fileName& name ( )
inlinevirtual

Return the dictionary name.

Implements entry.

Definition at line 137 of file primitiveEntry.H.

References primitiveEntry::name().

Foam::label startLineNumber ( ) const
virtual

Return line number of first token in dictionary.

Implements entry.

Definition at line 60 of file primitiveEntry.C.

Foam::label endLineNumber ( ) const
virtual

Return line number of last token in dictionary.

Implements entry.

Definition at line 72 of file primitiveEntry.C.

bool isStream ( ) const
inlinevirtual

Return true because this entry is a stream.

Reimplemented from entry.

Definition at line 149 of file primitiveEntry.H.

Foam::ITstream & stream ( ) const
virtual

Return token stream if this entry is a primitive entry.

Implements entry.

Definition at line 85 of file primitiveEntry.C.

References ITstream::rewind().

const Foam::dictionary & dict ( ) const
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.

Foam::dictionary & dict ( )
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.

void write ( Ostream ) const
virtual

Write.

Implements entry.

Definition at line 260 of file primitiveEntryIO.C.

References token::END_STATEMENT, Foam::endl(), token::SPACE, and Ostream::writeKeyword().

InfoProxy<primitiveEntry> info ( ) const
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<<().


The documentation for this class was generated from the following files: