// file: tr_latn_add_1.cc
//

// isip include files
//
#include "train_lattice_node.h"
#include "train_lattice_node_constants.h"

// method: add_next_node_cc
//
// arguments:
//  Train_Lattice_node* lat_node_a: (input) node to be added to next node list
//
// return: logical_1 indicating status
//
// this method adds a node to the list of the next nodes
//
logical_1 Train_Lattice_node::add_next_node_cc(Train_Lattice_node* lat_node_a) {

  // the memory manager
  //
  Train_Memory_manager* manager = Train_Link_list::get_manager_cc();
  
  // insert the node into the next nodes list
  //
  Train_Link_node* temp_node = manager->new_node_cc();
  temp_node->set_item_cc((void_p)lat_node_a);

  // allocate if necessary, and initialize the link list
  //
  if (next_nodes_d == (Train_Link_list*)NULL) {
    next_nodes_d = new Train_Link_list();
  }
  next_nodes_d->insert_cc(temp_node);

  // increment the number of outgoing arcs
  //
  num_arcs_out_d++;

  // exit gracefully
  //
  return ISIP_TRUE;
}
