SOF PROGRAMMING ASSIGNMENT: SOLUTION C


logical Statistics::write_cc(Sof& sof_a, long tag_a) {
  
  long size;
  
  if (sof_a.is_ascii_cc() == ISIP_TRUE) {
    size = (long)-1;
  }
  else {
    size = file_size_cc();
  }
  
  // put the object into the sof file's index
  //
  sof_a.put_cc(STATISTICS_CLASS_NAME, tag_a, size);

  // all sof indexing functions leave the file pointer in the correct
  // position to read and write, go ahead and do write it.
  //
  return write_cc(sof_a);
}

logical Statistics::write_cc(Sof& sof_a) {

  min_d.write_cc(sof_a, (unichar*)"min = %ld\n");
  max_d.write_cc(sof_a, (unichar*)"max = %ld\n");
  mean_d.write_cc(sof_a, (unichar*)"mean = %10.5f\n");
  
  // exit gracefully
  //
  return ISIP_TRUE;
}