// file: lat_size_0.cc
//

// isip include files
//
#include "lattice.h"
#include "lattice_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::size_cc() {

  // set the size variable
  //
  int_4 size = 0;
  
  // add the size of all numeric data
  //
  size += sizeof(int_4);                         // num_arcs_d
  size += sizeof(int_4);                         // num_nodes_d
  size += sizeof(float_4);                       // lm_scale_d
  size += sizeof(float_4);                       // word_penalty_d
  size += sizeof(Word*);                         // null_word_d

  // add the size of all character strings
  //
  if (lang_model_d != (char_1*)NULL) {
    size += strlen((char*)lang_model_d)*sizeof(char_1);    // lang_model_d
  }
  if (utterance_d != (char_1*)NULL) {
    size += strlen((char*)utterance_d)*sizeof(char_1);     // utterance_d
  }
  if (model_set_d != (char_1*)NULL) {    
    size += strlen((char*)model_set_d)*sizeof(char_1);     // model_set_d
  }
  if (name_d != (char_1*)NULL) {    
    size += strlen((char*)name_d)*sizeof(char_1);          // model_set_d
  }
  
  // add size of other members which are defined objects
  //
  size += sizeof(Lattice_node*);                         // start_node_d
  size += sizeof(Hash_table*);                           // lnode_d
  size += lnode_d->size_cc();
  
  // exit gracefully
  //
  return size;
}







