void  ParameterSearchBinaryCombo::LoadCurrentStatusFile ()
{
  log.Level (10) << "ParameterSearchBinaryCombo::LoadCurrentStatusFile - Loading current Status File." << endl;

  char  buff[10240];

  statusFile = fopen (statusFileName, "r");
  if  (!statusFile)
  {
     log.Level (-1) << endl
                    << "ParameterSearchBinaryCombo::LoadCurrentStatusFile - *** ERROR ***  Can not open Status File[" 
                    << statusFileName << "]." 
                    << endl;
     EndBlock ();
     exit (1);

     osWaitForEnter ();
  }

  {
    fgets (buff, sizeof (buff), statusFile);
    String  cmdLine (buff);
    cmdLine.TrimRight ();
    ProcessCmdLineStr  (cmdLine);
  }

  {
    // If images are not loadted then we need 2 load trhem now.

    if  (images.QueueSize () < 1)
    {
      ReadProblem ();
    }
  }


  {
    fgets (buff, sizeof (buff), statusFile);
    String  buffStr (buff);

    numOfProcesses       = buffStr.ExtractTokenInt    (" ,\n\t");
    highestAccuracySoFar = buffStr.ExtractTokenDouble (" ,\n\t");
  }


  {
    // Get Master Class List
    delete  masterClassList;

    fgets (buff, sizeof (buff), statusFile);
    String  buffStr (buff);

    numOfClasses = buffStr.ExtractTokenInt    (" ,\n\t");
    masterClassList = new ImageClassPtr[numOfClasses];
    for  (int idx = 0;  idx < numOfClasses;  idx++)
    {
      String  className = buffStr.ExtractToken (" ,\n\t");
      masterClassList[idx] = imageClasses.LookUpByName (className);
      if  (!masterClassList[idx])
      {
        cerr << endl
             << "*** ERROR ***,   Class[" << className << "]  is not one of the classes in the data file." << endl
             << endl;
        exit (-1);
      }
    }
  }


  {
    // Lets get next Class IDX's to perform

    fgets (buff, sizeof (buff), statusFile);
    String  buffStr (buff);

    nextClass0IDX = buffStr.ExtractTokenInt    (" ,\n\t");
    nextClass1IDX = buffStr.ExtractTokenInt    (" ,\n\t");
  }

  
  if  (processes)
  {
    delete  processes;
    processes = NULL;
  }

  processes = new ParameterProcessList (true);

  for  (int  processLineNum = 0;  processLineNum < numOfProcesses;  processLineNum++)
  {
    fgets (buff, sizeof (buff), statusFile);
    String  buffStr (buff);
    processes->PushOnBack (new ParameterProcess (log, imageClasses, buffStr));
  }

  fclose (statusFile);
  statusFile = NULL;
  return;
}  /* LoadCurrentStatusFile */
Ejemplo n.º 2
0
void  ParameterSearch::LoadCurrentStatusFile ()
{
  log.Level (10) << "ParameterSearch::LoadCurrentStatusFile - Loading current Status File." << endl;

  char  buff[10240];

  statusFile = fopen (statusFileName, "r");
  if  (!statusFile)
  {
     log.Level (-1) << endl
                    << "ParameterSearch::LoadCurrentStatusFile - *** ERROR ***  Can not open Status File[" 
                    << statusFileName << "]." 
                    << endl;
     EndBlock ();
     exit (1);

     osWaitForEnter ();
  }


  {
    fgets (buff, sizeof (buff), statusFile);
    String  cmdLine (buff);
    cmdLine.TrimRight ();
    ProcessCmdLineStr  (cmdLine);
  }


  {
    fgets (buff, sizeof (buff), statusFile);
    String  buffStr (buff);

    numOfProcesses       = buffStr.ExtractTokenInt    (" ,\n\t");
    nextJobId            = buffStr.ExtractTokenInt    (" ,\n\t");
    highestAccuracySoFar = buffStr.ExtractTokenDouble (" ,\n\t");
  }

  {
    fgets (buff, sizeof (buff), statusFile);
    String  buffStr (buff);

    nextC     = buffStr.ExtractTokenInt    (" ,\n\t");
    nextGamma = buffStr.ExtractTokenDouble (" ,\n\t");
    nextA     = buffStr.ExtractTokenInt    (" ,\n\t");
  }


  
  if  (processes)
  {
    delete  processes;
    processes = NULL;
  }

  processes = new ParameterJobList (true);

  for  (int  processLineNum = 0;  processLineNum < numOfProcesses;  processLineNum++)
  {
    fgets (buff, sizeof (buff), statusFile);
    String  buffStr (buff);
    processes->PushOnBack (new ParameterJob (log, buffStr));
  }

  fclose (statusFile);
  statusFile = NULL;
  return;
}  /* LoadCurrentStatusFile */