vitrio 0.3.1
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
vitrio::image_metadata_value Class Reference

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

Detailed Description

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.

See also
image_metadata

Constructor & Destructor Documentation

◆ image_metadata_value() [1/4]

template<typename T, typename std::enable_if< std::is_integral< T >::value &&!std::is_same< T, bool >::value, int >::type = 0>
vitrio::image_metadata_value::image_metadata_value ( T value)

Construct an integer.

Parameters
valueThe number, of any integral type but bool.
Exceptions
std::out_of_rangeIf value is above what a std::int64_t holds.

◆ image_metadata_value() [2/4]

template<typename T, typename std::enable_if< std::is_floating_point< T >::value, int >::type = 0>
vitrio::image_metadata_value::image_metadata_value ( T value)
noexcept

Construct a real.

Parameters
valueThe number, of any floating point type.

◆ image_metadata_value() [3/4]

vitrio::image_metadata_value::image_metadata_value ( std::string value)
noexcept

Construct a text.

Parameters
valueThe text.

◆ image_metadata_value() [4/4]

vitrio::image_metadata_value::image_metadata_value ( const char * value)

Construct a text.

Parameters
valueThe text, ended by a null character. Must not be null.
Exceptions
std::invalid_argumentIf value is null.

Member Function Documentation

◆ get_integer()

const std::int64_t & vitrio::image_metadata_value::get_integer ( ) const

Get this value as the integer it is.

Returns
const std::int64_t& The integer. It refers to storage owned by this value.
Exceptions
std::invalid_argumentIf this value is not an integer.

◆ get_real()

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.

Returns
const double& The real. It refers to storage owned by this value.
Exceptions
std::invalid_argumentIf this value is not a real.

◆ get_text()

const std::string & vitrio::image_metadata_value::get_text ( ) const

Get this value as the text it is.

Returns
const std::string& The text. It refers to storage owned by this value.
Exceptions
std::invalid_argumentIf this value is not a text.

◆ get_type()

image_metadata_value_type vitrio::image_metadata_value::get_type ( ) const
noexcept

Get the type of this value.

Returns
image_metadata_value_type The type.

◆ operator==

bool operator== ( const image_metadata_value & lhs,
const image_metadata_value & rhs )
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.


The documentation for this class was generated from the following file: