Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ring.h
Go to the documentation of this file.
1 
30 #pragma once
31 
33 
34 
35 #pragma GCC visibility push(default)
36 namespace abacus {
37 
38 template <class Type>
39 class AbaRing;
40 
41 template <class Type>
42 std::ostream &operator<< (std::ostream &out, const AbaRing<Type> &ring);
43 
44 
46 
52 template <class Type> class AbaRing : public AbacusRoot {
53 public:
54 
56 
59  explicit AbaRing(int size);
60 
62  virtual ~AbaRing() { }
63 
65 
74  friend std::ostream &operator<< <> (std::ostream &out, const AbaRing<Type> &ring);
75 
77 
82  Type& operator[](int i);
83 
85  const Type& operator[](int i) const;
86 
88 
94  void insert(Type elem);
95 
97  void clear();
98 
100  int size() const;
101 
103  int number() const;
104 
106 
109  Type oldest() const;
110 
112 
115  int oldestIndex() const;
116 
118 
121  Type newest() const;
122 
124 
127  int newestIndex() const;
128 
130 
140  int previous(int i, Type &p) const;
141 
143  bool empty() const;
144 
146  bool filled() const;
147 
149 
154  void realloc(int newSize);
155 
156 private:
157 
160 
162  int head_;
163 
165  bool filled_;
166 };
167 
168 }
169 
170 #include <ogdf/lib/abacus/ring.inc>
171 #pragma GCC visibility pop
abacus::AbaRing
Bounded circular lists.
Definition: ring.h:39
abacus::operator<<
std::ostream & operator<<(std::ostream &out, const Active< BaseType, CoType > &rhs)
abacusroot.h
abacus::AbaRing::newestIndex
int newestIndex() const
Returns the index of the newest element in the ring.
abacus
Definition: ILPClusterPlanarity.h:50
abacus::AbaRing::~AbaRing
virtual ~AbaRing()
The destructor.
Definition: ring.h:62
abacus::AbaRing::insert
void insert(Type elem)
Inserts a new element into the ring.
abacus::AbaRing::filled_
bool filled_
This member becomes true if ring is completely filled up.
Definition: ring.h:165
abacus::AbaRing::newest
Type newest() const
Returns the newest element in the ring.
abacus::AbaRing::oldest
Type oldest() const
Returns the oldest element in the ring.
abacus::AbacusRoot
Base class of all other classes of ABACUS.
Definition: abacusroot.h:69
abacus::AbaRing::clear
void clear()
Empties the ring.
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:219
abacus::AbaRing::ring_
Array< Type > ring_
An array storing the elements of the ring.
Definition: ring.h:159
abacus::AbaRing::previous
int previous(int i, Type &p) const
Can be used to access any element between the oldest and newest inserted element.
ring.inc
abacus::AbaRing::AbaRing
AbaRing(int size)
The constructor.
abacus::AbaRing::empty
bool empty() const
Returns true if no element is contained in the ring, false otherwise.
abacus::AbaRing::size
int size() const
Returns the size of the ring.
abacus::AbaRing::number
int number() const
Returns the current number of elements in the ring.
abacus::AbaRing::head_
int head_
The position in the array ring_ where the next element will be inserted.
Definition: ring.h:162
abacus::AbaRing::realloc
void realloc(int newSize)
Changes the length of the ring.
abacus::AbaRing::operator[]
Type & operator[](int i)
Returns the i-th element of the ring.
abacus::AbaRing::filled
bool filled() const
Returns true If the ring is completely filled up, false otherwise.
abacus::AbaRing::oldestIndex
int oldestIndex() const
Returns the index of the oldest element in the ring.