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

dictionary Class Reference

Inheritance diagram for dictionary:

Inheritance graph
[legend]
Collaboration diagram for dictionary:

Collaboration graph
[legend]
List of all members.

Detailed Description

A list of keyword definitions, which are a keyword followed by any number of values (e.g. words and numbers).

The dictionary class is the base class for IOdictionary. It also serves as a bootstrap dictionary for the objectRegistry data dictionaries since, unlike the IOdictionary class, it does not use an objectRegistry itself to work.

Todo:
A merge() member function with a non-const dictionary parameter. This would avoid unnecessary cloning in the add(entry*,bool) method
Source files

Definition at line 68 of file dictionary.H.


Public Member Functions

bool read (Istream &)
 Read dictionary from Istream.
bool substituteKeyword (const word &keyword)
 Substitute the given keyword prepended by '$' with the.
 ClassName ("dictionary")
 dictionary ()
 Construct top-level dictionary null.
 dictionary (const dictionary &parentDict, Istream &)
 Construct from the parent dictionary and Istream, reading entries.
 dictionary (Istream &)
 Construct top-level dictionary from Istream, reading entries.
 dictionary (const dictionary &parentDict, const dictionary &dict)
 Construct as copy given the parent dictionary.
 dictionary (const dictionary &dict)
 Construct top-level dictionary as copy.
Foam::autoPtr< dictionaryclone () const
 Construct and return clone.
 ~dictionary ()
const fileNamename () const
 Return the dictionary name.
fileNamename ()
 Return the dictionary name.
const dictionaryparent () const
 Return the parent dictionary.
label startLineNumber () const
 Return line number of first token in dictionary.
label endLineNumber () const
 Return line number of last token in dictionary.
bool found (const word &keyword, bool recursive=false) const
 Search dictionary for given keyword.
const entrylookupEntryPtr (const word &, bool recursive=false) const
 Find and return an entry data stream pointer if present.
entrylookupEntryPtr (const word &, bool recursive=false)
 Find and return an entry data stream pointer for manipulation.
const entrylookupEntry (const word &, bool recursive=false) const
 Find and return an entry data stream if present otherwise error.
ITstreamlookup (const word &, bool recursive=false) const
 Find and return an entry data stream.
template<class T>
lookupOrDefault (const word &, const T &, bool recursive=false) const
 Find and return a T,.
template<class T>
lookupOrAddDefault (const word &, const T &, bool recursive=false)
 Find and return a T, if not found return the given.
template<class T>
bool readIfPresent (const word &, T &, bool recursive=false) const
 Find an entry if present, and assign to T.
bool isDict (const word &) const
 Check if entry is a sub-dictionary.
const dictionarysubDictPtr (const word &) const
 Find and return a sub-dictionary pointer if present.
const dictionarysubDict (const word &) const
 Find and return a sub-dictionary.
dictionarysubDict (const word &)
 Find and return a sub-dictionary for manipulation.
wordList toc () const
 Return the table of contents.
bool add (entry *, bool mergeEntry=false)
 Add a new entry.
void add (const entry &, bool mergeEntry=false)
 Add an entry.
void add (const word &keyword, const word &, bool overwrite=false)
 Add a word entry.
void add (const word &keyword, const string &, bool overwrite=false)
 Add a string entry.
void add (const word &keyword, const label, bool overwrite=false)
 Add a label entry.
void add (const word &keyword, const scalar, bool overwrite=false)
 Add a scalar entry.
void add (const word &keyword, const dictionary &, bool mergeEntry=false)
 Add a dictionary entry.
template<class T>
void add (const word &keyword, const T &, bool overwrite=false)
 Add a T entry.
void set (entry *)
 Assign a new entry, overwrite any existing entry.
void set (const entry &)
 Assign a new entry, overwrite any existing entry.
void set (const word &keyword, const dictionary &)
 Assign a dictionary entry, overwrite any existing entry.
template<class T>
void set (const word &keyword, const T &)
 Assign a T entry, overwrite any existing entry.
bool remove (const word &keyword)
 Remove an entry specified by keyword.
bool changeKeyword (const word &oldKeyword, const word &newKeyword, bool forceOverwrite=false)
 Change the keyword for an entry,.
bool merge (const dictionary &)
 Merge entries from the given dictionary.
void clear ()
 Clear the dictionary.
void write (Ostream &os, bool subDict=true) const
ITstreamoperator[] (const word &) const
 Find and return entry.
void operator= (const dictionary &)
void operator+= (const dictionary &)
 Include entries from the given dictionary.
void operator|= (const dictionary &)
 Conditionally include entries from the given dictionary.
void operator<<= (const dictionary &)
 Unconditionally include entries from the given dictionary.

Static Public Member Functions

static Foam::autoPtr< dictionaryNew (Istream &is)
 Construct top-level dictionary on freestore from Istream.

Static Public Attributes

static const dictionary null
 Null dictionary.

Friends

class entry
 Declare friendship with the entry class for IO.
Istreamoperator>> (Istream &, dictionary &)
 Read dictionary from Istream.
Ostreamoperator<< (Ostream &, const dictionary &)
 Write dictionary to Ostream.

Constructor & Destructor Documentation

dictionary (  ) 

Construct top-level dictionary null.

Definition at line 30 of file dictionary.C.

Referenced by Foam::operator>>(), and dictionary::~dictionary().

Here is the caller graph for this function:

dictionary ( const dictionary parentDict,
Istream  
)

Construct from the parent dictionary and Istream, reading entries.

until lastEntry or EOF

Definition at line 92 of file dictionaryIO.C.

dictionary ( Istream  ) 

Construct top-level dictionary from Istream, reading entries.

until EOF

Definition at line 104 of file dictionaryIO.C.

References dictionary::read().

Here is the call graph for this function:

dictionary ( const dictionary parentDict,
const dictionary dict 
)

Construct as copy given the parent dictionary.

Definition at line 37 of file dictionary.C.

dictionary ( const dictionary dict  ) 

Construct top-level dictionary as copy.

Definition at line 59 of file dictionary.C.

~dictionary (  ) 

Definition at line 87 of file dictionary.C.

References dictionary::dictionary().

Here is the call graph for this function:


Member Function Documentation

bool read ( Istream  ) 

Read dictionary from Istream.

Definition at line 24 of file dictionaryIO.C.

References IOstream::bad(), token::BEGIN_BLOCK, IOstream::eof(), Foam::exit(), Foam::FatalIOError, FatalIOErrorIn, IOstream::good(), Foam::Info, dictionary::name(), entry::New(), Istream::putBack(), and dictionary::remove().

Referenced by dictionary::dictionary().

Here is the call graph for this function:

Here is the caller graph for this function:

bool substituteKeyword ( const word keyword  ) 

Substitute the given keyword prepended by '$' with the.

corresponding sub-dictionary entries

Definition at line 60 of file dictionaryIO.C.

ClassName ( "dictionary"   ) 

Foam::autoPtr< Foam::dictionary > clone (  )  const

Construct and return clone.

Definition at line 79 of file dictionary.C.

Referenced by Foam::operator+(), dictionary::operator<<=(), and dictionary::operator|=().

Here is the caller graph for this function:

Foam::autoPtr< Foam::dictionary > New ( Istream is  )  [static]

Construct top-level dictionary on freestore from Istream.

Definition at line 116 of file dictionaryIO.C.

References inputModeEntry::clear().

Here is the call graph for this function:

const fileName& name (  )  const [inline]

Return the dictionary name.

Reimplemented in fvMesh, dictionaryEntry, IOdictionary, and IOOutputFilter.

Definition at line 152 of file dictionary.H.

Referenced by dictionary::read(), and IOobject::readHeader().

Here is the caller graph for this function:

fileName& name (  )  [inline]

Return the dictionary name.

Reimplemented in dictionaryEntry.

Definition at line 158 of file dictionary.H.

const dictionary& parent (  )  const [inline]

Return the parent dictionary.

Definition at line 164 of file dictionary.H.

Foam::label startLineNumber (  )  const

Return line number of first token in dictionary.

Definition at line 95 of file dictionary.C.

Foam::label endLineNumber (  )  const

Return line number of last token in dictionary.

Definition at line 108 of file dictionary.C.

const Foam::entry * lookupEntryPtr ( const word ,
bool  recursive = false 
) const

Find and return an entry data stream pointer if present.

otherwise return NULL. If recursive search parent dictionaries

Definition at line 139 of file dictionary.C.

Referenced by dictionary::lookupOrDefault().

Here is the caller graph for this function:

Foam::entry * lookupEntryPtr ( const word ,
bool  recursive = false 
)

Find and return an entry data stream pointer for manipulation.

if present otherwise return NULL. If recursive search parent dictionaries

Definition at line 163 of file dictionary.C.

const Foam::entry & lookupEntry ( const word ,
bool  recursive = false 
) const

Find and return an entry data stream if present otherwise error.

If recursive search parent dictionaries

Definition at line 191 of file dictionary.C.

Foam::ITstream & lookup ( const word ,
bool  recursive = false 
) const

Find and return an entry data stream.

If recursive search parent dictionaries

Definition at line 214 of file dictionary.C.

Referenced by angularOscillatingDisplacementPointPatchVectorField::angularOscillatingDisplacementPointPatchVectorField(), angularOscillatingVelocityPointPatchVectorField::angularOscillatingVelocityPointPatchVectorField(), autoHexMeshDriver::autoHexMeshDriver(), cubeRootVolDelta::correct(), LESModel::correct(), dictionaryEntry::dict(), Foam::dimensionedConstant(), flowRateInletVelocityFvPatchVectorField::flowRateInletVelocityFvPatchVectorField(), fluxCorrectedVelocityFvPatchVectorField::fluxCorrectedVelocityFvPatchVectorField(), lduMatrix::H(), ignition::ignition(), liquidMixture::liquidMixture(), multivariateSelectionScheme::multivariateSelectionScheme(), LESfilter::New(), LESdelta::New(), viscosityModel::New(), scatterModel::New(), absorptionEmissionModel::New(), pdf::New(), laminarFlameSpeed::New(), chemistrySolver::New(), barotropicCompressibilityModel::New(), pointZone::New(), faceZone::New(), cellZone::New(), tetherPotential::New(), pairPotential::New(), energyScalingFunction::New(), HeatTransferModel::New(), SurfaceReactionModel::New(), MassTransferModel::New(), CompositionModel::New(), WallInteractionModel::New(), InjectionModel::New(), DragModel::New(), DispersionModel::New(), DataEntry::New(), IntegrationScheme::New(), wallModel::New(), injectorModel::New(), heatTransferModel::New(), evaporationModel::New(), dragModel::New(), dispersionModel::New(), collisionModel::New(), breakupModel::New(), atomizationModel::New(), engineMesh::New(), polyMeshModifier::New(), solidBodyMotionFunction::New(), dynamicFvMesh::New(), dlLibraryTable::open(), laplaceFilter::operator()(), anisotropicFilter::operator()(), dictionary::operator=(), oscillatingVelocityPointPatchVectorField::oscillatingVelocityPointPatchVectorField(), patchIdentifier::patchIdentifier(), pressureInletVelocityFvPatchVectorField::pressureInletVelocityFvPatchVectorField(), Time::readDict(), DimensionedField::readField(), refinementSurfaces::refinementSurfaces(), searchableSurfaces::searchableSurfaces(), Foam::setRefCell(), tolerances::solverRelativeTolerance(), tolerances::solverRelativeTolerances(), fvMotionSolverEngineMesh::~fvMotionSolverEngineMesh(), laminarFlameSpeed::~laminarFlameSpeed(), layeredEngineMesh::~layeredEngineMesh(), and sampledSurface::~sampledSurface().

Here is the caller graph for this function:

T lookupOrDefault ( const word ,
const T &  ,
bool  recursive = false 
) const

Find and return a T,.

if not found return the given default value If recursive search parent dictionaries

Definition at line 25 of file dictionaryTemplates.C.

References dictionary::lookupEntryPtr().

Referenced by sampledPatch::~sampledPatch().

Here is the call graph for this function:

Here is the caller graph for this function:

T lookupOrAddDefault ( const word ,
const T &  ,
bool  recursive = false 
)

Find and return a T, if not found return the given.

default value, and add to dictionary. If recursive search parent dictionaries

Definition at line 46 of file dictionaryTemplates.C.

References entry::stream().

Referenced by Switch::lookupOrAddToDict().

Here is the call graph for this function:

Here is the caller graph for this function:

bool readIfPresent ( const word ,
T &  ,
bool  recursive = false 
) const

Find an entry if present, and assign to T.

Returns true if the entry was found

Definition at line 68 of file dictionaryTemplates.C.

Referenced by dimensioned::operator[]().

Here is the caller graph for this function:

bool isDict ( const word  )  const

Check if entry is a sub-dictionary.

Definition at line 223 of file dictionary.C.

Referenced by searchableSurfaces::searchableSurfaces().

Here is the caller graph for this function:

const Foam::dictionary * subDictPtr ( const word  )  const

Find and return a sub-dictionary pointer if present.

otherwise return NULL.

Definition at line 238 of file dictionary.C.

Referenced by liquidMixture::liquidMixture().

Here is the caller graph for this function:

const Foam::dictionary & subDict ( const word  )  const

Find and return a sub-dictionary.

Definition at line 253 of file dictionary.C.

Referenced by smoothDelta::correct(), cubeRootVolDelta::correct(), anisotropicFilter::operator()(), laplaceFilter::operator()(), Foam::preservePatchTypes(), and searchableSurfaces::searchableSurfaces().

Here is the caller graph for this function:

Foam::dictionary & subDict ( const word  ) 

Find and return a sub-dictionary for manipulation.

Definition at line 270 of file dictionary.C.

Foam::wordList toc (  )  const

Return the table of contents.

Definition at line 287 of file dictionary.C.

bool add ( entry ,
bool  mergeEntry = false 
)

Add a new entry.

With the merge option, dictionaries are interwoven and primitive entries are overwritten

Definition at line 306 of file dictionary.C.

Referenced by dictionary::add(), autoHexMeshDriver::autoHexMeshDriver(), Foam::dimensionedConstant(), dictionary::operator<<=(), dictionary::operator|=(), Foam::preservePatchTypes(), and dictionary::set().

Here is the caller graph for this function:

void add ( const entry ,
bool  mergeEntry = false 
)

Add an entry.

With the merge option, dictionaries are interwoven and primitive entries are overwritten

Definition at line 365 of file dictionary.C.

void add ( const word keyword,
const word ,
bool  overwrite = false 
)

Add a word entry.

optionally overwrite an existing entry

Definition at line 370 of file dictionary.C.

void add ( const word keyword,
const string ,
bool  overwrite = false 
)

Add a string entry.

optionally overwrite an existing entry

Definition at line 375 of file dictionary.C.

References dictionary::add().

Here is the call graph for this function:

void add ( const word keyword,
const   label,
bool  overwrite = false 
)

Add a label entry.

optionally overwrite an existing entry

Definition at line 380 of file dictionary.C.

References dictionary::add().

Here is the call graph for this function:

void add ( const word keyword,
const   scalar,
bool  overwrite = false 
)

Add a scalar entry.

optionally overwrite an existing entry

Definition at line 385 of file dictionary.C.

References dictionary::add().

Here is the call graph for this function:

void add ( const word keyword,
const dictionary ,
bool  mergeEntry = false 
)

Add a dictionary entry.

optionally merge with an existing sub-dictionary

Definition at line 390 of file dictionary.C.

References dictionary::add().

Here is the call graph for this function:

void add ( const word keyword,
const T &  ,
bool  overwrite = false 
)

Add a T entry.

optionally overwrite an existing entry

Definition at line 89 of file dictionaryTemplates.C.

void set ( entry  ) 

Assign a new entry, overwrite any existing entry.

Definition at line 396 of file dictionary.C.

Referenced by Foam::operator+().

Here is the caller graph for this function:

void set ( const entry  ) 

Assign a new entry, overwrite any existing entry.

Definition at line 409 of file dictionary.C.

void set ( const word keyword,
const dictionary  
)

Assign a dictionary entry, overwrite any existing entry.

Definition at line 414 of file dictionary.C.

void set ( const word keyword,
const T &   
)

Assign a T entry, overwrite any existing entry.

Definition at line 96 of file dictionaryTemplates.C.

References dictionary::add().

Here is the call graph for this function:

bool remove ( const word keyword  ) 

Remove an entry specified by keyword.

Definition at line 420 of file dictionary.C.

Referenced by autoHexMeshDriver::autoHexMeshDriver(), and dictionary::read().

Here is the caller graph for this function:

bool changeKeyword ( const word oldKeyword,
const word newKeyword,
bool  forceOverwrite = false 
)

Change the keyword for an entry,.

optionally forcing overwrite of an existing entry

Definition at line 440 of file dictionary.C.

bool merge ( const dictionary  ) 

Merge entries from the given dictionary.

Also merge sub-dictionaries as required.

Definition at line 491 of file dictionary.C.

void clear (  ) 

Clear the dictionary.

Reimplemented from ILList.

Definition at line 543 of file dictionary.C.

void write ( Ostream os,
bool  subDict = true 
) const

Definition at line 139 of file dictionaryIO.C.

Referenced by Foam::operator<<().

Here is the caller graph for this function:

Foam::ITstream & operator[] ( const word  )  const

Find and return entry.

Definition at line 552 of file dictionary.C.

void operator= ( const dictionary  ) 

Definition at line 558 of file dictionary.C.

References dictionary::lookup().

Here is the call graph for this function:

void operator+= ( const dictionary  ) 

Include entries from the given dictionary.

Warn, but do not overwrite existing entries

Definition at line 595 of file dictionary.C.

void operator|= ( const dictionary  ) 

Conditionally include entries from the given dictionary.

Do not overwrite existing entries.

Definition at line 617 of file dictionary.C.

References dictionary::add(), and dictionary::clone().

Here is the call graph for this function:

void operator<<= ( const dictionary  ) 

Unconditionally include entries from the given dictionary.

Overwrite existing entries.

Definition at line 642 of file dictionary.C.

References dictionary::add(), dictionary::clone(), and dictionary::found().

Here is the call graph for this function:


Friends And Related Function Documentation

friend class entry [friend]

Declare friendship with the entry class for IO.

Definition at line 99 of file dictionary.H.

Istream& operator>> ( Istream is,
dictionary dict 
) [friend]

Read dictionary from Istream.

Definition at line 124 of file dictionaryIO.C.

Ostream& operator<< ( Ostream os,
const dictionary dict 
) [friend]

Write dictionary to Ostream.

Definition at line 173 of file dictionaryIO.C.


Member Data Documentation


The documentation for this class was generated from the following files: Copyright © 2000-2008 OpenCFD Ltd