// file: $isip/class/search/SearchSymbol/SearchSymbol.h
// version: $Id: SearchSymbol.h 8340 2002-07-11 03:42:34Z picone $
//

// make sure definitions are only made once
//
#ifndef ISIP_SEARCH_SYMBOL
#define ISIP_SEARCH_SYMBOL

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

// SearchSymbol: a class to hold a symbol representing some part of the search
//
class SearchSymbol : public String {

  //---------------------------------------------------------------------------
  //
  // public constants
  //
  //---------------------------------------------------------------------------
public:

  // define the class name
  //
  static const String CLASS_NAME;

  //----------------------------------------
  //
  // i/o related constants
  //
  //----------------------------------------  

  static const String DEF_PARAM;
  static const SearchSymbol NO_LEFT_CONTEXT;
  static const SearchSymbol NO_RIGHT_CONTEXT;
  
  //----------------------------------------
  //
  // default values and arguments
  //
  //----------------------------------------  

  //---------------------------------------
  //
  // error codes
  //
  //---------------------------------------

  static const long ERR = (long)90400;
  
  //---------------------------------------------------------------------------
  //
  // protected data
  //
  //---------------------------------------------------------------------------
protected:

  // the underlying string data is inherited from the String class
  //
  
  // define a static memory manager
  //
  static MemoryManager mgr_d;
  
  // define a static debug level
  //
  static Integral::DEBUG debug_level_d;
  
  //---------------------------------------------------------------------------
  //
  // required public methods
  //
  //---------------------------------------------------------------------------
public:

  // method: name
  //
  static const String& name() {
    return CLASS_NAME;
  }

  // other static methods
  //
  static boolean diagnose(Integral::DEBUG debug_level);

  // method: setDebug
  //
  static boolean setDebug(Integral::DEBUG debug_level) {
    debug_level_d = debug_level;
    return true;
  }
  
  // method: destructor
  //
  ~SearchSymbol() {}

  // method: default constructor
  //
  SearchSymbol() {}

  // method: copy constructor
  //
  SearchSymbol(const SearchSymbol& copy_sym) {
    assign(copy_sym);
  }
  
  // assign methods:
  //  the copy assign method is inherited from the String class
  //

  // method: operator=
  //
  SearchSymbol& operator=(const SearchSymbol& arg) {
    assign(arg);
    return *this;
  }
  
  // i/o methods
  //
  // method: sofSize
  //
  long sofSize() const {
    return String::sofSize();
  }

  // readData and writeData are inherited from the String class
  //
  boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);
  boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;

  // method: new
  //
  static void* operator new(size_t size) {
    return mgr_d.get();
  }

  // method: new[]
  //
  static void* operator new[](size_t size) {
    return mgr_d.getBlock(size);
  }

  // method: delete
  //
  static void operator delete(void* ptr) {
    mgr_d.release(ptr);
  }

  // method: delete[]
  //
  static void operator delete[](void* ptr) {
    mgr_d.releaseBlock(ptr);
  }

  // method: setGrowSize
  //
  static boolean setGrowSize(long grow_size) {
    return mgr_d.setGrow(grow_size);
  }

  //---------------------------------------------------------------------------
  //
  // class-specific public methods
  //
  //---------------------------------------------------------------------------

  // method: constructor
  //
  SearchSymbol(const String& symbol) {
    String::assign(symbol);
  }
  
  //---------------------------------------------------------------------------
  //
  // private methods
  //
  //---------------------------------------------------------------------------
private:

};

// end of include file
//
#endif
