NamedEnum< Enum, nEnum > Class Template Reference

Initialise the NamedEnum HashTable from the static list of names. More...

Inheritance diagram for NamedEnum< Enum, nEnum >:
Collaboration diagram for NamedEnum< Enum, nEnum >:

Public Types

typedef FixedList< word, nEnum > namesType
 
- Public Types inherited from FixedList< word, nEnum >
typedef word value_type
 Type of values the FixedList contains. More...
 
typedef wordreference
 Type that can be used for storing into. More...
 
typedef const wordconst_reference
 Type that can be used for storing into. More...
 
typedef label difference_type
 The type that can represent the difference between any two. More...
 
typedef label size_type
 The type that can represent the size of a FixedList. More...
 
typedef worditerator
 Random access iterator for traversing FixedList. More...
 
typedef const wordconst_iterator
 Random access iterator for traversing FixedList. More...
 
typedef std::reverse_iterator< iteratorreverse_iterator
 Reverse iterator for reverse traversal of FixedList. More...
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 Reverse iterator for reverse traversal of constant FixedList. More...
 

Public Member Functions

 NamedEnum (const FixedList< word, nEnum > &names)
 Construct from list of names. More...
 
 NamedEnum (std::initializer_list< word >)
 Construct from list of names. More...
 
 NamedEnum (const NamedEnum &)=delete
 Disallow default bitwise copy construction. More...
 
Enum read (Istream &) const
 Read a word from Istream and return the corresponding. More...
 
Enum lookupOrDefault (const word &name, const dictionary &dict, const Enum defaultValue) const
 Lookup the name from the dictionary if present and return the. More...
 
Enum select (const dictionary &dict) const
 Select the name from the dictionary and return the. More...
 
void write (const Enum e, Ostream &) const
 Write the name representation of the enumeration to an Ostream. More...
 
const Enum operator[] (const char *name) const
 Return the enumeration element corresponding to the given name. More...
 
const Enum operator[] (const word &name) const
 Return the enumeration element corresponding to the given name. More...
 
const wordoperator[] (const Enum e) const
 Return the name of the given enumeration element. More...
 
void operator= (const NamedEnum &)=delete
 Disallow default bitwise assignment. More...
 
- Public Member Functions inherited from FixedList< word, nEnum >
 FixedList ()
 Null constructor. More...
 
 FixedList (const word &)
 Construct from value. More...
 
 FixedList (const word v[Size])
 Construct from C-array. More...
 
 FixedList (InputIterator first, InputIterator last)
 Construct given start and end iterators. More...
 
 FixedList (std::initializer_list< word >)
 Construct from an initialiser list. More...
 
 FixedList (const UList< word > &)
 Construct from UList. More...
 
 FixedList (const SLList< word > &)
 Construct from SLList. More...
 
 FixedList (Istream &)
 Construct from Istream. More...
 
autoPtr< FixedList< word, Size > > clone () const
 Clone. More...
 
label fcIndex (const label i) const
 Return the forward circular index, i.e. the next index. More...
 
label rcIndex (const label i) const
 Return the reverse circular index, i.e. the previous index. More...
 
const wordcdata () const
 Return a const pointer to the first data element,. More...
 
worddata ()
 Return a pointer to the first data element,. More...
 
wordfirst ()
 Return the first element of the list. More...
 
const wordfirst () const
 Return first element of the list. More...
 
wordlast ()
 Return the last element of the list. More...
 
const wordlast () const
 Return the last element of the list. More...
 
void checkStart (const label start) const
 Check start is within valid range (0 ... size-1) More...
 
void checkSize (const label size) const
 Check size is within valid range (0 ... size) More...
 
void checkIndex (const label i) const
 Check index i is within valid range (0 ... size-1) More...
 
void resize (const label)
 Dummy resize function. More...
 
void setSize (const label)
 Dummy setSize function. More...
 
void transfer (const FixedList< word, Size > &)
 Copy (not transfer) the argument contents. More...
 
wordoperator[] (const label)
 Return element of FixedList. More...
 
const wordoperator[] (const label) const
 Return element of constant FixedList. More...
 
void operator= (const word v[Size])
 Assignment to array operator. Takes linear time. More...
 
void operator= (const UList< word > &)
 Assignment to UList operator. Takes linear time. More...
 
void operator= (const SLList< word > &)
 Assignment to SLList operator. Takes linear time. More...
 
void operator= (std::initializer_list< word >)
 Assignment to an initialiser list. Takes linear time. More...
 
void operator= (const word &)
 Assignment of all entries to the given value. More...
 
iterator begin ()
 Return an iterator to begin traversing the FixedList. More...
 
const_iterator begin () const
 Return const_iterator to begin traversing the constant FixedList. More...
 
iterator end ()
 Return an iterator to end traversing the FixedList. More...
 
const_iterator end () const
 Return const_iterator to end traversing the constant FixedList. More...
 
const_iterator cbegin () const
 Return const_iterator to begin traversing the constant FixedList. More...
 
const_iterator cend () const
 Return const_iterator to end traversing the constant FixedList. More...
 
reverse_iterator rbegin ()
 Return reverse_iterator to begin reverse traversing the FixedList. More...
 
const_reverse_iterator rbegin () const
 Return const_reverse_iterator to begin reverse traversing FixedList. More...
 
reverse_iterator rend ()
 Return reverse_iterator to end reverse traversing the FixedList. More...
 
const_reverse_iterator rend () const
 Return const_reverse_iterator to end reverse traversing FixedList. More...
 
const_reverse_iterator crbegin () const
 Return const_reverse_iterator to begin reverse traversing FixedList. More...
 
const_reverse_iterator crend () const
 Return const_reverse_iterator to end reverse traversing FixedList. More...
 
label size () const
 Return the number of elements in the FixedList. More...
 
label max_size () const
 Return size of the largest possible FixedList. More...
 
bool empty () const
 Return true if the FixedList is empty (ie, size() is zero) More...
 
void swap (FixedList< word, Size > &)
 Swap two FixedLists of the same type in constant time. More...
 
bool operator== (const FixedList< word, Size > &) const
 Equality operation on FixedLists of the same type. More...
 
bool operator!= (const FixedList< word, Size > &) const
 The opposite of the equality operation. Takes linear time. More...
 
bool operator< (const FixedList< word, Size > &) const
 Compare two FixedLists lexicographically. Takes linear time. More...
 
bool operator> (const FixedList< word, Size > &) const
 Compare two FixedLists lexicographically. Takes linear time. More...
 
bool operator<= (const FixedList< word, Size > &) const
 Return true if !(a > b). Takes linear time. More...
 
bool operator>= (const FixedList< word, Size > &) const
 Return true if !(a < b). Takes linear time. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from FixedList< word, nEnum >
static const FixedList< word, Size > & null ()
 Return a null FixedList. More...
 

Detailed Description

template<class Enum, unsigned int nEnum>
class Foam::NamedEnum< Enum, nEnum >

Initialise the NamedEnum HashTable from the static list of names.

Source files

Definition at line 52 of file NamedEnum.H.

Member Typedef Documentation

◆ namesType

typedef FixedList<word, nEnum> namesType

Definition at line 64 of file NamedEnum.H.

Constructor & Destructor Documentation

◆ NamedEnum() [1/3]

NamedEnum ( const FixedList< word, nEnum > &  names)

Construct from list of names.

Definition at line 32 of file NamedEnum.C.

References forAll, and HashTable< T, Key, Hash >::insert().

Here is the call graph for this function:

◆ NamedEnum() [2/3]

NamedEnum ( std::initializer_list< word lst)

Construct from list of names.

Definition at line 45 of file NamedEnum.C.

◆ NamedEnum() [3/3]

NamedEnum ( const NamedEnum< Enum, nEnum > &  )
delete

Disallow default bitwise copy construction.

Member Function Documentation

◆ read()

Enum read ( Istream is) const

Read a word from Istream and return the corresponding.

enumeration element

Definition at line 54 of file NamedEnum.C.

References Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, HashTable< T, Key, Hash >::find(), and Foam::name().

Referenced by phaseScalarTransport::read(), Time::readDict(), mappedInternalPatchBase::readOffsetMode(), and refinementRegions::refinementRegions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lookupOrDefault()

Enum lookupOrDefault ( const word name,
const dictionary dict,
const Enum  defaultValue 
) const

Lookup the name from the dictionary if present and return the.

corresponding enumeration element, otherwise return the defaultValue

Definition at line 72 of file NamedEnum.C.

References dict, dictionary::found(), dictionary::lookup(), Foam::name(), and Foam::read().

Here is the call graph for this function:

◆ select()

Enum select ( const dictionary dict) const

Select the name from the dictionary and return the.

corresponding enumeration element. If more than one of the options is present in the dictionary generate a FatalError

Definition at line 86 of file NamedEnum.C.

◆ write()

void write ( const Enum  e,
Ostream os 
) const

Write the name representation of the enumeration to an Ostream.

Definition at line 119 of file NamedEnum.C.

References Foam::e.

◆ operator[]() [1/3]

const Enum operator[] ( const char *  name) const
inline

Return the enumeration element corresponding to the given name.

Definition at line 106 of file NamedEnum.H.

References Foam::name().

Here is the call graph for this function:

◆ operator[]() [2/3]

const Enum operator[] ( const word name) const
inline

Return the enumeration element corresponding to the given name.

Definition at line 112 of file NamedEnum.H.

References Foam::name().

Here is the call graph for this function:

◆ operator[]() [3/3]

const word& operator[] ( const Enum  e) const
inline

Return the name of the given enumeration element.

Definition at line 118 of file NamedEnum.H.

References Foam::e, and FixedList< T, Size >::operator[]().

Here is the call graph for this function:

◆ operator=()

void operator= ( const NamedEnum< Enum, nEnum > &  )
delete

Disallow default bitwise assignment.


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