// file: $isip/class/asr/Machine/mach_05.cc
// version: $Id: mach_05.cc 8433 2002-07-22 19:19:33Z alphonso $
//

// isip include files
//
#include "Machine.h"

// method: assign
//
// arguments:
//   Machine& arg: (input) Machine object
//
// return: logical error status
//
// this method assigns the input object top the current object
//
boolean Machine::assign(const Machine& arg_a) {

  // assign input object to the current object
  //
  protocol_d = arg_a.protocol_d;
  node_name_d.assign(arg_a.node_name_d);
  architecture_d.assign(arg_a.architecture_d);
  num_processors_d.assign(arg_a.num_processors_d);
  speed_d.assign(arg_a.speed_d);
  main_memory_d.assign(arg_a.main_memory_d);
  swap_memory_d.assign(arg_a.swap_memory_d);
  os_d.assign(arg_a.os_d);
  os_version_d.assign(arg_a.os_version_d);
  
  // exit gracefully
  //
  return true;
}

// method: clear
//
// arguments:
//   Integral::CMODE cmode: (input) clear mode
//
// return: logical error status
//
// this method assigns the input object top the current object
//
boolean Machine::clear(Integral::CMODE cmode_a) {

  // clear the member data
  //
  protocol_d = DEF_PROTOCOL;
  node_name_d.clear(cmode_a);
  architecture_d.clear(cmode_a);
  num_processors_d.clear(cmode_a);
  speed_d.clear(cmode_a);
  main_memory_d.clear(cmode_a);
  swap_memory_d.clear(cmode_a);
  os_d.clear(cmode_a);
  os_version_d.clear(cmode_a);
  
  // exit gracefully
  //
  return true;  
}

// method: eq
//
// arguments:
//   Machine& arg: (input) Machine object
//
// return: logical error status
//
// this method determines if the input object is equal to the current object
//
boolean Machine::eq(const Machine& arg_a) const {

  // check if the protocol is the same
  //  
  if(protocol_d != arg_a.protocol_d) {
     return false;
  }

  // check if the node name is the same
  //  
  if(!node_name_d.eq(arg_a.node_name_d)) {
     return false;
  }  

  // check if the architecture is the same
  //  
  if(!architecture_d.eq(arg_a.architecture_d)) {
     return false;
  }

  // check if the number of processors are the same
  //  
  if(!num_processors_d.eq(arg_a.num_processors_d)) {
     return false;
  }

  // check if the number of processors are the same
  //  
  if(!speed_d.eq(arg_a.speed_d)) {
     return false;
  }
  
  // check if the main memory is the same
  //  
  if(!Integral::almostEqual((double)main_memory_d, arg_a.main_memory_d)) {
     return false;
  }

  // check if the swap memory is the same
  //  
  if(!Integral::almostEqual((double)swap_memory_d, arg_a.swap_memory_d)) {
     return false;
  }  

  // check if the OS is the same
  //  
  if(!os_d.eq(arg_a.os_d)) {
     return false;
  }

  // check if the OS version is the same
  //  
  if(!os_version_d.eq(arg_a.os_version_d)) {
     return false;
  }  
  
  // exit gracefully
  //
  return true;  
}




