siscone is hosted by Hepforge, IPPP Durham

The SISCone Jet Algorithm

Version 3.0.6



SISCone 3.0.6
circulator.h
1// -*- C++ -*-
3// File: circulator.h //
4// Description: header file for circulator (circulator class) //
5// This file is part of the SISCone project. //
6// For more details, see http://projects.hepforge.org/siscone //
7// //
8// Copyright (c) 2006 Gavin Salam and Gregory Soyez //
9// //
10// This program is free software; you can redistribute it and/or modify //
11// it under the terms of the GNU General Public License as published by //
12// the Free Software Foundation; either version 2 of the License, or //
13// (at your option) any later version. //
14// //
15// This program is distributed in the hope that it will be useful, //
16// but WITHOUT ANY WARRANTY; without even the implied warranty of //
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
18// GNU General Public License for more details. //
19// //
20// You should have received a copy of the GNU General Public License //
21// along with this program; if not, write to the Free Software //
22// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
23// //
24// $Revision:: 103 $//
25// $Date:: 2007-02-18 17:07:34 +0100 (Sun, 18 Feb 2007) $//
27
28#ifndef __CIRCULATOR_H__
29#define __CIRCULATOR_H__
30
31namespace siscone{
32
36template<class T> class circulator {
37
38public:
43 inline circulator(T here, T begin, T end) : m_here(here), m_begin(begin), m_end(end) {}
44
47 inline circulator(const circulator<T> & other) : m_here(other.m_here), m_begin(other.m_begin), m_end(other.m_end) {}
48
51 void set_position(const circulator<T> & other) {m_here = other.m_here;}
52
55 void set_position(T pointer) {m_here = pointer;}
56
58 T operator()() {return m_here;}
59
62 ++m_here;
63 if (m_here == m_end) m_here = m_begin;
64 return *this;
65 }
66
69 if (m_here == m_begin) m_here = m_end;
70 --m_here;
71 return *this;
72 }
73
77 bool operator==(const circulator & other) const {return m_here == other.m_here;}
78
82 bool operator!=(const circulator & other) const {return m_here != other.m_here;}
83
84private:
85 T m_here, m_begin, m_end;
86};
87
88}
89
90#endif // __CIRCULATOR_H__
a circulator that is foreseen to take as template member either a pointer or an iterator;
Definition: circulator.h:36
circulator< T > & operator++()
position incrementation
Definition: circulator.h:61
circulator(T here, T begin, T end)
ctor with iniitalisation from iterators
Definition: circulator.h:43
void set_position(T pointer)
set just the position without resetting the begin and end elements
Definition: circulator.h:55
bool operator!=(const circulator &other) const
check if the current elements are different NB: for efficiency, this checks only the here element
Definition: circulator.h:82
circulator(const circulator< T > &other)
copy ctor
Definition: circulator.h:47
circulator< T > & operator--()
position decrementation
Definition: circulator.h:68
T operator()()
get the current object
Definition: circulator.h:58
void set_position(const circulator< T > &other)
set just the position without resetting the begin and end elements
Definition: circulator.h:51
bool operator==(const circulator &other) const
check if the current elements are the same NB: for efficiency, this checks only the here element
Definition: circulator.h:77

The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated on Tue Jun 20 2023 18:08:37 for SISCone by  Doxygen 1.9.4