|
vitrio 0.3.1
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
|
One value of the metadata of an image file: an integer, a real or a text. More...
#include <vitrio/image_metadata_value.hpp>
Public Member Functions | |
| template<typename T, typename std::enable_if< std::is_integral< T >::value &&!std::is_same< T, bool >::value, int >::type = 0> | |
| image_metadata_value (T value) | |
| Construct an integer. | |
| template<typename T, typename std::enable_if< std::is_floating_point< T >::value, int >::type = 0> | |
| image_metadata_value (T value) noexcept | |
| Construct a real. | |
| image_metadata_value (std::string value) noexcept | |
| Construct a text. | |
| image_metadata_value (const char *value) | |
| Construct a text. | |
| image_metadata_value (bool value)=delete | |
| image_metadata_value (std::nullptr_t value)=delete | |
| image_metadata_value (const image_metadata_value &other) | |
| image_metadata_value (image_metadata_value &&other) noexcept | |
| image_metadata_value & | operator= (const image_metadata_value &other) |
| image_metadata_value & | operator= (image_metadata_value &&other) noexcept |
| image_metadata_value_type | get_type () const noexcept |
| Get the type of this value. | |
| const std::int64_t & | get_integer () const |
| Get this value as the integer it is. | |
| const double & | get_real () const |
| Get this value as the real it is. | |
| const std::string & | get_text () const |
| Get this value as the text it is. | |
Friends | |
| bool | operator== (const image_metadata_value &lhs, const image_metadata_value &rhs) noexcept |
| Check whether two values are of the same type and hold the same. | |
| bool | operator!= (const image_metadata_value &lhs, const image_metadata_value &rhs) noexcept |
One value of the metadata of an image file: an integer, a real or a text.
A value is of exactly one of the types of image_metadata_value_type, settled when it is constructed. What it is constructed from decides which: an integral type makes an integer, a floating point type a real, and a string a text. A boolean and a pointer that is not a string make nothing, and do not compile.
| vitrio::image_metadata_value::image_metadata_value | ( | T | value | ) |
Construct an integer.
| value | The number, of any integral type but bool. |
| std::out_of_range | If value is above what a std::int64_t holds. |
|
noexcept |
Construct a real.
| value | The number, of any floating point type. |
|
noexcept |
Construct a text.
| value | The text. |
| vitrio::image_metadata_value::image_metadata_value | ( | const char * | value | ) |
Construct a text.
| value | The text, ended by a null character. Must not be null. |
| std::invalid_argument | If value is null. |
| const std::int64_t & vitrio::image_metadata_value::get_integer | ( | ) | const |
Get this value as the integer it is.
| std::invalid_argument | If this value is not an integer. |
| const double & vitrio::image_metadata_value::get_real | ( | ) | const |
Get this value as the real it is.
An integer is not a real: it is not converted.
| std::invalid_argument | If this value is not a real. |
| const std::string & vitrio::image_metadata_value::get_text | ( | ) | const |
Get this value as the text it is.
| std::invalid_argument | If this value is not a text. |
|
noexcept |
Get the type of this value.
|
friend |
Check whether two values are of the same type and hold the same.
An integer never equals a real, whatever the two hold. Two reals compare as two double do.