// file: latn_size_0.cc
//

// isip include files
//
#include "lattice_node.h"
#include "lattice_node_constants.h"

#include <lex_tree.h>
#include <lex_tree_constants.h>

// method: size_cc
//
// arguments: none
//
// return: an int_4 with number of bytes used by this object
//
// this method counts the size of the current object in bytes
//
int_4 Lattice_node::size_cc() {

  // set the size variable
  //
  int_4 size = 0;
  
  // add the size of each constituent data
  //

  // add the size of all numeric data
  //
  size += sizeof(int_4);                         // type_d
  size += sizeof(Word*);                         // word_d
  size += sizeof(int_4);                         // pron_variant_d
  size += sizeof(int_4);                         // frame_d
  size += sizeof(int_4);                         // node_index_d
  size += sizeof(int_4);                         // num of incoming arcs
  size += sizeof(int_4);                         // num of outgoing arcs

  // loop over all nodes in the linked list
  //
  if (prev_nodes_d != (Link_list*)NULL) {
    for (Link_node* node = prev_nodes_d->get_head_cc();
	 node != (Link_node*)NULL; node = node->get_next_cc()) {
      size += node->size_cc();
    }
  }

  if (next_nodes_d != (Link_list*)NULL) {
    for (Link_node* node = next_nodes_d->get_head_cc();
	 node != (Link_node*)NULL; node = node->get_next_cc()) {
      size += node->size_cc();
    }
  }

  // add the size of the lexical tree
  //
  size += sizeof(Lex_tree*);                         // lex_tree_d
  if (lex_tree_d != (Lex_tree*)NULL) {
    size += lex_tree_d->size_cc();
  }

  // add the size of the lm and ac scores array;
  //
  size += num_arcs_out_d*sizeof(float_4);
  size += num_arcs_out_d*sizeof(float_4);
  
  // exit gracefully
  //
  return size;
}
