//============================================================================
// This method writes the information related to the NAClusterInfo class to a
// logfile called "NAClusterInfo.txt".
//============================================================================
void NAClusterInfo::captureNAClusterInfo(ofstream & naclfile)
{
  CollIndex i, ci;
  char filepath[OSIM_PATHMAX];
  char filename[OSIM_FNAMEMAX];

  // We don't capture data members that are computed during the compilation of
  // a query. These include:
  //
  // * smpCount_;
  // * tableToClusterMap_;
  // * activeClusters_;
  //

  naclfile << "localCluster_: " << localCluster_ << endl
           << "localSMP_: " << localSMP_ << endl;

  CollIndex *key_collindex;  
  maps *val_maps;
  // Iterator for logging all the entries in clusterToCPUMap_ HashDictionary.
  NAHashDictionaryIterator<CollIndex, maps> C2CPUIter (*clusterToCPUMap_, NULL, NULL);  
  naclfile << "clusterToCPUMap_: " << C2CPUIter.entries() << " :" << endl;
  if (C2CPUIter.entries() > 0)
  {
    // Write the header line for the table.
    naclfile << "  ";
    naclfile.width(10); 
    naclfile << "clusterNum" << "  ";
    naclfile << "cpuList" << endl;
    for (i=0; i<C2CPUIter.entries(); i++)
    {
      C2CPUIter.getNext(key_collindex, val_maps);
      naclfile << "  ";
      naclfile.width(10); naclfile << *key_collindex << "  ";
                          naclfile << val_maps->list->entries() << " : ";
      for (ci=0; ci<val_maps->list->entries(); ci++)
      {
        naclfile.width(3); naclfile << (*(val_maps->list))[ci] << " ";
      }
      naclfile << endl;
    }
  }

  Int32 * nodeID = NULL;
  NAString* nodeName = NULL;
  NAHashDictionaryIterator<Int32, NAString> nodeNameAndIDIter (*nodeIdToNodeNameMap_);
  naclfile << "nodeIdAndNodeNameMap: " << nodeNameAndIDIter.entries() << endl;
  for(nodeNameAndIDIter.getNext(nodeID, nodeName); nodeID && nodeName; nodeNameAndIDIter.getNext(nodeID, nodeName))
  {
      naclfile << *nodeID << " " << nodeName->data() << endl;
  }

  // Now save the OS-specific information to the NAClusterInfo.txt file
  captureOSInfo(naclfile);
}