// file: $isip/class/search/HierarchicalSearch/hsrch_00.cc
//

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

// method: destructor
//
// arguments: none
//
// return: none
//
// this is the default destructor for the HierarchicalSearch class.
//
HierarchicalSearch::~HierarchicalSearch() {

  // clear the current traces
  //
  clear();
}

// method: default constructor
//
// arguments: none
//
// return: none
//
// this is the default constructor for the HierarchicalSearch class.
//
HierarchicalSearch::HierarchicalSearch() {

  // set the default modes
  //
  search_mode_d = DEF_SEARCH_MODE;
  context_generation_mode_d = DEF_CONTEXT_MODE;
  
  // initialize those data members that need to be initialized
  //
  current_frame_d = DEF_START_FRAME;
  context_level_d = DEF_CONTEXT_LEVEL;
  
  // set the allocation mode for the valid hypotheses list
  //
  trace_valid_hyps_d.setAllocationMode(DstrBase::USER);
  instance_valid_hyps_d.setAllocationMode(DstrBase::USER);

  // set the allocation mode for the list of lexical tree
  //
  lex_tree_list_d.setAllocationMode(DstrBase::USER);  

  // set the allocation mode for the trace to vertex mapping
  //
  instance_mapping_d.setAllocationMode(DstrBase::USER);  

  // set the capacity of the hash table
  //
  instance_mapping_d.setCapacity(DEF_CAPACITY);
  
  // set the default number of levels
  //
  setNumLevels(DEF_NUM_LEVELS);
}

// method: copy constructor
//
// arguments:
//  const HierarchicalSearch& arg: (input) search to copy
//
// return: none
//
// this is the copy constructor for the HierarchicalSearch class
//
HierarchicalSearch::HierarchicalSearch(const HierarchicalSearch& arg_a) {

  // initialize the data members that need it
  //
  clear();

  // set the default modes
  //
  search_mode_d = arg_a.search_mode_d;
  context_generation_mode_d = arg_a.context_generation_mode_d;
  
  // set the allocation mode for the valid hypotheses list
  //
  trace_valid_hyps_d.setAllocationMode(DstrBase::USER);
  instance_valid_hyps_d.setAllocationMode(DstrBase::USER);  

  // set the allocation mode for the list of lexical tree
  //
  lex_tree_list_d.setAllocationMode(DstrBase::USER);  

  // set the allocation mode for the trace to vertex mapping
  //
  instance_mapping_d.setAllocationMode(DstrBase::USER);  

  // set the capacity of the hash table
  //
  instance_mapping_d.setCapacity(DEF_CAPACITY);  
  
  // assign the search
  //
  assign(arg_a);
}

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

// constants: required constants such as class name
//
const String HierarchicalSearch::CLASS_NAME(L"HierarchicalSearch");

// constants: i/o related constants
//
const String HierarchicalSearch::DEF_PARAM(L"search");

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

//
// end of file
