// file: $isip/class/pr/ProductionRuleTokenType/ProductionRuleTokenType.h
// version: $Id: ProductionRuleTokenType.h 10419 2006-02-03 21:51:48Z slee $

#ifndef ISIP_PRODUCTIONRULETOKENTYPE
#define ISIP_PRODUCTIONRULETOKENTYPE

//---------------------------------------------------------------------------
//
// ISIP include files
//
//---------------------------------------------------------------------------

#ifndef ISIP_STRING
#include <String.h>
#endif

#ifndef ISIP_FILENAME
#include <Filename.h>
#endif

#ifndef ISIP_FILE
#include <File.h>
#endif

#ifndef ISIP_DEBUGLEVEL
#include <DebugLevel.h>
#endif

#ifndef ISIP_SOF
#include <Sof.h>
#endif

class ProductionRuleTokenType {
public:  
  
  //---------------------------------------------------------------------------
  //
  // public constants
  //
  //---------------------------------------------------------------------------
public:
  
  // constant: class name
  //
  static const String CLASS_NAME;
  
  //---------------------------------------
  //
  // tokens
  //
  //---------------------------------------
  //
  enum TYPE {NONE=0, CONCATENATION, KLEENE_STAR, KLEENE_PLUS, ALTERNATION,
	     OPEN_PAREN, CLOSE_PAREN, OPEN_BRACE, CLOSE_BRACE, EPSILON,
	     TERMINAL, NON_TERMINAL};

  static const NameMap TYPE_MAP;

  //---------------------------------------
  //
  // file i/o constants
  //
  //---------------------------------------
  //

  static const String DEF_PARAM;
  static const String PARAM_TYPE;
  static const String BLOCK_START_STR;
  static const String BLOCK_DELIM_STR;
  static const String BLOCK_END_STR;
  static const String BLOCK_TERM_STR;
  static const long DEF_TAG;
  
  //---------------------------------------
  //
  // error codes
  //
  //---------------------------------------
  //
  
  //---------------------------------------------------------------------------
  //
  // protected data
  //
  //---------------------------------------------------------------------------

protected:
  
  // debug level
  //
  DebugLevel debug_level_d;

  TYPE type_d;
 
  //---------------------------------------------------------------------------
  //
  // required public methods
  //
  //---------------------------------------------------------------------------
public:
  
  // method: name
  //
  static const String& name() {
    return CLASS_NAME;
  } 
  
  // method: diagnose
  //
  static boolean diagnose(Integral::DEBUG level);
  
  // method: debug
  //
  boolean debug(const unichar* msg) const;
  
  // constructor
  //
  ProductionRuleTokenType ();
  
  // method: read
  //
  boolean read(Sof& sof, long tag, const String& cname = CLASS_NAME);
  
  // method: readData
  //
  boolean readData(Sof& sof, const String& pname = DEF_PARAM,
		   long size = SofParser::FULL_OBJECT, boolean param = true,
		   boolean nested = false);
  
  // method: write
  //
  boolean write(Sof& sof, long tag, const String& cname = CLASS_NAME) const;
  
  // method: writeData
  //
  boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;
  
  // method: sofSize
  //
  long sofSize() const;
  
  // method: assign
  //
  boolean assign(const ProductionRuleTokenType& prdrl_a); 
  
  // method: operator=
  //
  boolean operator=(const ProductionRuleTokenType& prdrl_a);
  
  // method: eq
  //
  boolean eq(const ProductionRuleTokenType& prdrl_a) const;
  
  // method: operator==
  //
  boolean operator==(const ProductionRuleTokenType& prdrl_a) const;
  
  // method: clear
  //
  boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);
  
  //---------------------------------------------------------------------------
  //
  // class-specific public methods
  //
  //---------------------------------------------------------------------------
public: 

  // method: setDebug
  //
  boolean setDebug(Integral::DEBUG level) {
    debug_level_d = level;
    return true;
  }

  TYPE getType() {
    return type_d;
  }

  bool setType(ProductionRuleTokenType::TYPE type_a) {
    type_d=type_a;
    return true;
  }

  bool setType(const String& type_a);
  
  //---------------------------------------------------------------------------
  //
  // class-specific protected methods
  //
  //---------------------------------------------------------------------------
protected:
  
};

#endif
