This file is indexed.

/usr/include/dcmtk/ofstd/ofvector.h is in libdcmtk2-dev 3.6.0-9.

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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
/*
 *
 *  Copyright (C) 2010, OFFIS e.V.
 *  All rights reserved.  See COPYRIGHT file for details.
 *
 *  This software and supporting documentation were developed by
 *
 *    OFFIS e.V.
 *    R&D Division Health
 *    Escherweg 2
 *    D-26121 Oldenburg, Germany
 *
 *
 *  Module:  ofstd
 *
 *  Author:  Uli Schlachter
 *
 *  Purpose: Defines a template vector class based on the STL vector class
 *
 *  Last Update:      $Author: joergr $
 *  Update Date:      $Date: 2010-10-14 13:15:51 $
 *  CVS/RCS Revision: $Revision: 1.3 $
 *  Status:           $State: Exp $
 *
 *  CVS/RCS Log at end of file
 *
 */

#ifndef OFVECTOR_H
#define OFVECTOR_H

#include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */

#ifndef HAVE_CLASS_TEMPLATE
#error Your C++ compiler cannot handle class templates:
#endif

#if defined(HAVE_STL) || defined(HAVE_STL_VECTOR)

// Use the standard template library (STL) vector class.
#include <vector>

#ifdef HAVE_STD_NAMESPACE
#define OFVector std::vector
#else
#define OFVector vector
#endif

#else

#define INCLUDE_CASSERT          /* for assert() */
#define INCLUDE_CSTDLIB          /* for NULL */
#include "dcmtk/ofstd/ofstdinc.h"
#include "dcmtk/ofstd/oftypes.h" /* for OFBool */

/** this is a resizable array. You can add and remove elements after it was
 *  created and this class will handle all the memory management needed. This
 *  implements parts of std::vector's features.
 */
template<typename T>
class OFVector
{
public:
    /** the type of elements that this OFVector stores */
    typedef T        value_type;
    /** the type used for sizes and indexes */
    typedef size_t   size_type;
    /** the type of mutable iterators on this object */
    typedef T*       iterator;
    /** the type of constant iterators on this object */
    typedef const T* const_iterator;

protected:

    /** array that is used for storing the entries in this OFVector */
    T* values_;

    /** the size for which values_ was allocated */
    size_type allocated_;

    /** the number of valid entries in values_. elements past this
     *  index have undefined content.
     */
    size_type size_;

public:

    /** default constructor. This creates an empty OFVector. */
    OFVector() : values_(NULL), allocated_(0), size_(0)
    {
        reserve(0);
    }

    /** copy constructor.
     *  @param other OFVector from which all elements are copied
     */
    OFVector(const OFVector& other) : values_(NULL), allocated_(0), size_(0)
    {
        reserve(other.size());
        for (const_iterator it = other.begin(); it != other.end(); ++it)
            push_back(*it);
    }

    /** construct an OFVector with predefined content.
     *  @param n number of elements that this OFVector should have.
     *  @param v The value used for all elements.
     */
    explicit OFVector(size_type n, const T& v = T()) : values_(NULL), allocated_(0), size_(0)
    {
        if (n > 0)
            resize(n, v);
        else
            // Make sure that values_ never is a NULL pointer
            reserve(0);
    }

    /** construct an OFVector from a range of iterators.
     *  @param from first iterator to include
     *  @param to first iterator that should not be included anymore
     */
    OFVector(const_iterator from, const_iterator to) : values_(NULL), allocated_(0), size_(0)
    {
        reserve(to - from);
        while (from != to)
            push_back(*(from++));
    }

    /** destructor. Frees all memory used by this object.
     */
    ~OFVector()
    {
        delete[] values_;
    }

    /** assignment operator. All elements from this object are removed and then
     *  a copy of other is made. All iterators to this object will become
     *  invalid.
     *  @param other OFVector instance to copy elements from.
     */
    OFVector& operator=(const OFVector& other)
    {
        clear();
        reserve(other.size());
        for (const_iterator it = other.begin(); it != other.end(); ++it)
            push_back(*it);
        return *this;
    }

    /** swap this vector's content with some other vector.
     *  All iterators will stay valid.
     *  @param other object to swap with
     */
    void swap(OFVector& other)
    {
        T* tmp_val = values_;
        size_type tmp_all = allocated_;
        size_type tmp_size = size_;

        values_ = other.values_;
        allocated_ = other.allocated_;
        size_ = other.size_;

        other.values_ = tmp_val;
        other.allocated_ = tmp_all;
        other.size_ = tmp_size;
    }

    /** get an iterator for the first element in this object.
     *  @return iterator that points to the first element.
     */
    iterator begin() { return &values_[0]; }

    /** get an iterator for the first element in this object.
     *  @return iterator that points to the first element.
     */
    const_iterator begin() const { return &values_[0]; }

    /** get an iterator that points past the last valid object.
     *  @return iterator that points to the end of this OFVector.
     */
    iterator end() { return &values_[size_]; }

    /** get an iterator that points past the last valid object.
     *  @return iterator that points to the end of this OFVector.
     */
    const_iterator end() const { return &values_[size_]; }

    /** get the size of this OFVector.
     *  @return number of elements in this instance.
     */
    size_type size() const { return size_; }

    /** check wether this OFVector is empty.
     *  @return true if this OFVector is empty.
     */
    OFBool empty() const { return size_ == 0; }

    /** clear this OFVector. The existing content will be freed and all
     *  iterators become invalid.
     */
    void clear()
    {
        delete[] values_;
        values_ = NULL;
        size_ = 0;
        allocated_ = 0;
        // We must never have values_ == NULL
        reserve(0);
    }

    /** removes an entry from this OFVector.
     *  All iterators pointing to the element removed or elements that come
     *  behind it in this OFVector will become invalid.
     *  @param it iterator for the entry that should be removed.
     */
    void erase(iterator it)
    {
        size_type idx = it - begin();
        for (size_type i = idx + 1; i < size_; i++) {
            values_[i - 1] = values_[i];
        }
        size_--;
    }

    /** insert an entry in this OFVector.
     *  All iterators for this OFVector become invalid.
     *  @param it the new element will be inserted in front of the element to
     *            which this iterator points.
     *  @param v the element to insert
     *  @return iterator for the newly inserted element.
     */
    iterator insert(iterator it, const T& v)
    {
        size_type idx = it - begin();
        reserve(size_ + 1);
        if (idx < size_)
            for (size_type i = size_; i > idx; i--) {
                values_[i] = values_[i - 1];
            }
        values_[idx] = v;
        size_++;
        return &values_[idx];
    }

    /** insert a range of elements in this OFVector.
     *  All iterators for this OFVector become invalid.
     *  @param it the new elements will be inserted in front of the element to
     *            which this iterator points.
     *  @param from iterator to the beginning of the range to insert.
     *  @param to iterator past the end of the range to insert.
     */
    template<class InputIterator>
    void insert(iterator it, InputIterator from, InputIterator to)
    {
        while (from != to)
        {
            it = insert(it, *from);
            it++;
            from++;
        }
    }

    /** insert an entry at the end of this object
     *  @param v the value to insert
     */
    void push_back(const T& v)
    {
        insert(end(), v);
    }

    /** remove the last entry in this object
     */
    void pop_back()
    {
        erase(end() - 1);
    }

    /** access an entry by index. undefined behavior occurs when the index is
     *  out of bounds (bigger than the maximum allowed index).
     *  @param i index of the element to return
     *  @return reference to the element.
     */
    T& operator[](size_type i)
    {
        return values_[i];
    }

    /** access an entry by index. undefined behavior occurs when the index is
     *  out of bounds (bigger than the maximum allowed index).
     *  @param i index of the element to return
     *  @return reference to the element.
     */
    const T& operator[](size_type i) const
    {
        return values_[i];
    }

    /** access an entry by index.
     *  @param i index of the element to return
     *  @return reference to the element.
     */
    T& at(size_type i)
    {
        assert(i < size_);
        return (*this)[i];
    }

    /** access an entry by index.
     *  @param i index of the element to return
     *  @return reference to the element.
     */
    const T& at(size_type i) const
    {
        assert(i < size_);
        return (*this)[i];
    }

    /** resize this OFVector. after this call, size() will be n.
     *  @param n the new size that this object should use
     *  @param v if any new elements need to be inserted, they get this value.
     */
    void resize(size_type n, T v = T())
    {
        if (n > size_)
        {
            reserve(n);
            // Set up the new elements
            for (size_t i = size_; i < n; i++)
                values_[i] = v;
        }
        size_ = n;
    }

    /** reserves enough space for the given number of elements. from now on, no
     *  memory allocations will occur as long as this OFVector's size stays
     *  below n and clear() is not called.
     *  @param n the number of elements for which space should be reserved.
     */
    void reserve(size_type n)
    {
        T* old_values = values_;
        T* new_values;

        if (n == 0)
            n = 1;
        if (n <= allocated_)
            return;

        // While we are at it, let's reserve some extra space
        n += 10;

        new_values = new T[n];
        if (old_values)
        {
            for (size_type i = 0; i < size_; i++)
                new_values[i] = old_values[i];
            delete[] old_values;
        }

        values_ = new_values;
        allocated_ = n;
    }
};

#endif

#endif


/*
 * CVS/RCS Log:
 * $Log: ofvector.h,v $
 * Revision 1.3  2010-10-14 13:15:51  joergr
 * Updated copyright header. Added reference to COPYRIGHT file.
 *
 * Revision 1.2  2010-10-08 13:25:33  uli
 * Implement OFVector.
 *
 * Revision 1.1  2010-04-26 11:57:35  joergr
 * Added initial definitions for using the STL vector class. Please note that
 * there is currently no alternative implementation to this standard class.
 *
 *
 */