TextLoop.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2008 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/Util/units/TextLoop.h
10
11#ifndef __Pulsar_TextLoop_h
12#define __Pulsar_TextLoop_h
13
14#include "TextIndex.h"
15#include "Functor.h"
16#include <stack>
17
20{
21public:
22
24 TextLoop ();
25
28
30 void add_index (TextIndex*);
31
33 void loop ();
34
36 Functor< void() > job;
37
39 std::string get_index_state () const;
40
41protected:
42
44 typedef std::stack< Reference::To<TextIndex> > Stack;
45 Stack indeces;
46
49
51 void loop ( Stack& indeces );
52
54 std::string index_state;
55};
56
57#endif
Implements an adaptable function object in compliance with the STL.
Definition Functor.h:39
Manages Reference::To references to the instance.
Definition ReferenceAble.h:35
Template class manages Reference::Able objects.
Definition ReferenceTo.h:25
Parses and manages a named set of indeces.
Definition TextIndex.h:18
An array of Value interfaces.
Definition TextInterfaceParser.h:31
Reference::To< TextInterface::Parser > container
The container interface to configure on each loop.
Definition TextLoop.h:48
std::string index_state
Current state of each index.
Definition TextLoop.h:54
void loop()
Execute the job for each index in the stack.
Definition TextLoop.C:30
void set_container(TextInterface::Parser *)
Set the interface of the container to which the named indeces apply.
Definition TextLoop.C:24
TextLoop()
Default constructor.
Definition TextLoop.C:13
std::string get_index_state() const
Retrieve the index state.
Definition TextLoop.C:73
std::stack< Reference::To< TextIndex > > Stack
The indeces over which to loop.
Definition TextLoop.h:44
void add_index(TextIndex *)
Add an index over which to loop.
Definition TextLoop.C:18
Functor< void() > job
Job defined by derived types.
Definition TextLoop.h:36

Generated using doxygen 1.14.0