1
// ---------------------------------------------------------------------------
3
// - standard object library - iterable abstract 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_ITERABLE_HPP
18
#define AFNIX_ITERABLE_HPP
20
#ifndef AFNIX_ITERATOR_HPP
21
#include "Iterator.hpp"
26
/// The Iterable class is an abstract class which define the virtual method
27
/// "makeit" for a class which is iterable. If an object is iterable,
28
/// an iterator can be constructed for that object. Once the
29
/// iterator is constructed, it is possible to iterate in this object.
30
/// When an iterator is constructed, the container is marked locked and
31
/// and a read lock is taken by the iterator. This means that nothing can
32
/// be written in the container.
33
/// @author amaury darsch
35
class Iterable : public virtual Object {
37
/// @return a new iterator for this object
38
virtual Iterator* makeit (void) =0;
40
/// @return true if the given quark is defined
41
bool isquark (const long quark, const bool hflg) const;
43
/// apply this object with a set of arguments and a quark
44
/// @param robj the current runnable
45
/// @param nset the current nameset
46
/// @param quark the quark to apply these arguments
47
/// @param argv the arguments to apply
48
Object* apply (Runnable* robj, Nameset* nset, const long quark,