// file: tr_lat_get_9.cc
//

// isip include files
//
#include "train_lattice.h"
#include "train_lattice_constants.h"

// method: get_lat_node_cc
//
// arguments:
//  Train_Lattice_node* lnode: (input) the Train_Lattice node
//  Train_Hash_cell*& lcell: (output) the hash cell containing this Train_Lattice node
//  
// return: a logical_1 indicating success
//
// this method gets the hash cell containing the given Train_Lattice node
//
logical_1 Train_Lattice::get_lat_node_cc(Train_Lattice_node* lnode_a,
				   Train_Hash_cell*& lcell_a) {

  // if this is a null node return
  //
  if ((lnode_d == (Train_Hash_table*)NULL) || (lnode_a == (Train_Lattice_node*)NULL)) {
    lcell_a = (Train_Hash_cell*)NULL;
    return ISIP_FALSE;
  }
  
  // create a key string for the node
  //
  char_1* key_str = new char_1[TRAIN_LATTICE_KEYSTR_LENGTH];
  sprintf((char*)key_str, "%p", lnode_a);

  // get the hash cell
  //
  lcell_a = lnode_d->hash_lookup_cc(key_str);

  // free memory
  //
  delete [] key_str;
  
  // exit gracefully
  //
  return ISIP_TRUE;
}
