// file: $isip/class/algo/Covariance/cov_00.cc
// version: $Id: cov_00.cc 8165 2002-05-31 21:57:33Z picone $
//

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

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

// 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 Covariance::clear(Integral::CMODE ctype_a) {

  // reset all protected data
  //
  if (ctype_a != Integral::RETAIN) {
    algorithm_d = DEF_ALGORITHM;
    implementation_d = DEF_IMPLEMENTATION;
    order_d = DEF_ORDER;
  }
  
  // call the base clear method
  //
  return AlgorithmBase::clear(ctype_a);
}

//---------------------------------------------------------------------------
//
// class-specific public methods:
//  public methods required by the AlgorithmBase interface contract
//
//---------------------------------------------------------------------------

// method: assign
//
// arguments:
//  const AlgorithmBase& arg: (input) object to be assigned
//
// return: a boolean value indicating status
//
// this method assigns the input algorithm object to the current
// Covariance object, if the input algorithm object is not an Covariance
// object, it returns an error
//
boolean Covariance::assign(const AlgorithmBase& arg_a) {

  // case: input is a Covariance object
  //
  if (typeid(arg_a) == typeid(Covariance)) {
    return assign((Covariance&)arg_a);
  }

  // case: other
  //  if the input algorithm object is not a Covariance object, return
  //  an error.
  //    
  else {
    return Error::handle(name(), L"assign", Error::ARG, __FILE__, __LINE__);
  }
}

// method: eq
//
// arguments:
//  const AlgorithmBase& arg: (input) object to be compared
//
// return: a boolean value indicating status
//
// this method checks whether the current Covariance object is identical
// to the input algorithm object, if the input algorithm object is not
// an Covariance object, it returns an error
//
boolean Covariance::eq(const AlgorithmBase& arg_a) const {
  
  // case: input is a Covariance object
  //
  if (typeid(arg_a) == typeid(Covariance)) {
    return eq((Covariance&)arg_a);
  }

  // case: other
  //  if the input algorithm object is not a Covariance object, return
  //  an error.
  //    
  else {
    return Error::handle(name(), L"eq", Error::ARG, __FILE__, __LINE__);
  }
}

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

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

// constants: i/o related constants
//
const String Covariance::DEF_PARAM(L"");
const String Covariance::PARAM_ALGORITHM(L"algorithm");
const String Covariance::PARAM_IMPLEMENTATION(L"implementation");
const String Covariance::PARAM_ORDER(L"order");
const String Covariance::PARAM_CMODE(L"compute_mode");

// constants: NameMap(s) for the enumerated values
//
const NameMap Covariance::ALGO_MAP(L"NORMAL");
const NameMap Covariance::IMPL_MAP(L"FACTORED, UNFACTORED");

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


