// file: dec_gram_00.cc
//

// isip include files
//
#include "decoder.h"
#include "decoder_constants.h"
 
// method: get_lattice_cc
//
// arguments:
// char_1* name : (output) name of the grammar
//
// return: Lattice* with required lattice
//
// this method gets the lattice with specified name
//
Lattice* Decoder::get_lattice_cc(char_1* name_a) {

  // local variables
  //
  Link_node* node = (Link_node*)NULL;
  Lattice* lat = (Lattice*)NULL;

  node = gram_list_d->get_head_cc();
  
  // loop through the lattice list till lattice with specfied name is found
  //
  while (node != NULL) {

    lat = (Lattice*)node->get_item_cc();
    
    if (strcmp((char*)(lat->get_name_cc()), (char*)name_a) != (int_4)0) {
      node = node->get_next_cc();
    }
    else {
      break;
    }
  }
  
  // exit gracefully
  //
  return lat;
}
