// file: $isip/class/sp/FtrBuffer/ftrb_00.cc
// version: $Id: ftrb_00.cc 8539 2002-08-08 19:35:29Z gao $
//

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

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

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

  return (hash_d.assign(arg_a.hash_d) &&
	  length_d.assign(arg_a.length_d) &&
	  frame_index_d.assign(arg_a.frame_index_d) &&
	  last_index_d.assign(arg_a.last_index_d) &&
	  coef_name_d.assign(arg_a.coef_name_d) &&
	  leftover_samps_d.assign(arg_a.leftover_samps_d));
}

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

  return (hash_d.eq(arg_a.hash_d) &&
	  length_d.eq(arg_a.length_d) &&
	  frame_index_d.eq(arg_a.frame_index_d) &&
	  last_index_d.eq(arg_a.last_index_d) &&
	  coef_name_d.eq(arg_a.coef_name_d) &&
	  leftover_samps_d.eq(arg_a.leftover_samps_d));
}

// method: clear
//
// arguments:
//  Integral::CMODE ctype: (input) clear mode
//
// return: a boolean value indicating status
//
// this method clears the contents of FtrBuffer and close the file if necessary
//
boolean FtrBuffer::clear(Integral::CMODE ctype_a) {

  // clear the parameters
  //
  hash_d.clear(ctype_a);
  length_d.clear(ctype_a);
  
  frame_index_d = 0;
  last_index_d = 0;
  coef_name_d.clear();

  leftover_samps_d = 0;
  
  // exit gracefully
  //
  return true;
}

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

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

// constants: i/o related constants
//
const String FtrBuffer::PARAM_HASH(L"hash");
const String FtrBuffer::PARAM_LENGTH(L"length");
const String FtrBuffer::PARAM_FRAME_INDEX(L"frame_index");
const String FtrBuffer::PARAM_LAST_INDEX(L"last_index");
const String FtrBuffer::PARAM_COEF_NAME(L"coef_name");
const String FtrBuffer::PARAM_LEFTOVER(L"leftover");

// static instantiations: debug level and memory manager
//
Integral::DEBUG FtrBuffer::debug_level_d = Integral::DEF_DEBUG;
MemoryManager FtrBuffer::mgr_d(sizeof(FtrBuffer), FtrBuffer::name());
