// file: $isip/class/algo/SegmentConcat/segc_00.cc
// version: $Id: segc_00.cc 9389 2004-01-30 00:41:38Z parihar $
//

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

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

// method: default constructor
//
// arguments: none
//
// return: none
//
// this is the default constructor for the SegmentConcat class
//
SegmentConcat::SegmentConcat(ALGORITHM algorithm_a,
			     IMPLEMENTATION implementation_a) {

  // initialize class data
  //
  algorithm_d = algorithm_a;
  implementation_d = implementation_a;

  min_max_d.setLength((long)2);

  duration_flag_d = DEF_DURATION_FLAG;
    
  dim_d = DEF_DIMENSION;
  input_type_d = FeatureFile::DEF_FILE_TYPE;
  input_format_d = FeatureFile::DEF_FILE_FORMAT;
  
  output_type_d = FeatureFile::DEF_FILE_TYPE;
  output_format_d = FeatureFile::DEF_FILE_FORMAT;
  output_directory_d.assign(String::NULL_STRING);
  output_extension_d.assign(String::NULL_STRING);  
  output_preserve_d.assign(Filename::DEF_DIR_PRES);
  output_suffix_d.assign(String::NULL_STRING);    
}

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

  // assign data from the input SegmentConcat object
  //
  algorithm_d = arg_a.algorithm_d;
  implementation_d = arg_a.implementation_d;
  
  min_max_d = arg_a.min_max_d;
  min_max_file_d = arg_a.min_max_file_d;;

  ratio_d = arg_a.ratio_d;
  duration_flag_d = arg_a.duration_flag_d;
  level_d = arg_a.level_d;
  
  dim_d = arg_a.dim_d;
  input_type_d = arg_a.input_type_d;
  input_format_d = arg_a.input_format_d;

  output_type_d = arg_a.output_type_d;
  output_format_d = arg_a.output_format_d;
  output_directory_d.assign(arg_a.output_directory_d);
  output_extension_d.assign(arg_a.output_extension_d);  
  output_preserve_d.assign(arg_a.output_preserve_d);
  output_suffix_d.assign(arg_a.output_suffix_d);
  
  audiodb_file_d = arg_a.audiodb_file_d;
  transdb_file_d = arg_a.transdb_file_d;
  
  // exit gracefully
  //
  return true;
}

// method: eq
//
// arguments:
//  const SegmentConcat& 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 SegmentConcat::eq(const SegmentConcat& arg_a) const {

  // compare the data members
  //
  if ((algorithm_d != arg_a.algorithm_d) ||
      (implementation_d != arg_a.implementation_d) ||
      (dim_d != arg_a.dim_d) || (min_max_d.ne(arg_a.min_max_d)) ||
      (min_max_file_d.ne(min_max_file_d)) ||
      (input_type_d != arg_a.input_type_d) ||
      (input_format_d != arg_a.input_format_d) ||
      (output_type_d != arg_a.output_type_d) ||
      (output_directory_d.ne(arg_a.output_directory_d)) ||
      (output_extension_d.ne(arg_a.output_extension_d)) ||
      (output_preserve_d != arg_a.output_preserve_d) ||
      (output_suffix_d.ne(arg_a.output_suffix_d)) ||
      (ratio_d.ne( arg_a.ratio_d)) ||
      (duration_flag_d != arg_a.duration_flag_d) ||
      (audiodb_file_d.ne(arg_a.audiodb_file_d)) ||
      (transdb_file_d.ne(arg_a.transdb_file_d)) ||
      (level_d.ne(arg_a.level_d))) {
    return false;
  }
  
  // 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 SegmentConcat::clear(Integral::CMODE ctype_a) {
  
  // reset the data members unless the mode is RETAIN
  //
  if (ctype_a != Integral::RETAIN) {

    // clear the design parameters
    //
    algorithm_d = DEF_ALGORITHM;
    implementation_d = DEF_IMPLEMENTATION;

    min_max_d.clear(ctype_a);
    min_max_file_d.clear(ctype_a);
    
    duration_flag_d = DEF_DURATION_FLAG;
	
    dim_d = DEF_DIMENSION;
    input_type_d = FeatureFile::DEF_FILE_TYPE;
    input_format_d = FeatureFile::DEF_FILE_FORMAT;
    
    output_type_d = FeatureFile::DEF_FILE_TYPE;
    output_format_d = FeatureFile::DEF_FILE_FORMAT;
    output_directory_d.assign(String::NULL_STRING);
    output_extension_d.assign(String::NULL_STRING);  
    output_preserve_d.assign(Filename::DEF_DIR_PRES);
    output_suffix_d.assign(String::NULL_STRING);

    audiodb_file_d.clear(ctype_a);
    transdb_file_d.clear(ctype_a);
    audiodb_d.clear(ctype_a);
    transdb_d.clear(ctype_a);
  }
  
  // exit gracefully
  //
  return true;
}

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

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

// constants: i/o related constants
//
const String SegmentConcat::DEF_PARAM(L"");
const String SegmentConcat::PARAM_ALGORITHM(L"algorithm");
const String SegmentConcat::PARAM_IMPLEMENTATION(L"implementation");

// constants: name map(s) for the enumerated values
//
const NameMap SegmentConcat::ALGO_MAP(L"MIN_MAX, SEG_CONCAT, SEG_CONCAT_SYMBOL");
const NameMap SegmentConcat::IMPL_MAP(L"NONE, NORMALIZE");

// static instantiations: memory manager
//
Integral::DEBUG SegmentConcat::debug_level_d = Integral::NONE;
Integral::DEBUG SegmentConcat::verbosity_d = Integral::NONE;
MemoryManager SegmentConcat::mgr_d(sizeof(SegmentConcat),
				   SegmentConcat::name());
