// file: $isip/class/algo/DisplayData/dspd_00.cc
// version: $Id: dspd_00.cc 6978 2001-05-11 14:47:44Z duncan $
//

// isip include files
//
#include "DisplayData.h"
#include <typeinfo>

//---------------------------------------------------------------------------
//
// class-specific public methods:  
//  AlgorithmBase interface contract methods
//
//---------------------------------------------------------------------------

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

  // set all the data
  //
  algorithm_d = arg_a.algorithm_d;
  implementation_d = arg_a.implementation_d;
  number_d = arg_a.number_d;

  // call the base assign method
  //
  return AlgorithmBase::assign(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 DisplayData::clear(Integral::CMODE ctype_a) {

  // for retain mode, we do nothing
  //
  if (ctype_a != Integral::RETAIN) {
  
    algorithm_d = DEF_ALGORITHM;
    implementation_d = DEF_IMPLEMENTATION;
    number_d = DEF_NUMBER;
  }
  
  // call the base clear method
  //
  AlgorithmBase::clear(ctype_a);

  // set the debug level to the default value
  //
  debug_level_d = DEF_DEBUG_LEVEL;

  // exit gracefully
  //
  return true;
}

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

  if (typeid(arg_a) == typeid(DisplayData)) {
    return assign((DisplayData&)arg_a);
  }
  else {
    return Error::handle(name(), L"assign", Error::ARG, __FILE__, __LINE__);
  }

  // exit gracefully
  //
  return true;
}

// method: eq
//
// arguments:
//  const AlgorithmBase& arg: (input) object to assign
//
// return: a boolean value indicating status
//
// this method checks whether two cepstrum objects are equal or not
//
boolean DisplayData::eq(const AlgorithmBase& arg_a) const {

  if (typeid(arg_a) == typeid(DisplayData)) {
    return eq((DisplayData&)arg_a);
  }
  else {
    return Error::handle(name(), L"eq", Error::ARG, __FILE__, __LINE__);
  }
  
  // exit gracefully
  //
  return true;
  
}

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

// constants: class name
//
const String DisplayData::CLASS_NAME(L"DisplayData");

// constants: i/o related constants
//
const String DisplayData::DEF_PARAM(L"");
const String DisplayData::PARAM_ALGORITHM(L"algorithm");
const String DisplayData::PARAM_IMPLEMENTATION(L"implementation");
const String DisplayData::PARAM_NUMBER(L"number");
const String DisplayData::PARAM_LABEL(L"label");
const String DisplayData::PARAM_PREFIX(L"prefix");
const String DisplayData::PARAM_SUFFIX(L"suffix");

// constants: default values of the class data
//
const String DisplayData::DEF_LABEL(L"");
const String DisplayData::DEF_PREFIX(L"");
const String DisplayData::DEF_SUFFIX(L"");

// constants: use to build the output strings
//
const String DisplayData::ELEMENT_HEADER_00(L"element ");
const String DisplayData::ELEMENT_HEADER_01(L":\n");
const String DisplayData::LABEL_DELIM(L" = ");
const String DisplayData::EMPTY_MATRIX(L"[ ]");
const String DisplayData::MATRIX_START(L"[");
const String DisplayData::MATRIX_DELIM(L" ");
const String DisplayData::MATRIX_END(L"]");

// constants: NameMap(s) for the enumerated values
//
const NameMap DisplayData::ALGO_MAP(L"FIRST, LAST, ONCE, EVERY");
const NameMap DisplayData::IMPL_MAP(L"CONSOLE");

// static instantiations: memory manager
//
MemoryManager DisplayData::mgr_d(sizeof(DisplayData), DisplayData::name());

