This file is indexed.

/usr/include/ITK-4.9/itkFixedArray.h is in libinsighttoolkit4-dev 4.9.0-4ubuntu1.

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
/*=========================================================================
 *
 *  Copyright Insight Software Consortium
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0.txt
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *=========================================================================*/
#ifndef itkFixedArray_h
#define itkFixedArray_h

#include "itkMacro.h"

namespace itk
{

/** \class FixedArray
 *  \brief Simulate a standard C array with copy semnatics.
 *
 * Simulates a standard C array, except that copy semantics are used instead
 * of reference semantics.  Also, arrays of different sizes cannot be
 * assigned to one another, and size information is known for function
 * returns.
 *
 * \tparam TValue Element type stored at each location in the array.
 * \tparam VLength    = Length of the array.
 *
 * The length of the array is fixed at compile time. If you wish to
 * specify the length of the array at run-time, use the class itk::Array.
 * If you wish to change to change the length of the array at run-time,
 * you're best off using std::vector<>.
 *
 * \ingroup DataRepresentation
 * \ingroup ITKCommon
 *
 * \wiki
 * \wikiexample{Utilities/FixedArray,C-style array}
 * \endwiki
 */
template< typename TValue, unsigned int VLength = 3 >
class FixedArray
{
public:
  /** Length constant */
  itkStaticConstMacro(Length, unsigned int, VLength);

  /** Dimension constant */
  itkStaticConstMacro(Dimension, unsigned int, VLength);

  /** The element type stored at each location in the FixedArray. */
  typedef TValue ValueType;

  /** A type representing the C-array version of this FixedArray. */
  typedef ValueType CArray[VLength];

  /** An iterator through the array. */
  typedef ValueType *Iterator;

  /** A const iterator through the array. */
  typedef const ValueType *ConstIterator;

  class ConstReverseIterator;

  /** \class ReverseIterator
   * \brief A reverse iterator through an array.
   * \ingroup ITKCommon
   */
  class ReverseIterator
  {
  public:
    explicit ReverseIterator(Iterator i):m_Iterator(i) {}
    Iterator operator++()        { return --m_Iterator; }
    Iterator operator++(int)     { return m_Iterator--; }
    Iterator operator--()        { return ++m_Iterator; }
    Iterator operator--(int)     { return m_Iterator++; }
    Iterator operator->() const { return ( m_Iterator - 1 ); }
    ValueType & operator*() const { return *( m_Iterator - 1 ); }
    bool operator!=(const ReverseIterator & rit) const { return m_Iterator != rit.m_Iterator; }
    bool operator==(const ReverseIterator & rit) const { return m_Iterator == rit.m_Iterator; }

  private:
    Iterator m_Iterator;
    friend class ConstReverseIterator;
  };

  /** \class ConstReverseIterator
   * \brief A const reverse iterator through an array.
   * \ingroup ITKCommon
   */
  class ConstReverseIterator
  {
  public:
    explicit ConstReverseIterator(ConstIterator i):m_Iterator(i) {}
    ConstReverseIterator(const ReverseIterator & rit) { m_Iterator = rit.m_Iterator; }
    ConstIterator operator++()         { return --m_Iterator; }
    ConstIterator operator++(int)      { return m_Iterator--; }
    ConstIterator operator--()         { return ++m_Iterator; }
    ConstIterator operator--(int)      { return m_Iterator++; }
    ConstIterator operator->() const { return ( m_Iterator - 1 ); }
    const ValueType & operator*() const { return *( m_Iterator - 1 ); }
    bool operator!=(const ConstReverseIterator & rit) const { return m_Iterator != rit.m_Iterator; }
    bool operator==(const ConstReverseIterator & rit) const { return m_Iterator == rit.m_Iterator; }

  private:
    ConstIterator m_Iterator;
  };

  /** A pointer to the ValueType. */
  typedef ValueType *pointer;

  /** A const pointer to the ValueType. */
  typedef const ValueType *const_pointer;

  /** A reference to the ValueType. */
  typedef ValueType & reference;

  /** A const reference to the ValueType. */
  typedef const ValueType & const_reference;

  typedef unsigned int SizeType;

public:
  /** Constructors */
  FixedArray();
  FixedArray(const ValueType r[VLength]);
  FixedArray(const ValueType & r);

  /** Constructor to initialize a fixed array from another of any data type */
  template< typename TFixedArrayValueType >
  FixedArray(const FixedArray< TFixedArrayValueType, VLength > & r)
  {
    typename FixedArray< TFixedArrayValueType, VLength >::ConstIterator input = r.Begin();
    Iterator i = this->Begin();
    while ( i != this->End() )
      {
      *i++ = static_cast< TValue >( *input++ );
      }
  }

  template< typename TScalarValue >
  FixedArray(const TScalarValue *r)
    {
      std::copy(r, r + this->Size(), this->GetDataPointer());
    }

  /** This destructor is not virtual for performance reasons. However, this
   * means that subclasses cannot allocate memory.
   *
   * The destructor is PURPOSELY NOT DEFINED, in order to prevent inefficient
   * byte alignment of arrays of this object.
   *
   * ~FixedArray();
   *
   * For a full discussion, see
   * http://www.itk.org/mailman/private/insight-developers/2008-June/010480.html
   *
   */

  /** Operator= defined for a variety of types. */
  template< typename TFixedArrayValueType >
  FixedArray & operator=(const FixedArray< TFixedArrayValueType, VLength > & r)
  {
    if ( (const void *)r.Begin() != (const void *)m_InternalArray )
      {
      typename FixedArray< TFixedArrayValueType, VLength >::ConstIterator input = r.Begin();
      Iterator i = this->Begin();
      while ( i != this->End() )
        {
        *i++ = static_cast< TValue >( *input++ );
        }
      }
    return *this;
  }

  FixedArray & operator=(const ValueType r[VLength]);

  /** Operators == and != are used to compare whether two arrays are equal.
   * Note that arrays are equal when the number of components (size) is the
   * same, and each component value is equal. */
  bool operator==(const FixedArray & r) const;

  bool operator!=(const FixedArray & r) const
  { return !operator==(r); }

  /** Allow the FixedArray to be indexed normally.  No bounds checking is done.
   * The separate versions are a work-around for an integer conversion bug in
   * Visual C++. */
  reference operator[](short index)                { return m_InternalArray[index]; }
  const_reference operator[](short index) const { return m_InternalArray[index]; }
  reference operator[](unsigned short index)       { return m_InternalArray[index]; }
  const_reference operator[](unsigned short index) const { return m_InternalArray[index]; }
  reference operator[](int index)                  { return m_InternalArray[index]; }
  const_reference operator[](int index) const { return m_InternalArray[index]; }
// false positive warnings with GCC 4.9
#if defined( __GNUC__ )
#if ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ == 9 )
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
#endif
  reference operator[](unsigned int index)         { return m_InternalArray[index]; }
  const_reference operator[](unsigned int index) const { return m_InternalArray[index]; }
#if defined( __GNUC__ )
#if ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ == 9 )
#pragma GCC diagnostic pop
#endif
#endif
  reference operator[](long index)                 { return m_InternalArray[index]; }
  const_reference operator[](long index) const { return m_InternalArray[index]; }
  reference operator[](unsigned long index)        { return m_InternalArray[index]; }
  const_reference operator[](unsigned long index) const { return m_InternalArray[index]; }
  reference operator[](long long index)                 { return m_InternalArray[index]; }
  const_reference operator[](long long index) const { return m_InternalArray[index]; }
  reference operator[](unsigned long long index)        { return m_InternalArray[index]; }
  const_reference operator[](unsigned long long index) const { return m_InternalArray[index]; }

  /** Set/Get element methods are more convenient in wrapping languages */
  void SetElement(unsigned short index, const_reference value)
  { m_InternalArray[index] = value; }
  const_reference GetElement(unsigned short index) const { return m_InternalArray[index]; }

  /** Return a pointer to the data. */
  ValueType * GetDataPointer()
  {
    return m_InternalArray; \
  }

  const ValueType * GetDataPointer() const
  {
    return m_InternalArray; \
  }

  /** Get various iterators to the array. */
  Iterator      Begin();

  ConstIterator Begin() const;

  Iterator      End();

  ConstIterator End() const;

  ReverseIterator      rBegin();

  ConstReverseIterator rBegin() const;

  ReverseIterator      rEnd();

  ConstReverseIterator rEnd() const;

  SizeType      Size() const;

  void Fill(const ValueType &);

private:
  /** Internal C array representation. */
  CArray m_InternalArray;

public:

  static FixedArray Filled(const ValueType &);
};

template< typename TValue, unsigned int VLength >
std::ostream & operator<<(std::ostream & os, const FixedArray< TValue, VLength > & arr);
} // namespace itk

#ifndef ITK_MANUAL_INSTANTIATION
#include "itkFixedArray.hxx"
#endif

#include "itkNumericTraitsFixedArrayPixel.h"

#endif