Variant datatype supporting at least all formats for attributes specified in the openPMD standard.
More...
#include <Attribute.hpp>
|
|
| Attribute (resource r) |
| |
| template<typename U > |
| U | get () const |
| | Retrieve a stored specific Attribute and cast if convertible. More...
|
| |
| template<typename U > |
| std::optional< U > | getOptional () const |
| | Retrieve a stored specific Attribute and cast if convertible. More...
|
| |
| | Variant (resource r) |
| | Construct a lightweight wrapper around a generic object that indicates the concrete datatype of the specific object stored. More...
|
| |
| U | get () const |
| | Retrieve a stored specific object of known datatype with ensured type-safety. More...
|
| |
| resource | getResource () const |
| | Retrieve the stored generic object. More...
|
| |
| constexpr size_t | index () const noexcept |
| | Retrieve the index of the alternative that is currently been held. More...
|
| |
|
|
using | resource = attribute_types |
| |
|
Datatype | dtype |
| |
Variant datatype supporting at least all formats for attributes specified in the openPMD standard.
◆ get()
template<typename U >
| U openPMD::Attribute::get |
Retrieve a stored specific Attribute and cast if convertible.
- Note
- This performs a static_cast and might introduce precision loss if requested. Check dtype explicitly beforehand if needed.
- Exceptions
-
| std::runtime_error | if stored object is not static castable to U. |
- Template Parameters
-
| U | Type of the object to be casted to. |
- Returns
- Copy of the retrieved object, casted to type U.
◆ getOptional()
template<typename U >
| std::optional< U > openPMD::Attribute::getOptional |
Retrieve a stored specific Attribute and cast if convertible.
Like Attribute::get<>(), but returns an empty std::optional if no conversion is possible instead of throwing an exception.
- Note
- This performs a static_cast and might introduce precision loss if requested. Check dtype explicitly beforehand if needed.
- Template Parameters
-
| U | Type of the object to be casted to. |
- Returns
- Copy of the retrieved object, casted to type U. An empty std::optional if no conversion is possible.
The documentation for this class was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/openpmd-api/checkouts/0.16.0/include/openPMD/backend/Attribute.hpp