/usr/include/odil/Value.h is in libodil-dev 0.8.0-4build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | /*************************************************************************
* odil - Copyright (C) Universite de Strasbourg
* Distributed under the terms of the CeCILL-B license, as published by
* the CEA-CNRS-INRIA. Refer to the LICENSE file or to
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
* for details.
************************************************************************/
#ifndef _dca5b15b_b8df_4925_a446_d42efe06c923
#define _dca5b15b_b8df_4925_a446_d42efe06c923
#include <cstdint>
#include <initializer_list>
#include <memory>
#include <string>
#include <vector>
#include "odil/odil.h"
namespace odil
{
class DataSet;
/**
* @brief A value held in a DICOM element.
*/
class ODIL_API Value
{
public:
/// @brief Possible types stored in the value.
enum class Type
{
Integers,
Reals,
Strings,
DataSets,
Binary
};
/// @brief Integer type.
typedef int64_t Integer;
/// @brief Real type.
typedef double Real;
/// @brief String type.
typedef std::string String;
/// @brief Integer container.
typedef std::vector<Integer> Integers;
/// @brief Real container.
typedef std::vector<Real> Reals;
/// @brief String container.
typedef std::vector<String> Strings;
/// @brief Data sets container.
typedef std::vector<DataSet> DataSets;
/// @brief Binary data container.
typedef std::vector<std::vector<uint8_t>> Binary;
#define ODIL_VALUE_CONSTRUCTORS(type) \
Value(type const & value); \
Value(type && value); \
Value(std::initializer_list<type::value_type> const & value);
/*
* No need for for a rvalue reference version of std::initializer_list:
* copying a std::initializer_list does not copy the underlying objects.
*/
ODIL_VALUE_CONSTRUCTORS(Integers);
ODIL_VALUE_CONSTRUCTORS(Reals);
ODIL_VALUE_CONSTRUCTORS(Strings);
ODIL_VALUE_CONSTRUCTORS(DataSets);
ODIL_VALUE_CONSTRUCTORS(Binary);
#undef ODIL_VALUE_CONSTRUCTORS
Value(std::initializer_list<int> const & value);
Value(std::initializer_list<std::initializer_list<uint8_t>> const & value);
/** @addtogroup default_operations Default class operations
* @{
*/
~Value() =default;
Value(Value const &) =default;
Value(Value &&) =default;
Value & operator=(Value const &) =default;
Value & operator=(Value &&) =default;
/// @}
/// @brief Return the type store in the value.
Type get_type() const;
/// @brief Test whether the value is empty.
bool empty() const;
/// @brief Return the number of items.
std::size_t size() const;
/**
* @brief Return the integers contained in the value.
*
* If the value does not contain integers, a odil::Exception is raised.
*/
Integers const & as_integers() const;
/**
* @brief Return the integers contained in the value.
*
* If the value does not contain integers, a odil::Exception is raised.
*/
Integers & as_integers();
/**
* @brief Return the reals contained in the value.
*
* If the value does not contain reals, a odil::Exception is raised.
*/
Reals const & as_reals() const;
/**
* @brief Return the reals contained in the value.
*
* If the value does not contain reals, a odil::Exception is raised.
*/
Reals & as_reals();
/**
* @brief Return the strings contained in the value.
*
* If the value does not contain strings, a odil::Exception is raised.
*/
Strings const & as_strings() const;
/**
* @brief Return the strings contained in the value.
*
* If the value does not contain strings, a odil::Exception is raised.
*/
Strings & as_strings();
/**
* @brief Return the data sets contained in the value.
*
* If the value does not contain data sets, a odil::Exception is raised.
*/
DataSets const & as_data_sets() const;
/**
* @brief Return the data sets contained in the value.
*
* If the value does not contain data sets, a odil::Exception is raised.
*/
DataSets & as_data_sets();
/**
* @brief Return the binary data contained in the value.
*
* If the value does not contain binary data, a odil::Exception is raised.
*/
Binary const & as_binary() const;
/**
* @brief Return the binary data contained in the value.
*
* If the value does not contain binary data, a odil::Exception is raised.
*/
Binary & as_binary();
/// @brief Equality test.
bool operator==(Value const & other) const;
/// @brief Difference test.
bool operator!=(Value const & other) const;
/// @brief Clear the value (value.empty() will be true).
void clear();
private:
Integers _integers;
Reals _reals;
Strings _strings;
// NOTE: can't use std::vector<DataSet> with forward-declaration of DataSet
// cf. C++11, 17.6.4.8, last bullet of clause 2
std::shared_ptr<DataSets> _data_sets;
Binary _binary;
Type _type;
};
/**
* @brief Visitor of values.
*/
template<typename TVisitor>
typename TVisitor::result_type
apply_visitor(TVisitor const & visitor, Value const & value);
/**
* @brief Visitor of values.
*/
template<typename TVisitor>
typename TVisitor::result_type
apply_visitor(TVisitor const & visitor, Value & value);
}
#include "odil/Value.txx"
#endif // _dca5b15b_b8df_4925_a446_d42efe06c923
|