TextIndex.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2007 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/Util/units/TextIndex.h
10 
11 #ifndef __TextIndex_h
12 #define __TextIndex_h
13 
14 #include "TextInterface.h"
15 
17 class TextIndex : public Reference::Able
18 {
19  public:
20 
22  TextIndex (const std::string& named_range);
23 
26 
28 
29  void set_size_name (const std::string& name);
30 
32  unsigned size () const;
33 
35  std::string get_index (unsigned i);
36 
38  std::string get_current_index ();
39 
40  protected:
41 
44 
46  std::string name;
47 
49  std::string size_name;
50 
52  std::string range;
53 
55  std::vector<unsigned> indeces;
56 
57 };
58 
59 #endif
std::string get_current_index()
Get the index command for the current index.
Definition: TextIndex.C:59
std::string name
The name of the index.
Definition: TextIndex.h:51
A convenient exception handling class.
Definition: Error.h:54
std::string get_value(const std::string &name) const
Get the named value.
Definition: TextInterfaceParser.C:223
unsigned size() const
Get the number of indeces.
Definition: TextIndex.C:64
An array of Value interfaces.
Definition: TextInterfaceParser.h:35
void set_container(TextInterface::Parser *)
Set the interface to the container to which the named index applies.
Definition: TextIndex.C:34
std::string get_index(unsigned i)
Get the index command for the specified index.
Definition: TextIndex.C:50
Reference::To< TextInterface::Parser, false > container
The text interface to the container.
Definition: TextIndex.h:48
Manages Reference::To references to the instance.
Definition: ReferenceAble.h:40
void set_size_name(const std::string &name)
Set the name of the index dimension size in the container interface.
Definition: TextIndex.C:44
std::string size_name
The name of the index dimension in the container.
Definition: TextIndex.h:54
std::vector< unsigned > indeces
The indeces.
Definition: TextIndex.h:60
std::string range
The range of the index set.
Definition: TextIndex.h:57
Parses and manages a named set of indeces.
Definition: TextIndex.h:17
TextIndex(const std::string &named_range)
Construct from string of the form 'name=[range]'.
Definition: TextIndex.C:14

Generated using doxygen 1.8.17