// file: $isip/class/search/HierarchicalDigraph/hd_00.cc
//

// isip include files
//
#include "HierarchicalDigraph.h"

//------------------------------------------------------------------------
//
// required public methods
//
//-----------------------------------------------------------------------

// method: assign
//
// arguments:
//  const HierarchicalDigraph& arg_a: (input) object to assign
//
// return: a boolean value indicating status
//
// this method assigns the input argument to "this".
//
boolean HierarchicalDigraph::assign(const HierarchicalDigraph& arg_a) {

  // assign data related to i/o
  //
  debug_level_d = arg_a.debug_level_d;

  // assign other protected data
  //
  source_format_d = arg_a.source_format_d;

  // call the assign method of Vector
  //
  //return Vector<SearchLevel>::assign(arg_a);


  Vector<SearchLevel>::assign(arg_a);
  // debug by Tao
  Sof sof0;
  SysString file1;
  file1.assign(L"/home/tm334/temp/debug.sof");
  if (!sof0.open(file1, File::WRITE_ONLY)) {
    return Error::handle(L"Long", L"write error", Error::TEST, __FILE__, __LINE__);
  }
  arg_a.write(sof0, 1, L"arg_a");
  sof0.close();
  if (!sof0.open(file1, File::READ_ONLY)) {
    return Error::handle(L"Long", L"read error", Error::TEST, __FILE__, __LINE__);
  }
  this->read(sof0, 1, L"arg_a");
  sof0.close();

  return true;
}

// method: eq
//
// arguments:
//  const HierarchicalDigraph& arg_a: (input) input object to assign
//
// return: a boolean value indicating status
//
// this method checks whether the current object is identical to the
// input object
//
boolean HierarchicalDigraph::eq(const HierarchicalDigraph& arg_a) const {

  // compare all protected data and call eq method
  // of Vector class
  //
  return (source_format_d == arg_a.source_format_d &&
	  Vector<SearchLevel>::eq(arg_a));
}

// method: clear
//
// arguments:
//  Integral::CMODE ctype: (input) clear mode
//
// return: a boolean value indicating status
//
// this method resets the data members to the default values
//
boolean HierarchicalDigraph::clear(Integral::CMODE ctype_a) {

  // reset all protected data
  //
  if (ctype_a != Integral::RETAIN) {
    source_format_d = DEF_SRC_FORMAT;
  }
  
  // call the Vector clear method
  //
  return Vector<SearchLevel>::clear(ctype_a);
}

//-----------------------------------------------------------------------------
//
// we define non-integral constants in the default constructor
//      
//-----------------------------------------------------------------------------

// constantsL class name
//
const String HierarchicalDigraph::CLASS_NAME(L"HierarchicalDigraph");

// constants: NameMap(s) for the enumerated values
//
const NameMap HierarchicalDigraph::SRC_MAP(L"UNKNOWN, IHD, JSGF, XML");
