// file: $isip/class/pr/LanguageModelABNF/lmabnf_01.cc
// version: $Id: lmabnf_01.cc 10495 2006-03-15 21:37:57Z may $
//

// ISIP include files
//
#include "LanguageModelABNF.h"

// system include file needed for the typeid function.
//
#include <typeinfo>

// method: debug
//
// arguments:
// const unichar* msg: (input) a message to display with the
// member data information
//
// return: a boolean indicating status
//
boolean LanguageModelABNF::debug(const unichar* msg_a) const {
  
  // output the debug level
  //
  debug_level_d.debug(L"debug_level_d");

  // call debug on abnf_model_d
  //
  abnf_model_d.debug(L"abnf_model_d");

  // exit gracefully
  //
  return true;
}

// 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 LanguageModelABNF::clear(Integral::CMODE ctype_a) {
  
  if(ctype_a != Integral::RETAIN) {
    
    // clear the member data
    //
    abnf_model_d.clear(ctype_a);
    debug_level_d = Integral::NONE;
  }
  
  // indicate success
  //
  return true;
}

// method: operator=
//
// arguments:
//  const LanguageModelABNF& arg: (input) input object to copy
//
// return: a boolean value indicating status
//
// this method copies the argument over this object
//
boolean LanguageModelABNF::operator=(const LanguageModelABNF& lmabnf_a) {
  return assign(lmabnf_a);
}

// method: assign
//
// arguments:
//  const LanguageModelABNF& arg: (input) object to copy
//
// return: a boolean value indicating status
//
// this method assigns the input object to current object
//
boolean LanguageModelABNF::assign(const LanguageModelABNF& lmabnf_a) {

  return (abnf_model_d.assign(lmabnf_a.abnf_model_d));	  
  
}

// method: assign
//
// arguments:
//  const LanguageModelBase& arg: (input) object to copy
//
// return: a boolean error status
//
// this method assigns input argument to current argument
//
boolean LanguageModelABNF::assign(const LanguageModelBase& arg_a) {
  
  if (typeid(arg_a) == typeid(LanguageModelABNF)) {
    return assign((LanguageModelABNF&)arg_a);
  }
  else {
    return Error::handle(name(), L"assign", Error::ARG, __FILE__, __LINE__);
  }
}

// method: operator==
//
// arguments:
//  const LanguageModelABNF& arg: (input) input object to compare
//
// return: a boolean value indicating status
//
// this method checks whether the current object is identical to the
// input object
//
boolean LanguageModelABNF::operator==(const LanguageModelABNF& lmabnf_a) const {
  return eq(lmabnf_a);
  // return true;
}

// method: eq
//
// arguments:
//  const LanguageModelABNF& lmabnf: (input) input object to compare
//
// return: a boolean value indicating equality
//
// this method checks whether the current object is identical to the
// input object
//
boolean LanguageModelABNF::eq(const LanguageModelABNF& lmabnf_a) const {
  
  // compare all non/debug member data
  //
  return abnf_model_d.eq(lmabnf_a.abnf_model_d);  
}

// method: eq
//
// arguments:
//  const LanguageModelBase& arg: (input) object to test
//
// return: a boolean value indicating equality
//
// this method is part of the LanguageModelBase interface contract
// which compares two virtual model types
//
boolean LanguageModelABNF::eq(const LanguageModelBase& arg_a) const {
  if (typeid(arg_a) == typeid(LanguageModelABNF)) {
    return eq((LanguageModelABNF&)arg_a);
  }
  else {
    return Error::handle(name(), L"eq", Error::ARG, __FILE__, __LINE__);
  }
}
