This file is indexed.

/usr/include/vtk-6.3/vtkSMPThreadLocalObject.h is in libvtk6-dev 6.3.0+dfsg1-5.

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
 /*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkSMPThreadLocalObject.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkSMPThreadLocalObject - Thread local storage for VTK objects.
// .SECTION Description
// This class essentially does the same thing as vtkSMPThreadLocal with
// 2 additional functions:
// - Local() allocates an object of the template argument type using ::New
// - The destructor calls Delete() on all objects created with Local().
//
// .SECTION Warning
// There is absolutely no guarantee to the order in which the local objects
// will be stored and hence the order in which they will be traversed when
// using iterators. You should not even assume that two vtkSMPThreadLocal
// populated in the same parallel section will be populated in the same
// order. For example, consider the following
// \verbatim
// vtkSMPThreadLocal<int> Foo;
// vtkSMPThreadLocal<int> Bar;
// class AFunctor
// {
//    void Initialize() const
//    {
//      int& foo = Foo.Local();
//      int& bar = Bar.Local();
//      foo = random();
//      bar = foo;
//    }
//
//    void operator()(vtkIdType, vtkIdType)
//    {}
//    void Finalize()
//    {}
// };
//
// AFunctor functor;
// vtkSMPTools::For(0, 100000, functor);
//
// vtkSMPThreadLocal<int>::iterator itr1 = Foo.begin();
// vtkSMPThreadLocal<int>::iterator itr2 = Bar.begin();
// while (itr1 != Foo.end())
// {
//   assert(*itr1 == *itr2);
//   ++itr1; ++itr2;
// }
// \endverbatim
//
// It is possible and likely that the assert() will fail using the TBB
// backend. So if you need to store values related to each other and
// iterate over them together, use a struct or class to group them together
// and use a thread local of that class.
//
// .SECTION See Also
// vtkSMPThreadLocal

#ifndef vtkSMPThreadLocalObject_h
#define vtkSMPThreadLocalObject_h

#include "vtkSMPThreadLocal.h"

template <typename T>
class vtkSMPThreadLocalObject
{
  typedef vtkSMPThreadLocal<T*> TLS;
  typedef typename vtkSMPThreadLocal<T*>::iterator TLSIter;

  // Hide the copy constructor for now and assignment
  // operator for now.
  vtkSMPThreadLocalObject(const vtkSMPThreadLocalObject&);
  void operator=(const vtkSMPThreadLocalObject&);

public:
  // Description:
  // Default constructor.
  vtkSMPThreadLocalObject() : Internal(0), Exemplar(0)
  {
  }

  vtkSMPThreadLocalObject(T* const& exemplar) : Internal(0), Exemplar(exemplar)
  {
  }

  virtual ~vtkSMPThreadLocalObject()
  {
    iterator iter = this->begin();
    while (iter != this->end())
      {
      if (*iter)
        {
        (*iter)->Delete();
        }
      ++iter;
      }
  }

  // Description:
  // Returns an object local to the current thread.
  // This object is allocated with ::New() and will
  // be deleted in the destructor of vtkSMPThreadLocalObject.
  T*& Local()
  {
    T*& vtkobject = this->Internal.Local();
    if (!vtkobject)
      {
      if (this->Exemplar)
        {
        vtkobject = this->Exemplar->NewInstance();
        }
      else
        {
        vtkobject = T::SafeDownCast(T::New());
        }
      }
    return vtkobject;
  }

  // Description:
  // Return the number of thread local objects that have been initialized
  size_t size() const
    {
    return this->Internal.size();
    }

  // Description:
  // Subset of the standard iterator API.
  // The most common design pattern is to use iterators in a sequential
  // code block and to use only the thread local objects in parallel
  // code blocks.
  class iterator
  {
  public:
    iterator& operator++()
    {
      ++this->Iter;
      return *this;
    }

    iterator operator++(int)
      {
        iterator copy = *this;
        ++this->Iter;
        return copy;
      }

    bool operator==(const iterator& other)
      {
      return this->Iter == other.Iter;
      }

    bool operator!=(const iterator& other)
    {
      return this->Iter != other.Iter;
    }

    T*& operator*()
    {
      return *this->Iter;
    }

    T** operator->()
      {
        return &*this->Iter;
      }

  private:
    TLSIter Iter;

    friend class vtkSMPThreadLocalObject<T>;
  };

  iterator begin()
    {
      iterator iter;
      iter.Iter = this->Internal.begin();
      return iter;
    };

  iterator end()
    {
      iterator iter;
      iter.Iter = this->Internal.end();
      return iter;
    }

private:
  TLS Internal;
  T* Exemplar;
};

#endif
// VTK-HeaderTest-Exclude: vtkSMPThreadLocalObject.h