Ginkgo
Generated from pipelines/1589998975 branch based on develop. Ginkgo version 1.10.0
A numerical linear algebra library targeting many-core architectures
|
pnode describes a tree of properties. More...
#include <ginkgo/core/config/property_tree.hpp>
Public Types | |
enum | tag_t { empty, array, boolean, real, integer, string, map } |
tag_t is the indicator for the current node storage. | |
using | key_type = std::string |
using | map_type = std::map< key_type, pnode > |
using | array_type = std::vector< pnode > |
Public Member Functions | |
pnode () | |
Default constructor: create an empty node. | |
pnode (bool boolean) | |
Constructor for bool. More... | |
template<typename T , std::enable_if_t< std::is_integral< T >::value > * = nullptr> | |
pnode (T integer) | |
Constructor for integer with all integer type. More... | |
pnode (const std::string &str) | |
Constructor for string. More... | |
pnode (const char *str) | |
Constructor for char* (otherwise, it will use bool) More... | |
pnode (double real) | |
Constructor for double (and also float) More... | |
pnode (const array_type &array) | |
Constructor for array. More... | |
pnode (const map_type &map) | |
Constructor for map. More... | |
operator bool () const noexcept | |
bool conversion. More... | |
tag_t | get_tag () const |
Get the current node tag. More... | |
const array_type & | get_array () const |
Access the array stored in this property node. More... | |
const map_type & | get_map () const |
Access the map stored in this property node. More... | |
bool | get_boolean () const |
Access the boolean value stored in this property node. More... | |
std::int64_t | get_integer () const |
double | get_real () const |
Access the real floating point value stored in this property node. More... | |
const std::string & | get_string () const |
Access the string stored in this property node. More... | |
const pnode & | get (const std::string &key) const |
This function is to access the data under the map. More... | |
const pnode & | get (int index) const |
This function is to access the data under the array. More... | |
pnode describes a tree of properties.
A pnode can either be empty, hold a value (a string, integer, real, or bool), contain an array of pnode., or contain a mapping between strings and pnodes.
|
explicit |
Constructor for bool.
boolean | the bool type value |
|
explicit |
Constructor for integer with all integer type.
T | input type |
integer | the integer type value |
|
explicit |
Constructor for string.
str | string type value |
|
explicit |
Constructor for char* (otherwise, it will use bool)
str | the string like "..." |
|
explicit |
Constructor for double (and also float)
real | the floating point type value |
|
explicit |
Constructor for array.
array | an pnode array |
|
explicit |
Constructor for map.
map | a (string, pnode)-map |
const pnode& gko::config::pnode::get | ( | const std::string & | key | ) | const |
This function is to access the data under the map.
It will throw error when it does not hold a map. When access non-existent key in the map, it will return an empty node.
key | the key for the node of the map |
const pnode& gko::config::pnode::get | ( | int | index | ) | const |
This function is to access the data under the array.
It will throw error when it does not hold an array or access out-of-bound index.
index | the node index in array |
const array_type& gko::config::pnode::get_array | ( | ) | const |
Access the array stored in this property node.
Throws gko::InvalidStateError
if the property node does not store an array.
bool gko::config::pnode::get_boolean | ( | ) | const |
Access the boolean value stored in this property node.
Throws gko::InvalidStateError
if the property node does not store a boolean value.
std::int64_t gko::config::pnode::get_integer | ( | ) | const |
gko::InvalidStateError
if the property node does not store an integer value.const map_type& gko::config::pnode::get_map | ( | ) | const |
Access the map stored in this property node.
Throws gko::InvalidStateError
if the property node does not store a map.
double gko::config::pnode::get_real | ( | ) | const |
Access the real floating point value stored in this property node.
Throws gko::InvalidStateError
if the property node does not store a real value
const std::string& gko::config::pnode::get_string | ( | ) | const |
Access the string stored in this property node.
Throws gko::InvalidStateError
if the property node does not store a string.
tag_t gko::config::pnode::get_tag | ( | ) | const |
Get the current node tag.
|
explicitnoexcept |
bool conversion.
It's true if and only if it is not empty.