// file: dtn_states_0.cc
// 

// isip include files
//
#include "dt_node.h"
#include "dt_node_constants.h"

// method: append_states_cc
//
// arguments:
//    Dt_node* dtn: (input) the node whose states are to be appended to
//                   this node
//
// return: a logical_1 indicating status
//
// this method appends the states index of another node to this node
//
logical_1 Dt_node::append_states_cc(Dt_node* dtn_a) {
  
  // local variables
  //
  int_4 num_states;
  int_4* state_index;
  int_4 tmp_num_states;
  int_4* tmp_state_index;
  
  // get the number of states and state indices in the input node
  //
  num_states = dtn_a->get_num_states_cc();
  state_index = dtn_a->get_state_index_cc();
  
  // initialize the array of temporary state indices
  //
  tmp_num_states = num_states_d + num_states;
  tmp_state_index = new int_4[tmp_num_states];
  
  // set the indices
  //
  for(int_4 i=0; i<num_states_d; i++) {    
    tmp_state_index[i] = state_index_d[i];
  }
  
  for(int_4 i=0; i<num_states; i++) {
    tmp_state_index[i+num_states_d] = state_index[i];
  }
  
  // set the number of states and state indices
  //
  num_states_d = tmp_num_states;
  delete [] state_index_d;
  state_index_d = tmp_state_index;
  
  // exit gracefully
  //
  return ISIP_TRUE;
}




