Handle for a Block object.
The BlockHandle class is a simple wrapper for a pointer to a Block object that facilitates the handling of a Block pointer. The class is used transparently in the Blocks container type.
#include <Config.h>
Public Member Functions | |
BlockHandle () | |
Default constructor for a block handle. More... | |
BlockHandle (const Block *block) | |
template<typename Type > | |
Config::Parameter< Type > | getParameter (const std::string &key) const |
template<typename T > | |
Config::Parameter< T > | getParameter (const std::string &key, const T &def) const |
Get functions | |
const std::string & | getKey () const |
Returns the key of the block. More... | |
bool | isDefined (std::string key) const |
Checks if a parameter was defined in the parameter file. More... | |
template<typename T > | |
Parameter< T > | getParameter (const std::string &key) const |
Returns an extracted parameter. More... | |
template<typename T > | |
Parameter< T > | getParameter (const std::string &key, const T &def) const |
Returns an extracted parameter. More... | |
bool | isValid () const |
operator bool () const | |
const_iterator | begin () const |
Returns an iterator to the first parameter of the block. More... | |
const_iterator | end () const |
Returns an iterator one past the last parameter of the block. More... | |
size_type | getNumBlocks () const |
Returns the number of contained parameter blocks. More... | |
size_type | getNumBlocks (const std::string &key) const |
Returns the number of contained parameter blocks corresponding to given key. More... | |
BlockHandle | getOneBlock (const std::string &key) const |
BlockHandle | getBlock (const std::string &key) const |
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 . More... | |
void | getBlocks (Blocks &blocks) const |
Adds to the given blocks all blocks inside the handles block. More... | |
Block | cloneBlock () const |
Creates a copy of the bound block. More... | |
Utility functions | |
const Block * | block_ |
Pointer to a const parameter block. More... | |
void | listParameters () const |
Output function for the contained parameters. More... | |
|
inline |
Default constructor for a block handle.
Note: The BlockHandle object is uninitialized. Any access to the bound block will result in an error until the BlockHandle object is bound to a block.
|
inline |
|
inline |
Returns an iterator to the first parameter of the block.
|
inline |
Creates a copy of the bound block.
|
inline |
Returns an iterator one past the last parameter of the block.
|
inline |
|
inline |
Adds to the given blocks
all blocks inside the handles block.
[out] | blocks | Reference to the vector of blocks |
|
inline |
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.
|
inline |
Returns the number of contained parameter blocks corresponding to given key.
key | The key of the blocks to count. |
|
inline |
|
inline |
Returns an extracted parameter.
key | The key of the extracted parameter. |
|
inline |
|
inline |
Returns an extracted parameter.
key | The key of the extracted parameter. |
def | default value, used if key is not defined |
|
inline |
|
inline |
Checks if a parameter was defined in the parameter file.
key | The parameter key to be checked. |
|
inline |
|
inline |
Output function for the contained parameters.
|
inline |
|
private |
Pointer to a const parameter block.