This file is indexed.

/usr/include/vigra/graph_item_impl.hxx is in libvigraimpex-dev 1.10.0+git20160211.167be93+dfsg-2+b5.

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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
#ifndef VIGRA_NODE_IMPL_HXX
#define VIGRA_NODE_IMPL_HXX



/*vigra*/
#include "algorithm.hxx"
#include "tinyvector.hxx"
#include "random_access_set.hxx"
#include "iteratorfacade.hxx"





namespace vigra{

    /*
        within this namespace we implement 
        filter to provide generic lemon iterators
        for a single incEdgeIterator like iterator
        
        These Iterators are used by:
        - AdjacencyListGraph
        - MergeGraphAdaptor
    */
    namespace detail{

        /*
            a filter is a functor 
            which makes an lemon iterator 
            from a std::set<Adjacency<...> >::const_iterator like
            iterator.
            Using these filters will reduce the code 
            needed to implement lemon compatible iterators
        */

        // filter to iterate over neighbor nodes for
        // for a given node
        template<class GRAPH>
        struct NeighborNodeFilter{
            typedef typename GRAPH::Node ResultType;
            typedef typename GRAPH::NodeStorage::AdjacencyElement AdjacencyElement;

            static bool valid(
                const GRAPH & g,
                const AdjacencyElement & adj,
                const typename GRAPH::index_type ownNodeId
            ){
                return true;
            }


             static ResultType transform(
                const GRAPH & g,
                const AdjacencyElement & adj,
                const typename GRAPH::index_type ownNodeId
            ){
                return g.nodeFromId(adj.nodeId());    
            }

            static const bool IsFilter = false ; 
        };

        template<class GRAPH>
        struct IncEdgeFilter{
            typedef typename GRAPH::Edge ResultType;
            typedef typename GRAPH::NodeStorage::AdjacencyElement AdjacencyElement;

            static bool valid(
                const GRAPH & g,
                const AdjacencyElement & adj,
                const typename GRAPH::index_type ownNodeId
            ){
                return true;
            }

            static ResultType transform(
                const GRAPH & g,
                const AdjacencyElement & adj,
                const typename GRAPH::index_type ownNodeId
            ){
                return g.edgeFromId(adj.edgeId());    
            }

            static const bool IsFilter = false ; 
        };

        template<class GRAPH>
        struct BackEdgeFilter{
            typedef typename GRAPH::Edge ResultType;
            typedef typename GRAPH::NodeStorage::AdjacencyElement AdjacencyElement;
            
            static bool valid(
                const GRAPH & g,
                const AdjacencyElement & adj,
                const typename GRAPH::index_type ownNodeId
            ){
                return adj.nodeId() < ownNodeId;
            } 

            static ResultType transform(
                const GRAPH & g,
                const AdjacencyElement & adj,
                const typename GRAPH::index_type ownNodeId
            ){
                return g.edgeFromId(adj.edgeId());
            }

            static const bool IsFilter = true ; 
        };
        template<class GRAPH>
        struct IsBackOutFilter{
            typedef typename GRAPH::Arc ResultType;
            typedef typename GRAPH::NodeStorage::AdjacencyElement AdjacencyElement;
            
            static bool valid(
                const GRAPH & g,
                const AdjacencyElement & adj,
                const typename GRAPH::index_type ownNodeId
            ){
                return adj.nodeId() < ownNodeId;
            } 
            static ResultType transform(
                const GRAPH & g,
                const AdjacencyElement & adj,
                const typename GRAPH::index_type ownNodeId
            ){
                return g.direct(g.edgeFromId(adj.edgeId()) ,g.nodeFromId(ownNodeId));
            }

            static const bool IsFilter = true ; 
        };
        template<class GRAPH>
        struct IsOutFilter{
            typedef typename GRAPH::Arc ResultType;
            typedef typename GRAPH::NodeStorage::AdjacencyElement AdjacencyElement;
            
            static bool valid(
                const GRAPH & g,
                const AdjacencyElement & adj,
                const typename GRAPH::index_type ownNodeId
            ){
                return  true;
            } 
            static ResultType transform(
                const GRAPH & g,
                const AdjacencyElement & adj,
                const typename GRAPH::index_type ownNodeId
            ){
                return g.direct(g.edgeFromId(adj.edgeId()) ,g.nodeFromId(ownNodeId));
            }

            static const bool IsFilter = false ; 
        };



        template<class GRAPH>
        struct IsInFilter{
            typedef typename GRAPH::Arc ResultType;
            typedef typename GRAPH::NodeStorage::AdjacencyElement AdjacencyElement;
            
            static bool valid(
                const GRAPH & g,
                const AdjacencyElement & adj,
                const typename GRAPH::index_type ownNodeId
            ){
                return  true;
            } 
            ResultType static transform(
                const GRAPH & g,
                const AdjacencyElement & adj,
                const typename GRAPH::index_type ownNodeId
            ){
                return g.direct(g.edgeFromId(adj.edgeId()) ,g.nodeFromId(adj.nodeId()));
            }
            static const bool IsFilter = false ; 
        };

        template<class GRAPH,class NODE_IMPL,class FILTER>    
        class GenericIncEdgeIt
        : public ForwardIteratorFacade<
            GenericIncEdgeIt<GRAPH,NODE_IMPL,FILTER>,
            typename FILTER::ResultType,true
        >
        {
        public:

            typedef GRAPH Graph;
            typedef typename Graph::index_type index_type;
            typedef typename Graph::NodeIt NodeIt;
            typedef typename Graph::Edge Edge;
            typedef typename Graph::Node Node;
            typedef typename FILTER::ResultType ResultItem;
            //typedef typename GraphItemHelper<GRAPH,typename FILTER::ResultType>  ResultItem

            // default constructor
            GenericIncEdgeIt(const lemon::Invalid & invalid = lemon::INVALID)
            :   nodeImpl_(NULL),
                graph_(NULL),
                ownNodeId_(-1),
                adjIter_(),
                resultItem_(lemon::INVALID){
            }   
            // from a given node iterator
            GenericIncEdgeIt(const Graph & g , const NodeIt & nodeIt)
            :   nodeImpl_(&g.nodeImpl(*nodeIt)),
                graph_(&g),
                ownNodeId_(g.id(*nodeIt)),
                adjIter_(g.nodeImpl(*nodeIt).adjacencyBegin()),
                resultItem_(lemon::INVALID){

                if(FILTER::IsFilter){
                    while(adjIter_!=nodeImpl_->adjacencyEnd() && !FILTER::valid(*graph_,*adjIter_,ownNodeId_) ) {
                        ++adjIter_;
                    }
                }
            }

            // from a given node
            GenericIncEdgeIt(const Graph & g , const Node & node)
            :   nodeImpl_(&g.nodeImpl(node)),
                graph_(&g),
                ownNodeId_(g.id(node)),
                adjIter_(g.nodeImpl(node).adjacencyBegin()),
                resultItem_(lemon::INVALID){

                if(FILTER::IsFilter){
                    while(adjIter_!=nodeImpl_->adjacencyEnd() && !FILTER::valid(*graph_,*adjIter_,ownNodeId_) ) {
                        ++adjIter_;
                    }
                }
            }

        private:
            friend class vigra::IteratorFacadeCoreAccess;

            typedef NODE_IMPL NodeImpl;
            typedef typename NodeImpl::AdjIt AdjIt;

            bool isEnd()const{
                return  (nodeImpl_==NULL  || adjIter_==nodeImpl_->adjacencyEnd());      
            }
            bool isBegin()const{
                return (nodeImpl_!=NULL &&  adjIter_==nodeImpl_->adjacencyBegin());
            }
            bool equal(const GenericIncEdgeIt<GRAPH,NODE_IMPL,FILTER> & other)const{
                if(isEnd() && other.isEnd()){
                    return true;
                }
                else if (isEnd() != other.isEnd()){
                    return false;
                }
                else{
                    return adjIter_==other.adjIter_;
                }
            }

            void increment(){
                ++adjIter_;
                if(FILTER::IsFilter){
                    while(adjIter_!=nodeImpl_->adjacencyEnd() && !FILTER::valid(*graph_,*adjIter_,ownNodeId_)){
                        ++adjIter_;
                    }
                }
            }

            // might no need to make this constant
            // therefore we would lose the "mutabe"
            const ResultItem & dereference()const{
                resultItem_ =  FILTER::transform(*graph_,*adjIter_,ownNodeId_);
                return resultItem_;
            }


            const NODE_IMPL * nodeImpl_;
            const GRAPH     * graph_;
            const index_type  ownNodeId_;
            AdjIt adjIter_;
            mutable ResultItem resultItem_;
        };

        // an element in the implementation
        // of adjacency list
        // End users will not notice this class
        // => implementation detail
        template<class T>
        class Adjacency {
        public:
            typedef T Value;

            Adjacency(const Value nodeId, const Value edgeId)
            :   nodeId_(nodeId),
                edgeId_(edgeId){

            }
            Value  nodeId() const{
                return nodeId_;
            }
            Value& nodeId(){
                return nodeId_;
            }
            Value  edgeId() const{
                return edgeId_;
            }
            Value& edgeId(){
                return edgeId_;
            }
            bool operator<(const Adjacency<Value> & other) const{
                return  nodeId_ < other.nodeId_;
            }
        private:
            Value nodeId_;
            Value edgeId_;
        };


        // an element in the implementation
        // of adjacency list
        // End users will not notice this class
        // => implementation detail
        template<class INDEX_TYPE,bool USE_STL_SET>
        class GenericNodeImpl{

            public:
                typedef INDEX_TYPE index_type;
                typedef Adjacency<index_type>    AdjacencyElement;
                typedef std::set<AdjacencyElement >        StdSetType;
                typedef RandomAccessSet<AdjacencyElement > RandAccessSet;
                typedef typename IfBool<USE_STL_SET,StdSetType,RandAccessSet>::type SetType;

                typedef typename SetType::const_iterator AdjIt;
            public:

                GenericNodeImpl(const lemon::Invalid iv=lemon::INVALID)
                :  id_(-1){
                }

                GenericNodeImpl(const index_type id)
                :   id_(id){
                 }
                // query
                size_t numberOfEdges()const{return adjacency_.size();}
                size_t edgeNum()const{return adjacency_.size();}
                size_t num_edges()const{return adjacency_.size();}

                //bool hasEdgeId(const index_type edge)const{return edges_.find(edge)!=edges_.end();}

                // modification
                void  merge(const GenericNodeImpl & other){
                    adjacency_.insert(other.adjacency_.begin(),other.adjacency_.end());
                }

                void setId(const index_type id){
                    id_=id;
                }
                
                std::pair<index_type,bool> findEdge(const index_type nodeId)const{
                    AdjIt iter = adjacency_.find(AdjacencyElement(nodeId,0));
                    if(iter==adjacency_.end()){
                        return std::pair<index_type,bool>(-1,false);
                    }
                    else{
                        return std::pair<index_type,bool>(iter->edgeId(),true);
                    }
                }



                void insert(const index_type nodeId,const index_type edgeId){
                    adjacency_.insert(AdjacencyElement(nodeId,edgeId));
                }

                AdjIt adjacencyBegin()const{
                    return adjacency_.begin();
                }
                AdjIt adjacencyEnd()const{
                    return adjacency_.end();
                }


                index_type id()const{
                    return id_;
                }


                void eraseFromAdjacency(const index_type nodeId){
                    // edge id does not matter?
                    adjacency_.erase(AdjacencyElement(nodeId,0));
                }

                void clear(){
                    adjacency_.clear();
                    id_=-1;
                }

                SetType adjacency_;
                index_type id_;
        };

        template<class INDEX_TYPE>
        class GenericEdgeImpl
        :  public vigra::TinyVector<INDEX_TYPE,3> {
                // public typedefs
            public:
                typedef INDEX_TYPE index_type;

                GenericEdgeImpl(const lemon::Invalid iv=lemon::INVALID)
                :    vigra::TinyVector<INDEX_TYPE,3>(-1){
                }

                GenericEdgeImpl(const index_type u,const index_type v, const index_type id)   
                :    vigra::TinyVector<INDEX_TYPE,3>(u,v,id){
                }
            // public methods
            public:
                index_type u()const{return this->operator[](0);}
                index_type v()const{return this->operator[](1);}
                index_type id()const{return this->operator[](2);}
            private:
        };


        template<class INDEX_TYPE>
        class GenericEdge;

        template<class INDEX_TYPE>
        class GenericArc{
        public:
            typedef INDEX_TYPE index_type;

            GenericArc(const lemon::Invalid & iv = lemon::INVALID)
            :   id_(-1),
                edgeId_(-1){

            }



            GenericArc(
                const index_type id,
                const index_type edgeId = static_cast<index_type>(-1) 
            )
            :   id_(id),
                edgeId_(edgeId){

            }
            index_type id()const{return id_;}
            index_type edgeId()const{return edgeId_;}

            operator GenericEdge<INDEX_TYPE> () const{
                return GenericEdge<INDEX_TYPE>(edgeId());
            }

            bool operator == (const GenericArc<INDEX_TYPE> & other )const{
                return id_ == other.id_;
            }
            bool operator != (const GenericArc<INDEX_TYPE> & other )const{
                return id_ != other.id_;
            }
            bool operator < (const GenericArc<INDEX_TYPE> & other )const{
                return id_ < other.id_;
            }
            bool operator > (const GenericArc<INDEX_TYPE> & other )const{
                return id_ > other.id_;
            }



        private:
            index_type id_;
            index_type edgeId_;
        };

        template<class INDEX_TYPE>
        class GenericEdge{
        public:
            typedef INDEX_TYPE index_type;

            GenericEdge(const lemon::Invalid & iv = lemon::INVALID)
            : id_(-1){

            }

            GenericEdge(const index_type id )
            : id_(id){

            }

            GenericEdge(const GenericArc<INDEX_TYPE> & arc)
            :   id_(arc.edgeId())
            {
            }

            bool operator == (const GenericEdge<INDEX_TYPE> & other )const{
                return id_ == other.id_;
            }
            bool operator != (const GenericEdge<INDEX_TYPE> & other )const{
                return id_ != other.id_;
            }
            bool operator < (const GenericEdge<INDEX_TYPE> & other )const{
                return id_ < other.id_;
            }
            bool operator > (const GenericEdge<INDEX_TYPE> & other )const{
                return id_ > other.id_;
            }
            bool operator <= (const GenericEdge<INDEX_TYPE> & other )const{
                return id_ <= other.id_;
            }
            bool operator >= (const GenericEdge<INDEX_TYPE> & other )const{
                return id_ >= other.id_;
            }


            index_type id()const{return id_;}
        private:
            index_type id_;
        };


        template<class INDEX_TYPE>
        class GenericNode{
        public:
            typedef INDEX_TYPE index_type;

            GenericNode(const lemon::Invalid & iv = lemon::INVALID)
            : id_(-1){

            }

            GenericNode(const index_type id  )
            : id_(id){
                
            }
            bool operator == (const GenericNode<INDEX_TYPE> & other )const{
                return id_ == other.id_;
            }
            bool operator != (const GenericNode<INDEX_TYPE> & other )const{
                return id_ != other.id_;
            }
            bool operator < (const GenericNode<INDEX_TYPE> & other )const{
                return id_ < other.id_;
            }
            bool operator > (const GenericNode<INDEX_TYPE> & other )const{
                return id_ > other.id_;
            }

            index_type id()const{return id_;}
        private:
            index_type id_;
        };

    } // namespace detail
} // end namespace vigra

namespace std {

template<class INDEX_TYPE>
ostream & operator<<(ostream & o, vigra::detail::GenericNode<INDEX_TYPE> const & n)
{
    o << "Node(" << n.id() << ")";
    return o;
}

template<class INDEX_TYPE>
ostream & operator<<(ostream & o, vigra::detail::GenericEdge<INDEX_TYPE> const & e)
{
    o << "Edge(" << e.id() << ")";
    return o;
}

}

#endif // VIGRA_NODE_IMPL_HXX