/usr/include/siscone/circulator.h is in libsiscone-dev 2.0.6-2.
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 | // -*- C++ -*-
///////////////////////////////////////////////////////////////////////////////
// File: circulator.h //
// Description: header file for circulator (circulator class) //
// This file is part of the SISCone project. //
// For more details, see http://projects.hepforge.org/siscone //
// //
// Copyright (c) 2006 Gavin Salam and Gregory Soyez //
// //
// 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 St, Fifth Floor, Boston, MA 02110-1301, USA //
// //
// $Revision:: 103 $//
// $Date:: 2007-02-18 17:07:34 +0100 (Sun, 18 Feb 2007) $//
///////////////////////////////////////////////////////////////////////////////
#ifndef __CIRCULATOR_H__
#define __CIRCULATOR_H__
namespace siscone{
/// \class circulator
/// a circulator that is foreseen to take as template member either a
/// pointer or an iterator;
template<class T> class circulator {
public:
/// ctor with iniitalisation from iterators
/// \param here the current position
/// \param begin the first position
/// \param end the last position
inline circulator(T here, T begin, T end) : m_here(here), m_begin(begin), m_end(end) {}
/// copy ctor
/// \param other the circulator to copy
inline circulator(const circulator<T> & other) : m_here(other.m_here), m_begin(other.m_begin), m_end(other.m_end) {}
/// set just the position without resetting the begin and end elements
/// \param other the circulator to grab position from
void set_position(const circulator<T> & other) {m_here = other.m_here;}
/// set just the position without resetting the begin and end elements
/// \param pointer the iterator to use as the new position
void set_position(T pointer) {m_here = pointer;}
/// get the current object
T operator()() {return m_here;}
/// position incrementation
inline circulator<T> & operator++() {
++m_here;
if (m_here == m_end) m_here = m_begin;
return *this;
}
/// position decrementation
inline circulator<T> & operator--() {
if (m_here == m_begin) m_here = m_end;
--m_here;
return *this;
}
/// check if the current elements are the same
/// NB: for efficiency, this checks only the here element
/// \param other the circulator to compare to the current one
bool operator==(const circulator & other) const {return m_here == other.m_here;}
/// check if the current elements are different
/// NB: for efficiency, this checks only the here element
/// \param other the circulator to compare to the current one
bool operator!=(const circulator & other) const {return m_here != other.m_here;}
private:
T m_here, m_begin, m_end; ///< the current, beginning and ending iterators/pointers
};
}
#endif // __CIRCULATOR_H__
|