code::Enumeration Class Reference

List of all members.

Detailed Description

This creates a "enum" which unlike the C++ enum mechanism can be cast into a string .

.. But unlike a C++ enum, there is no efficient way to go from a String to an int.

     Enumeration fields;
     const Enumeration::Element Ref(fields, "Ref");
     const Enumeration::Element Vel(fields, "Vel");
     const Enumeration::Element Spw(fields, "Spw");

     for (int i=Ref; i < fields.Last; ++i){
        int no = fields[i];
        std::string name = fields[i];
        std::cout << no << " -> " << name << " \n";

code_Enumeration.h,v 1.2 2009/06/02 20:17:39 lakshman Exp

Public Member Functions

 Enumeration (size_t start=0)
Element add (const std::string &next)
const Elementoperator[] (const std::string &name) const
 WARNING! This method is inefficient as it involves a map lookup each time.
const Elementoperator[] (size_t i) const

Public Attributes

const size_t Start
size_t Last


class  Element

Constructor & Destructor Documentation

code::Enumeration::Enumeration ( size_t  start = 0  )  [inline]

Member Function Documentation

Element code::Enumeration::add ( const std::string &  next  )  [inline]

const Element& code::Enumeration::operator[] ( size_t  i  )  const [inline]

const Element& code::Enumeration::operator[] ( const std::string &  name  )  const [inline]

WARNING! This method is inefficient as it involves a map lookup each time.

There is also no error checking ...

Member Data Documentation

size_t code::Enumeration::Last

const size_t code::Enumeration::Start

Generated on Fri May 4 13:40:13 2012 for WDSS-IIw2 by  doxygen 1.4.7