This file is indexed.

/usr/include/InsightToolkit/Common/itkTreeIteratorBase.h is in libinsighttoolkit3-dev 3.20.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
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
/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    itkTreeIteratorBase.h
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) Insight Software Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/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 notices for more information.

=========================================================================*/
#ifndef __itkTreeIteratorBase_h
#define __itkTreeIteratorBase_h

#include <itkTreeNode.h>

namespace itk {

/** \class TreeIteratorBase
 *  \brief TreeIteratorBase class
 * 
 * This class provides the base implementation for tree iterators
 *
 * Events will notify interested observers about tree changes. These events all derive from TreeChangeEvent. They are:
 *
 *  - TreeNodeChangeEvent: invoked when Set() is called, i.e. exactly one node changes
 *  - TreeAddEvent: invoked when Add() is called.
 *  - TreeRemoveEvent: when a single node has been removed, i.e. Disconnect() has been called.
 *  - TreePruneEvent: when a node and all its children were removed, i.e. Remove() has been called.
 *
 *  All those events have a member GetChangePosition(), which returns an iterator to the position that has changd. Please
 *  note that this iterator may not be fully functional, but you should always be able to use its Get() method to retrieve
 *  the thing it points to.
 *
 */
template <class TTreeType>
class TreeIteratorBase
{
public: 
  
  /** Typedefs */
  typedef TreeIteratorBase                    Self;
  typedef typename TTreeType::ValueType       ValueType;
  typedef typename TTreeType::TreeNodeType    TreeNodeType;

  /** Add an element to the tree */
  virtual bool Add(ValueType element);

  /** Add an element at a given position */
  virtual bool Add(int position, ValueType element);

  /** Add a subtree */
  virtual bool Add(TTreeType& subTree);

  /** Get a value */
  virtual const ValueType& Get() const;

  /** Get the subtree */
  virtual TTreeType* GetSubTree() const;

  /** Return true if the current node is a leaf */
  virtual bool IsLeaf() const;
  
  /** Return true if the current node is a root */
  virtual bool IsRoot() const;

  /** Get the type of iterator */
  virtual int GetType() const = 0;

  /** Go to the specified child */
  virtual bool GoToChild(int number = 0);
  
  /** Go to the parent */
  virtual bool GoToParent( );

  /** Set the current value of the node */
  void Set(ValueType element);

  /** Return true if the current node has a child */
  virtual bool HasChild(int number = 0) const;

  /** Return the current ChildPosition of an element */
  virtual int ChildPosition(ValueType element) const;

  /** Remove a child */
  virtual bool RemoveChild(int number);

  /** Count the number of children */
  virtual int CountChildren() const;

  /** Return true if the current node has a parent */
  virtual bool HasParent() const;

  /** Disconnect the tree */
  virtual bool Disconnect();

  /** Return a list of children */
  virtual TreeIteratorBase<TTreeType>* Children();

  /** Return a list of parents */
  virtual TreeIteratorBase<TTreeType>* Parents();

  /** Return a list of child */
  virtual TreeIteratorBase<TTreeType>* GetChild(int number) const;

  /** Count the number of nodes */
  virtual int Count();

  /** Remove the current node from the tree */
  bool Remove();

  /** Get the current node */
  virtual TreeNodeType* GetNode();
  virtual const TreeNodeType* GetNode() const;

  /** Get the root */
  TreeNodeType* GetRoot();
  const TreeNodeType* GetRoot() const;
  
  /** Get the tree */
  TTreeType* GetTree() const;

  /** Return the first parent found */
  const TreeNodeType* GetParent() const;

  /** Move an iterator to the beginning of the tree */
  void GoToBegin()
    {
    m_Position = m_Begin;
    }

  /** Move an iterator to the end of the tree. */
  void GoToEnd()
    {
    m_Position = m_End;
    }

  /** Is the iterator at the beginning of the tree? */
  bool IsAtBegin(void) const
    {
    return (m_Position == m_Begin);
    }

  /** Is the iterator at the end of the tree?. The iterator is at the
   * end if it points to NULL */
  bool IsAtEnd(void) const
    {
    return (m_Position == m_End);
    }

  /** Clone the iterator */
  virtual TreeIteratorBase<TTreeType>* Clone() = 0;

  /** Enumerations */
  enum{
    UNDEFIND   = 0,
    PREORDER   = 1,
    INORDER    = 2,
    POSTORDER  = 3,
    LEVELORDER = 4,
    CHILD   = 5,
    ROOT     = 6,
    LEAF     = 7
  };

  /** operator++ */
  Self &
  operator++()
    {
    this->Next();
    return *this;
    }
  /** operator++ */
  void
  operator++(int)
    {
    // assert( !IsAtEnd() );
    this->Next();
    }
  /** operator = */
  const Self & operator=(const Self& iterator) 
    {
    m_Position = iterator.m_Position; 
    m_Begin  = iterator.m_Begin;
    m_End = iterator.m_End;
    m_Root = iterator.m_Root;
    m_Tree = iterator.m_Tree;
    return *this;
    }

  virtual ~TreeIteratorBase() {}
  
protected:

  /** Constructors */
  TreeIteratorBase( TTreeType* tree, const TreeNodeType* start);
  TreeIteratorBase( const TTreeType* tree, const TreeNodeType* start);

  mutable TreeNodeType* m_Position; // Current position of the iterator
  mutable TreeNodeType* m_Begin;
  mutable TreeNodeType* m_End;
  const TreeNodeType*   m_Root;
  TTreeType*            m_Tree;

  virtual bool HasNext() const = 0;
  virtual const ValueType& Next() = 0;
};

} //end namespace itk

// Define instantiation macro for this template.
#define ITK_TEMPLATE_TreeIteratorBase(_, EXPORT, x, y) namespace itk { \
  _(1(class EXPORT TreeIteratorBase< ITK_TEMPLATE_1 x >)) \
  namespace Templates { typedef TreeIteratorBase< ITK_TEMPLATE_1 x > \
                                                  TreeIteratorBase##y; } \
  }

#if ITK_TEMPLATE_EXPLICIT
# include "Templates/itkTreeIteratorBase+-.h"
#endif

#if ITK_TEMPLATE_TXX
# include "itkTreeIteratorBase.txx"
#endif

#endif