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 
19 class TextLoop : public Reference::Able
20 {
21 public:
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 
41 protected:
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
void add_index(TextIndex *)
Add an index over which to loop.
Definition: TextLoop.C:18
Reference::To< TextInterface::Parser > container
The container interface to configure on each loop.
Definition: TextLoop.h:53
TextLoop()
Default constructor.
Definition: TextLoop.C:13
void loop()
Execute the job for each index in the stack.
Definition: TextLoop.C:30
A convenient exception handling class.
Definition: Error.h:54
An array of Value interfaces.
Definition: TextInterfaceParser.h:35
std::string get_index_state() const
Retrieve the index state.
Definition: TextLoop.C:73
Manages Reference::To references to the instance.
Definition: ReferenceAble.h:40
Implements an adaptable function object in compliance with the STL.
Definition: Functor.h:39
void set_container(TextInterface::Parser *)
Set the interface of the container to which the named indeces apply.
Definition: TextLoop.C:24
std::string index_state
Current state of each index.
Definition: TextLoop.h:59
Functor< void() > job
Job defined by derived types.
Definition: TextLoop.h:41
std::stack< Reference::To< TextIndex > > Stack
The indeces over which to loop.
Definition: TextLoop.h:49
Loop through ranges of indeces ascertained by a TextInterface.
Definition: TextLoop.h:19
Parses and manages a named set of indeces.
Definition: TextIndex.h:17

Generated using doxygen 1.8.17