#ifndef EOPTION_H
#define EOPTION_H

#include "earray.h"
#include "estr.h"

class ebaseoption
{
 public:
  earray<estr> keys;

  int choice;

  int operator=(const estr&);
  
  estr key();

  estr choices();
  
  ebaseoption();
  ~ebaseoption();
};

template <class T>
class eoption : public ebaseoption
{
 public:
  earray<T> values;

  T& value();
  void add(const estr& key,const T& value);
};

template <class T>
T& eoption<T>::value()
{
  lddieif(choice==-1 || choice>values.size(),"no choice or out of bounds: "+estr(choice));
  return(values[choice]);
}

template <class T>
void eoption<T>::add(const estr& key,const T& value)
{
  keys.add(key);
  values.add(value);
}

#endif

