|
waLBerla 7.2
|
Parameter block.
A parameter block contains all parameters of one section of the input parameter file. A single parameter block can again contain other parameter blocks.
#include <Config.h>
Public Member Functions | |
| Block (const std::string &key="") | |
| Standard constructor for the Block class. | |
| Block (const Block &b)=default | |
| ~Block () | |
| Default destructor of the Block class. | |
| template<typename Type > | |
| Config::Parameter< Type > | getParameter (std::string key) const |
| template<typename T > | |
| Config::Parameter< T > | getParameter (const std::string &key, const T &def) const |
| template<> | |
| Config::Parameter< bool > | getParameter (std::string key) const |
Operators | |
| Block & | operator= (const Block &b) |
| The copy assignment operator for the Block class. | |
| std::string & | operator[] (std::string key) |
| Returns a reference to the value of the specified key. | |
Get functions | |
| const std::string & | getKey () const |
| Returns the key of the block. | |
| bool | isDefined (std::string key) const |
| Checks if a parameter was defined in the parameter file. | |
| template<typename T > | |
| Parameter< T > | getParameter (std::string key) const |
| Returns an extracted parameter. | |
| template<typename T > | |
| Parameter< T > | getParameter (const std::string &key, const T &def) const |
| Returns an extracted parameter. | |
| bool | setParameter (const std::string &key, const std::string &value) |
| Sets a given parameter to a given value. | |
| void | setOrAddParameter (const std::string &key, const std::string &value) |
| Sets a given parameter to a given value (adds the parameter if it does not yet exist). | |
| iterator | begin () |
| Returns an iterator to the first parameter of the block. | |
| const_iterator | begin () const |
| Returns an iterator to the first parameter of the block. | |
| iterator | end () |
| Returns an iterator one past the last parameter of the block. | |
| const_iterator | end () const |
| Returns an iterator one past the last parameter of the block. | |
| size_type | getNumBlocks () const |
| Returns the number of contained parameter blocks. | |
| size_type | getNumBlocks (const std::string &key) const |
| Returns the number of contained parameter blocks corresponding to given key. | |
| BlockHandle | getBlock (const std::string &key) const |
Returns one or none block that matches with key. | |
| BlockHandle | getOneBlock (const std::string &key) const |
Returns exactly one block that matches with key. | |
| void | getBlocks (const std::string &key, Blocks &blocks, size_t min=0, size_t max=std::numeric_limits< size_t >::max()) const |
Adds to the given blocks all extracted blocks with key key. | |
| void | getBlocks (Blocks &blocks) const |
Adds to the given blocks all blocks contained in this block. | |
| void | getWritableBlocks (std::vector< Block * > &blocks) |
Adds to the given blocks all blocks contained in this block. | |
| void | getWritableBlocks (const std::string &key, std::vector< Block * > &blocks, size_t min=0, size_t max=std::numeric_limits< size_t >::max()) |
Adds to the given blocks all extracted blocks with key key. | |
Private Attributes | |
Member variables | |
| Key | key_ |
| Key of the block. | |
| List | blocks_ |
| List of contained blocks. | |
| Map | params_ |
| The parameters of the block. | |
Friends | |
| class | Config |
Utility functions | |
| bool | addParameter (const std::string &key, const std::string &value) |
| Adding a parameter to a parameter block. | |
| void | listParameters () const |
| Output function for the contained parameters. | |
| Block & | createBlock (const std::string &key) |
| Adding a new block within the parameter block. | |
| std::string | getString () const |
| Returns Config-internal string to use for communication. | |
| walberla::config::Config::Block::Block | ( | const std::string & | key = "" | ) |
Standard constructor for the Block class.
| key | The key of the block (default argument = ""). |
|
default |
|
default |
Default destructor of the Block class.
| bool walberla::config::Config::Block::addParameter | ( | const std::string & | key, |
| const std::string & | value ) |
Adding a parameter to a parameter block.
| key | The key of the new parameter. |
| value | The value of the new parameter. |
|
inline |
Returns an iterator to the first parameter of the block.
|
inline |
Returns an iterator to the first parameter of the block.
| Config::Block & walberla::config::Config::Block::createBlock | ( | const std::string & | key | ) |
Adding a new block within the parameter block.
| key | The key of the new block. |
|
inline |
Returns an iterator one past the last parameter of the block.
|
inline |
Returns an iterator one past the last parameter of the block.
| Config::BlockHandle walberla::config::Config::Block::getBlock | ( | const std::string & | key | ) | const |
Returns one or none block that matches with key.
| key | The key of the extracted block. |
key. | void walberla::config::Config::Block::getBlocks | ( | Blocks & | blocks | ) | const |
Adds to the given blocks all blocks contained in this block.
| [out] | blocks | Reference to the vector of blocks |
| void walberla::config::Config::Block::getBlocks | ( | const std::string & | key, |
| Blocks & | blocks, | ||
| size_t | min = 0, | ||
| size_t | max = std::numeric_limits< size_t >::max() ) const |
Adds to the given blocks all extracted blocks with key key.
| key | The key of the extracted blocks. | |
| [out] | blocks | Reference to the vector of blocks |
| min | minimum number of blocks the caller expects | |
| max | maximum number of blocks the caller can handle |
|
inline |
Returns the key of the block.
|
inline |
Returns the number of contained parameter blocks.
| Config::size_type walberla::config::Config::Block::getNumBlocks | ( | const std::string & | key | ) | const |
Returns the number of contained parameter blocks corresponding to given key.
| key | The key of the blocks to count. |
| Config::BlockHandle walberla::config::Config::Block::getOneBlock | ( | const std::string & | key | ) | const |
Returns exactly one block that matches with key.
| key | The key of the extracted block. |
key.
|
inline |
Returns an extracted parameter.
| key | The key of the extracted parameter. |
| def | The default value, if the key does not exist |
|
inline |
|
inline |
Returns an extracted parameter.
Returns an extracted unsigned integer parameter.
Returns an extracted bool parameter.
Returns an extracted string parameter.
| key | The key of the parameter. |
| key | The key of the string parameter. |
| key | The key of the bool parameter. |
| key | The key of the unsigned integer parameter. |
|
inline |
|
inline |
|
private |
Returns Config-internal string to use for communication.
| void walberla::config::Config::Block::getWritableBlocks | ( | const std::string & | key, |
| std::vector< Block * > & | blocks, | ||
| size_t | min = 0, | ||
| size_t | max = std::numeric_limits< size_t >::max() ) |
Adds to the given blocks all extracted blocks with key key.
| key | The key of the extracted blocks. | |
| [out] | blocks | Reference to the vector of blocks |
| min | minimum number of blocks the caller expects | |
| max | maximum number of blocks the caller can handle |
| void walberla::config::Config::Block::getWritableBlocks | ( | std::vector< Block * > & | blocks | ) |
Adds to the given blocks all blocks contained in this block.
| [out] | blocks | Reference to the vector of blocks |
|
inline |
Checks if a parameter was defined in the parameter file.
| void walberla::config::Config::Block::listParameters | ( | ) | const |
Output function for the contained parameters.
| Config::Block & walberla::config::Config::Block::operator= | ( | const Block & | b | ) |
|
inline |
Returns a reference to the value of the specified key.
| key | The key of the parameter. |
If the key has not been defined before, a new parameter is added. The return value is a reference to the value of the (new) key.
|
inline |
Sets a given parameter to a given value (adds the parameter if it does not yet exist).
| key | The key of the parameter. |
| value | The value of the parameter. |
|
inline |
Sets a given parameter to a given value.
| key | The key of the parameter. |
| value | The value of the parameter. |
|
friend |
|
private |
List of contained blocks.
|
private |
Key of the block.
|
private |
The parameters of the block.