This file is indexed.

/usr/include/BALL/CONCEPT/baseIterator.h is in libball1.4-dev 1.4.3~beta1-4.

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
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//

#ifndef BALL_CONCEPT_BASEITERATOR_H
#define BALL_CONCEPT_BASEITERATOR_H

#ifndef BALL_CONFIG_CONFIG_H
#	include <BALL/CONFIG/config.h>
#endif

#ifndef BALL_COMMON_GLOBAL_H
#	include <BALL/COMMON/global.h>
#endif

#ifndef BALL_COMMON_EXCEPTION_H
#	include <BALL/COMMON/exception.h>
#endif

namespace BALL 
{

	/**	Generic Iterator Class.
			This template class implements the basic behaviour of an iterator.
			Iterators are basically STL-like iterators. They provide the full STL
			iterator interface, but also offer additional features.
			\par

			BaseIterator itself is a base class to the other iterator classes only
			and should not be used by itself.
			\par
	
	 		An important difference exists for the iterators of the kernel objects.
			For most kernel objects, multiple iterators exist.  Therefore, we could
			not simply use <tt>begin()</tt> and <tt>end()</tt> like in STL, but we
			introduced specialized methods like
			\link AtomContainer::beginAtom AtomContainer::beginAtom \endlink and
			\link AtomContainer::endAtom AtomContainer::endAtom \endlink. For
			similar reasons, the iterators for kernel classes are not implemented as
			nested classes of the respective kernel classes, but as independent
			classes to avoid code replication. An exception is
			\link Atom::BondIterator Atom::BondIterator \endlink , which is
			relevant to \link Atom Atom \endlink alone.
			\par

			Each BALL iterator can be bound to a container, so once the iteration
			has started, it "knows" about the end() of the container.  Therefore,
			BALL iterators additionally implement the unary plus operator to
			check for the validity of the iterator.  this allows the convenient
			implementation of for loops, e.g. as follows: 
			\par
 
			\code
				AtomIterator atom_it = system.beginAtom();
				for (; +atom_it; ++atom_it)
				{
					....
				}
			\endcode
			
	 	 \ingroup  ConceptsIterators
	*/
	template <typename Container, typename DataType, typename Position, typename Traits>
	class BaseIterator
	{
		public:

		/**	@name Typedefs.
				The names of these typedefs deviate from the usual
				BALL class names due to restrictions imposed by STL compliance.
		*/
		//@{		
		///
		typedef DataType	value_type;
		///
		typedef Position	difference_type;
		///
		typedef	const DataType*	pointer;
		///
		typedef const DataType&	reference;
		///
		typedef std::input_iterator_tag iterator_category;
		//@}

		/**	@name	Constructors and Destructors 
		*/
		//@{
		///	Default constructor
		BALL_INLINE BaseIterator()  {}
	
		///	Copy constructor
		BALL_INLINE BaseIterator(const BaseIterator& iterator) 
			:	traits_(iterator.traits_)
		{
		}

		///	Destructor.
		BALL_INLINE ~BaseIterator()  {}
		//@}

		/**	@name	Assignment
		*/
		//@{

		/**	Assignment operator.
				Assigns the contents of an iterator to another iterator.
				@param	iterator the iterator to be copied
		*/
		BALL_INLINE BaseIterator& operator = (const BaseIterator& iterator) 
		{
			traits_ = iterator.traits_;
			return *this;
		}
			
		///	Swap two iterators
		BALL_INLINE void swap(BaseIterator& iterator)  { std::swap(traits_, iterator.traits_); }
		//@}

		/**	@name	 Accessors 
		*/
		//@{

		/// Invalidate the iterator.
		BALL_INLINE void invalidate()  { traits_.invalidate(); }

		/// Set the traits
		BALL_INLINE void setTraits(const Traits& traits)  { traits_ = traits; }

		/// Get a constant reference to the traits of this iterator.
		BALL_INLINE const Traits& getTraits() const  { return traits_; }

		/// Get a constant reference to the traits of this iterator.
		BALL_INLINE Traits& getTraits()  { return traits_; }

		/// Get a constant pointer to the container of this iterator.
		BALL_INLINE const Container* getContainer() const	 { return traits_.getContainer(); }
		//@}

		/** @name Converters
		*/
		//@{

		/** Convert an iterator to Position.
				This method returns the position of the iterator. Note that
				Position is a template within this context and not the BALL datatype.
		*/
		BALL_INLINE operator const Position& () const  { return traits_.getPosition(); }

		/// Convert an iterator to its Datatype by returning a reference to the current data.
		BALL_INLINE reference operator * () const  { return (reference)traits_.getData(); }

		/// Return a pointer to the current data.
		BALL_INLINE pointer operator -> () const  { return (pointer)&traits_.getData(); }
		//@}

		/**	@name	Predicates
		*/
		//@{

		/// Equality operator
		BALL_INLINE bool operator == (const BaseIterator& iterator) const  { return (traits_ == iterator.traits_); }

		/// Inequality operator
		BALL_INLINE bool operator != (const BaseIterator& iterator) const  { return !(traits_ == iterator.traits_); }

		/** Singularity predicate.
				This method returns <b>true</b> if the iterator is singular, i.e., 
				not associated with a container.
		*/
		BALL_INLINE bool isSingular() const	 { return traits_.isSingular(); }

		/** Validity predicate
				@return true if the iterator is valid (pointing at an element in a container) 
		*/
		BALL_INLINE bool isValid() const  { return traits_.isValid(); }

		/// Validity predicate
		BALL_INLINE bool operator + () const  { return traits_.isValid(); }

		/// Invalidity perdicate
		BALL_INLINE bool operator - () const  { return !traits_.isValid(); }
		//@}

		protected:

		/** Constructor.
				Protected to allow instantiation and use in derived classes only.
		*/
		BALL_INLINE BaseIterator(const Container& container) 
			:	traits_(container)
		{
		}

		private:

		/// The instance of the iterator's traits
		Traits traits_;
	};


} // namespace BALL

#endif // BALL_CONCEPT_BASEITERATOR_H