当前位置: 首页>>代码示例>>C++>>正文


C++ KKStr::ExtractTokenDouble方法代码示例

本文整理汇总了C++中KKStr::ExtractTokenDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ KKStr::ExtractTokenDouble方法的具体用法?C++ KKStr::ExtractTokenDouble怎么用?C++ KKStr::ExtractTokenDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KKStr的用法示例。


在下文中一共展示了KKStr::ExtractTokenDouble方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cancelFlag

ParameterJob::ParameterJob (RunLog&    _log,
                            KKStr     _desc
                           ):
  cancelFlag (false),
  log        (_log)
{
  accuracy     = 0;
  startTime    = 0;

  _desc.TrimLeft ();

  curStatus = _desc.ExtractChar ();
 
  if  ((curStatus == '0')  ||  
       (curStatus == '1')  ||  
       (curStatus == '2')  ||  
       (curStatus == '3')
      )
  {
    // We Are Ok
  }
  else
  {
    log.Level (-1) << endl 
                   << "ParameterJob:  We have an invalid Cur Status."
                   << endl;
    osWaitForEnter ();
  }


  {
    processNum = _desc.ExtractTokenInt    (" ,\t");
    jobId      = _desc.ExtractTokenInt    (" ,\t");
    cParm      = _desc.ExtractTokenInt    (" ,\t");
    gammaParm  = _desc.ExtractTokenDouble (" ,\t");
    aParm      = _desc.ExtractTokenDouble (" ,\t");
    accuracy   = _desc.ExtractTokenDouble (" ,\t");
    trainTime  = (float)_desc.ExtractTokenDouble (" ,\t");
    classTime  = (float)_desc.ExtractTokenDouble (" ,\t");
    numSVs     = (float)_desc.ExtractTokenDouble (" ,\t");
  }
}
开发者ID:KurtKramer,项目名称:Pices,代码行数:42,代码来源:ParameterJob.cpp

示例2: StatusFileProcessLine

void  KKJobManager::StatusFileProcessLine (const KKStr&  ln,
                                           istream&      statusFile
                                          )
{
  if  (ln.SubStrPart (0, 1) == "//")
  {
    // A coment line;  we can ignore it.
    return;
  }

  KKStr  statusStr (ln);
  KKStr  fieldName = statusStr.ExtractToken2 ("\t");
  if  (fieldName.Empty ())
  {
    // A empty line we will ignore it.
    return;
  }

  statusStr.TrimLeft ("\n\r\t ");
  statusStr.TrimRight ("\n\r\t ");

  if  (fieldName.CompareIgnoreCase ("JOB") == 0)
  {
    // We have a KKJob entr line;  the next field determines JobType fllowed by parameters for that JobType constructor.
    KKStr  jobTypeName = fieldName = statusStr.ExtractToken2 ("\t");

    KKJobPtr  j = KKJob::CallAppropriateConstructor (this, jobTypeName, statusStr);
    KKJobPtr  existingJob = jobs->LookUpByJobId (j->JobId ());
    if  (existingJob)
    {
      existingJob->ReFresh (*j);
      delete  j;  j = NULL;
    }
    else
    {
      jobs->PushOnBack (j);
    }
  }

  else if  (fieldName.EqualIgnoreCase ("CPUTIMEUSED"))
  {
    double  cpuTimeUsed = statusStr.ExtractTokenDouble ("\t");
    cpuTimeTotalUsed += cpuTimeUsed;
  }

  else if  (fieldName.EqualIgnoreCase ("CURRENTDATETIME"))
  {
    KKB::DateTime  dateTime = KKB::DateTime (statusStr);
    if  (!dateTimeFirstOneFound)
    {
      dateTimeFirstOneFound = true;
      dateTimeStarted = dateTime;
    }
    dateTimeEnded = dateTime;
  }

  else if  (fieldName.EqualIgnoreCase ("ExpansionCount"))
    expansionCount = statusStr.ToInt ();

  else if  (fieldName.EqualIgnoreCase ("ExpansionFirstJobId"))
    expansionFirstJobId = statusStr.ToInt ();

  else if  (fieldName.EqualIgnoreCase ("JobStatusChange"))
    StatusFileProcessLineJobStatusChange (statusStr);

  else if  (fieldName.EqualIgnoreCase ("NextJobId"))
    nextJobId = statusStr.ExtractTokenInt ("\t");

  else if  (fieldName.EqualIgnoreCase ("QuitRunning"))
    quitRunning = true;

  else if  (fieldName.EqualIgnoreCase ("Restart"))
    restart = false;

  else if  (fieldName.EqualIgnoreCase ("Status"))
    status = KKJob::JobStatusFromStr (statusStr);

  else
  {
    log.Level (-1) << "KKJobManager::StatusFileProcessLine  Invalid Field Name[" << fieldName << "]." << endl;
  }
}  /* StatusFileProcessLine */
开发者ID:,项目名称:,代码行数:82,代码来源:

示例3: Load


//.........这里部分代码省略.........
    KKStr  field = l.ExtractToken ("\n\t\r ");
    if  (field != "\\IMAGESPERRETRAINING")
    {
      log.Level (-1) << endl
                     << "ActiveLearningReport::Load        *** ERROR ***" << endl
                     << endl
                     << "  Second Liine Not Valid[" << l << "]" << endl
                     << endl;
      fclose (f);
      return;
    }
    
    imagesPerRetraining = l.ExtractTokenInt ("\n\t\r ");
  }


  SortOrderResultsPtr  curSortOrderResults = NULL;

  while  (fgets (buff, sizeof (buff), f))
  {
    KKStr l (buff);

    if  (l.SubStrPart (0, 0) == "\\")
    {
      if  (curSortOrderResults)
      {
        results.PushOnBack (curSortOrderResults);
        curSortOrderResults = NULL;
      }

      SortOrderType  nextSortOrder = NULL_SortOrder;
      int            numOfRetrainings = 0;

      while  (l.SubStrPart (0, 0) == "\\")
      {
        l = l.SubStrPart (1);
        l.Upper ();

        KKStr  fieldName = l.ExtractToken ("\n\t\r ");
        if  (fieldName == "SORTORDER")
        {
          KKStr  sortOrderDesc = l.ExtractToken ("\n\t\r ");
          nextSortOrder = SortOrderTypeFromStr (sortOrderDesc);
        }
        else if  (fieldName == "NUMOFRETRAININGS")
        {
          numOfRetrainings = l.ExtractTokenInt ("\n\t\r ");
        }

        if  (fgets (buff, sizeof (buff), f))
          l = buff;
        else
          l = "";
      }
      
      if  (nextSortOrder == NULL_SortOrder)
      {
        log.Level (-1) << "ActiveLearningReport::Load        *** ERROR ***" << endl
                       << endl
                       << "   Invalid Sort Order Defined." << endl
                       << endl;
        fclose (f);
        return;
      }

      curSortOrderResults = new SortOrderResults (nextSortOrder);
    }

    if  (!curSortOrderResults)
    {
      log.Level (-1) << "ActiveLearningReport::Load        *** ERROR ***" << endl
                     << endl
                     << "   Invalid Sort Order Defined." << endl
                     << endl;
      fclose (f);
      return;
    }

    float numOfTrainingImages  = (float)l.ExtractTokenDouble ("\n\t\r ");
    float accuracy             = (float)l.ExtractTokenDouble ("\n\t\r ");
    float numOfSupportVectors  = (float)l.ExtractTokenDouble ("\n\t\r ");

    RetrainingResultsPtr  retrainingResults = new RetrainingResults (numOfTrainingImages,
                                                                     accuracy,
                                                                     numOfSupportVectors
                                                                    );
    curSortOrderResults->PushOnBack (retrainingResults);
  }

  if  (curSortOrderResults)
  {
    results.PushOnBack (curSortOrderResults);
    curSortOrderResults = NULL;
  }


  fclose (f);
  validFormat = true;
  return;
}  /* Load */
开发者ID:jizhihang,项目名称:Pices-XXX-,代码行数:101,代码来源:ActiveLearningReport.cpp


注:本文中的KKStr::ExtractTokenDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。