This file is indexed.

/usr/include/odil/DataSet.h is in libodil0-dev 0.4.1-1.

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
/*************************************************************************
 * 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 _8424446e_1153_4acc_9f57_e86faa7246e3
#define _8424446e_1153_4acc_9f57_e86faa7246e3

#include <cstddef>
#include <cstdint>
#include <initializer_list>
#include <map>
#include <string>
#include <vector>

#include "odil/Element.h"
#include "odil/Value.h"

namespace odil
{

#define odilElementTypeMacro(name, Type) \
bool is_##name(Tag const & tag) const \
{ \
    auto const it = this->_elements.find(tag); \
    if(it == this->_elements.end()) \
    { \
        throw Exception("No such element"); \
    } \
    return it->second.is_##name(); \
} \
Value::Type const & as_##name(Tag const & tag) const \
{ \
    auto const it = this->_elements.find(tag); \
    if(it == this->_elements.end()) \
    { \
        throw Exception("No such element"); \
    } \
    return it->second.as_##name(); \
} \
Value::Type::value_type const & as_##name(Tag const & tag, unsigned int position) const \
{ \
    auto const & data = this->as_##name(tag); \
    if(data.size() <= position) \
    { \
        throw Exception("No such element"); \
    } \
    return data[position]; \
} \
Value::Type & as_##name(Tag const & tag) \
{ \
    auto const it = this->_elements.find(tag); \
    if(it == this->_elements.end()) \
    { \
        throw Exception("No such element"); \
    } \
    return it->second.as_##name(); \
}

/**
 * @brief DICOM Data set.
 */
class DataSet
{
public:
    /// @brief Create an empty data set.
    DataSet();

    /// @brief Add an element to the dataset.
    void add(Tag const & tag, Element const & element);

    /// @brief Add an empty element to the dataset.
    void add(Tag const & tag, VR vr=VR::UNKNOWN);

    /// @brief Add an element to the dataset.
    void add(
        Tag const & tag, Value::Integers const & value, VR vr=VR::UNKNOWN);

    /// @brief Add an element to the dataset.
    void add(
        Tag const & tag, Value::Reals const & value, VR vr=VR::UNKNOWN);

    /// @brief Add an element to the dataset.
    void add(
        Tag const & tag, Value::Strings const & value, VR vr=VR::UNKNOWN);

    /// @brief Add an element to the dataset.
    void add(
        Tag const & tag, Value::DataSets const & value, VR vr=VR::UNKNOWN);

    /// @brief Add an element to the dataset.
    void add(
        Tag const & tag, Value::Binary const & value, VR vr=VR::UNKNOWN);

    /// @brief Add an element to the dataset.
    void add(
        Tag const & tag, std::initializer_list<int> const & value,
        VR vr=VR::UNKNOWN);

    /// @brief Add an element to the dataset.
    void add(
        Tag const & tag, std::initializer_list<Value::Integer> const & value,
        VR vr=VR::UNKNOWN);

    /// @brief Add an element to the dataset.
    void add(
        Tag const & tag, std::initializer_list<Value::Real> const & value,
        VR vr=VR::UNKNOWN);

    /// @brief Add an element to the dataset.
    void add(
        Tag const & tag, std::initializer_list<Value::String> const & value,
        VR vr=VR::UNKNOWN);

    /// @brief Add an element to the dataset.
    void add(
        Tag const & tag, std::initializer_list<DataSet> const & value,
        VR vr=VR::UNKNOWN);

    /**
     * @brief Remove an element from the data set.
     *
     * If the element is not in the data set, a odil::Exception is raised.
     */
    void remove(Tag const & tag);

    /// @brief Test whether the data set is empty.
    bool empty() const;

    /// @brief Return the number of elements in the data set.
    std::size_t size() const;

    /// @brief Test whether an element is in the data set.
    bool has(Tag const & tag) const;

    /**
     * @brief Return the VR of an element in the data set.
     *
     * If the element is not in the data set, a odil::Exception is raised.
     */
    VR get_vr(Tag const & tag) const;

    /**
     * @brief Test whether an element of the data set is empty.
     *
     * If the element is not in the data set, a odil::Exception is raised.
     */
    bool empty(Tag const & tag) const;

    /**
     * @brief Return the number of values in an element of the data set.
     *
     * If the element is not in the data set, a odil::Exception is raised.
     */
    std::size_t size(Tag const & tag) const;

    /**
     * @brief Access the given element.
     *
     * If the element is not in the data set, a odil::Exception is raised.
     */
    Element const & operator[](Tag const & tag) const;

    /**
     * @brief Access the given element.
     *
     * If the element is not in the data set, a odil::Exception is raised.
     */
    Element & operator[](Tag const & tag);

    odilElementTypeMacro(int, Integers);
    odilElementTypeMacro(real, Reals);
    odilElementTypeMacro(string, Strings);
    odilElementTypeMacro(data_set, DataSets);
    odilElementTypeMacro(binary, Binary);

    typedef std::map<Tag, Element>::const_iterator const_iterator;
    const_iterator begin() const { return this->_elements.begin(); }
    const_iterator end() const { return this->_elements.end(); }

    /// @brief Equality test
    bool operator==(DataSet const & other) const;

    /// @brief Difference test
    bool operator!=(DataSet const & other) const;

private:
    typedef std::map<Tag, Element> ElementMap;

    ElementMap _elements;
};

}

#endif // _8424446e_1153_4acc_9f57_e86faa7246e3