This file is indexed.

/usr/include/gamera/graph/edgenodeiterator.hpp is in python-gamera-dev 3.3.3-2ubuntu1.

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
/*
 *
 * Copyright (C) 2011 Christian Brandt
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef _EDGENODEITERATOR_HPP_B2E5621C5D6D95
#define _EDGENODEITERATOR_HPP_B2E5621C5D6D95

#include "nodetraverseiterator.hpp"
#include "edge.hpp"

namespace Gamera { namespace GraphApi {

   
   
// -----------------------------------------------------------------------------
/// lazy iterator iterating over a NodeVector between given borders
class NodePtrIterator: public NodeTraverseIterator {
protected:
   NodeVector::iterator it;
   NodeVector::iterator _begin;
   NodeVector::iterator _end;

public:
   NodePtrIterator(Graph* graph, NodeIterator begin, NodeIterator end): 
         NodeTraverseIterator(graph) {

      _begin = begin;
      _end = end;
      it = begin;
   }

   Node* next() {
      if(it == _end)
         return NULL;
      
      Node* nextnode = *it;
      it++;
      return nextnode;
   }
};



// -----------------------------------------------------------------------------
/// lazy iterator over a complete NodeVector (given by pointer)
class NodeVectorPtrIterator: public NodePtrIterator {
protected:
   NodeVector* _vec;
public:
   NodeVectorPtrIterator(Graph* graph, NodeVector* vec): 
         NodePtrIterator(graph, vec->begin(), vec->end()) {
      _vec = vec;
   }

   ~NodeVectorPtrIterator() {
      delete _vec;
   }

};



// -----------------------------------------------------------------------------
/// lazy iterator iterating over a EdgeVector between given borders
/// returning all edges if from_node is NULL
/// returning edges with from_node as start_node
class EdgePtrIterator {
protected:
   EdgeVector::iterator it;
   EdgeVector::iterator _begin;
   EdgeVector::iterator _end;
   Graph* _graph;
   Node* _from;

public:
   EdgePtrIterator(Graph* graph, EdgeIterator begin, EdgeIterator end, 
         Node* from_node=NULL) {

      _graph = graph;
      _begin = begin;
      _end = end;
      it = begin;
      _from = from_node;
   }
   Edge* next() {
      if(it == _end)
         return NULL;
      Edge* nextedge = *it;
      it++;
      if(_from && nextedge->from_node != _from)
         return next();

      return nextedge;
   }
};



// -----------------------------------------------------------------------------
/// lazy iterator iterating over a EdgeVector between given borders
/// returning the nodes which are directly reachable starting at from_node
class NodePtrEdgeIterator: public EdgePtrIterator {
   Node* _from_node_node;
public:
   NodePtrEdgeIterator(Graph* graph, EdgeIterator begin, EdgeIterator end, 
         Node* from_node = NULL): 
      EdgePtrIterator(graph, begin, end, NULL) {
        _from_node_node = from_node; 
      }


   Node* next() {
      Edge* e = EdgePtrIterator::next();
      if(e == NULL)
         return NULL;

      Node* n = e->traverse(_from_node_node);
      if(n == NULL)
         return next();
      
      return n;
   }
};



}} // end Gamera::GraphApi
#endif /* _EDGENODEITERATOR_HPP_B2E5621C5D6D95 */