1
// ---------------------------------------------------------------------------
3
// - standard object library - circular cilo class definition -
4
// ---------------------------------------------------------------------------
5
// - This program is free software; you can redistribute it and/or modify -
6
// - it provided that this copyright notice is kept intact. -
8
// - This program is distributed in the hope that it will be useful, but -
9
// - without any warranty; without even the implied warranty of -
10
// - merchantability or fitness for a particular purpose. In no event shall -
11
// - the copyright holder be liable for any direct, indirect, incidental or -
12
// - special damages arising in any way out of the use of this software. -
13
// ---------------------------------------------------------------------------
14
// - copyright (c) 1999-2007 amaury darsch -
15
// ---------------------------------------------------------------------------
17
#ifndef AFNIX_CILO_HPP
18
#define AFNIX_CILO_HPP
20
#ifndef AFNIX_STRING_HPP
26
/// The Cilo class is a circular object container. By default, a cilo
27
/// for 64 objects is created. The constructor also accepts an integer
28
/// to preset size. Objects can be inserted with the 'add' method. When the
29
/// cilo is full, the first object is overwritten. An index can be used to
30
/// traverse and reterive an object at a given position.
31
/// @author amaury darsch
33
class Cilo : public virtual Object {
41
/// the traverse index
45
/// the allocated array
49
/// create a default cilo
52
/// create a cilo with a predefined allocated size
53
/// @param size the requested size
54
Cilo (const long size);
56
/// copy constructor for this cilo
57
/// @param that the cilo to copy
58
Cilo (const Cilo& that);
63
/// @return the class name
64
String repr (void) const;
66
/// add an object to this cilo
67
/// @param push the object to push
68
void add (Object* object);
70
/// @return true if the traverse object is at the top
71
bool istop (void) const;
73
/// @return true if the traverse object is at the bottom
74
bool isbottom (void) const;
76
/// @return the object by traversing upward
79
/// @return the object by traversing downward
80
Object* getdown (void);
83
// make the assignment operator private
84
Cilo& operator = (const Cilo&);