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


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

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


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

示例1: cmdLine

CmdLineExpander::CmdLineExpander (const KKStr&  _applicationName,
                                  RunLog&       _log,
                                  const KKStr&  _cmdLine
                                 ):
  applicationName (_applicationName),
  log             (_log)

{
  VectorKKStr  initialParameters;

  KKStr  cmdLine (_cmdLine);

  cmdLine.TrimLeft ();
  while  (!cmdLine.Empty ())
  {
    KKStr  nextField = cmdLine.ExtractQuotedStr ("\n\r\t ", false);  // false = Do not decode escape characters
    nextField.TrimRight ();
    if  (!nextField.Empty ())
      initialParameters.push_back (nextField);
    cmdLine.TrimLeft ();
  }

  BuildCmdLineParameters (initialParameters);
  BuildExpandedParameterPairs ();
}
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:25,代码来源:CmdLineExpander.cpp

示例2: tagStr

XmlTag::XmlTag (istream&  i)
{
  tagType = tagNULL;

  if  (i.peek () == '<')
    i.get ();

  KKStr tagStr (100);
  ReadWholeTag (i, tagStr);

  if  (tagStr.FirstChar () == '/')
  {
    tagStr.ChopFirstChar ();
    tagType = tagEnd;
  }

  if  (tagStr.EndsWith ("/>"))
  {
    tagType = tagEmpty;
    tagStr.ChopLastChar ();
    tagStr.ChopLastChar ();
  }

  else if  (tagStr.LastChar () != '>')
  {
    tagType = tagStart;
  }

  else
  {
    if  (tagType == tagNULL)
      tagType = tagStart;
    tagStr.ChopLastChar ();
  }

  name.TrimLeft ();
  name.TrimRight ();

  name = tagStr.ExtractToken2 (" \n\r\t");
  KKStr attributeName (20);
  KKStr attributeValue (20);

  while  (!tagStr.Empty ())
  {
    ExtractAttribute (tagStr, attributeName, attributeValue);
    if  (!attributeName.Empty ())
      attributes.push_back (XmlAttribute (attributeName, attributeValue));
  }
}
开发者ID:jizhihang,项目名称:Pices-XXX-,代码行数:49,代码来源:XmlStream.cpp

示例3: ToString

KKStr  FeatureNumList::ToString ()  const
{
  KKStr  featureNumStr (numOfFeatures * 6);
  
  if  (numOfFeatures <= 0)
    return featureNumStr;

  kkint32  nextIdx = 0;

  while  (nextIdx < numOfFeatures)
  {
    kkint32  startOfGroup = nextIdx;
    kkint32  endOfGroup   = nextIdx;

    while  ((endOfGroup < (numOfFeatures - 1))  &&  
            (featureNums[endOfGroup] == (featureNums[endOfGroup + 1] - 1))
           )
    {
      endOfGroup++;
    }

    if  ((endOfGroup - startOfGroup) < 3)
    {
      kkint32  x;
      for  (x = startOfGroup;  x <= endOfGroup; x++)
      {
        if  (!featureNumStr.Empty ())
          featureNumStr << ",";
        featureNumStr << featureNums[x];
      }
    }
    else
    {
      if  (!featureNumStr.Empty ())
        featureNumStr << ",";
      featureNumStr << featureNums[startOfGroup] << "-" << featureNums[endOfGroup];
    }

    nextIdx = endOfGroup + 1;
  }

  return  featureNumStr;
}  /* ToString */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:43,代码来源:FeatureNumList.cpp

示例4: ParseCmdLineParameter

void  ModelParamUsfCasCor::ParseCmdLineParameter (const KKStr&  parameter,
                                                  const KKStr&  value,
                                                  bool&         parameterUsed,
                                                  RunLog&       log
                                               )
{
  parameterUsed = true;
  if  (parameter.EqualIgnoreCase ("-InLimit")  ||
       parameter.EqualIgnoreCase ("-IL")       ||
       parameter.EqualIgnoreCase ("-I")
      )
    in_limit = value.ToInt ();

  else if  (parameter.EqualIgnoreCase ("-OutLimit")  ||
            parameter.EqualIgnoreCase ("-OL")        ||
            parameter.EqualIgnoreCase ("-O")
      )
    out_limit = value.ToInt ();

  else if  (parameter.EqualIgnoreCase ("-NumberOfRounds")  ||
            parameter.EqualIgnoreCase ("-NOR")             ||
            parameter.EqualIgnoreCase ("-Rounds")          ||
            parameter.EqualIgnoreCase ("-R")
      )
    number_of_rounds = value.ToInt ();

  else if  (parameter.EqualIgnoreCase ("-NumberOfTrials")  ||
            parameter.EqualIgnoreCase ("-NOT")             ||
            parameter.EqualIgnoreCase ("-T")
      )
    number_of_trials = value.ToInt ();


  else if  (parameter.EqualIgnoreCase ("-RandomSeed")  ||
            parameter.EqualIgnoreCase ("-RS")          ||
            parameter.EqualIgnoreCase ("-S")
      )
    random_seed = value.ToInt ();

  else if  (parameter.EqualIgnoreCase ("-UseCache")  ||
            parameter.EqualIgnoreCase ("-UC")        ||
            parameter.EqualIgnoreCase ("-Cache")
      )
  {
    if  (value.Empty ())
      useCache = true;
    else
      useCache = value.ToBool ();
  }

  else
    parameterUsed = false;
}  /* ParseCmdLineParameter */
开发者ID:,项目名称:,代码行数:53,代码来源:

示例5: parser

FeatureNumList::VectorIntType*  FeatureNumList::StrToUInt16Vetor (const KKStr&  s)
{
  bool  valid = true;
  VectorIntType*  results = new VectorUint16 ();

  KKStrParser parser (s);
  parser.TrimWhiteSpace (" ");

  while  (parser.MoreTokens ())
  {
    KKStr  field = parser.GetNextToken (",\t");
    if  (field.Empty ())
      continue;
    auto dashPos = field.LocateCharacter ('-');
    if  (!dashPos)
    {
      kkint32 n = field.ToInt32 ();
      if ((n < 0) || ((kkuint32)n > maxIntType))
      {
        valid = false;
        break;
      }
      results->push_back ((IntType)n);
    }
    else
    {
      // We are looking at a range
      kkint32  startNum = field.SubStrSeg (0, dashPos).ToInt32 ();
      kkint32  endNum   = field.SubStrPart (dashPos + 1).ToInt32 ();

      if  ((startNum > endNum)  ||  (startNum < 0)  ||  ((kkuint32)endNum > maxIntType))
      {
        valid = false;
        break;
      }

      for  (kkint32 z = startNum;  z <= endNum;  ++z)
        results->push_back ((IntType)z);
    }
  }

  if  (!valid)
  {
    delete  results;
    results = NULL;
  }
  else
  {
    sort (results->begin (), results->end ());
  }

  return  results;
}  /* StrToUInt16Vetor */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:53,代码来源:FeatureNumList.cpp

示例6: parser

DateTime::DateTime (const KKStr&  s):
      date(),
      time ()

{
  if  (s.Empty ())
    return;

  KKStrParser parser (s);
  KKStr  field1 = parser.GetNextToken ("- ");
  KKStr  field2 = parser.GetNextToken ("- ");

  date = DateType (field1);
  time = TimeType (field2);
}
开发者ID:jizhihang,项目名称:Pices-XXX-,代码行数:15,代码来源:DateTime.cpp

示例7: WriteXML

void  FeatureEncoder::WriteXML (const KKStr&  varName,
                                ostream&      o
                               )  const
{
  XmlTag  tagStart ("TrainingClassList", XmlTag::TagTypes::tagStart);
  if  (!varName.Empty ())
    tagStart.AddAtribute ("VarName", varName);

  tagStart.WriteXML (o);
  o << endl;

  XmlElementInt32::WriteXML  (codedNumOfFeatures,     "CodedNumOfFeatures",     o);
  XmlElementDouble::WriteXML (c_Param,                "c_Param",                o);
  XmlElementInt32::WriteXML  (numEncodedFeatures,     "NumEncodedFeatures",     o);
  XmlElementInt32::WriteXML  (numOfFeatures,          "NumOfFeatures",          o);
  XmlElementInt32::WriteXML  (xSpaceNeededPerExample, "xSpaceNeededPerExample", o);

  if  (cardinalityDest)
    XmlElementArrayInt32::WriteXML (numOfFeatures, cardinalityDest, "CardinalityDest", o);

  if  (class1)  class1->Name ().WriteXML ("Class1", o);
  if  (class2)  class2->Name ().WriteXML ("Class2", o);
  if  (destFeatureNums)
    XmlElementArrayInt32::WriteXML (numOfFeatures, destFeatureNums, "DestFeatureNums", o);

  if  (fileDesc)      fileDesc->WriteXML     ("FileDesc",     o);
  if  (destFileDesc)  destFileDesc->WriteXML ("DestFileDesc", o);

  if  (destWhatToDo)
  {
    VectorInt32  v;
    for  (kkint32 x = 0;  x < numOfFeatures;  ++x)
      v.push_back ((kkint32)(destWhatToDo[x]));
    XmlElementVectorInt32::WriteXML (v, "DestWhatToDo", o);
  }

  EncodingMethodToStr (encodingMethod).WriteXML ("EncodingMethod", o);

  selectedFeatures.WriteXML ("selectedFeatures", o);

  if  (srcFeatureNums)
    XmlElementArrayInt32::WriteXML (numOfFeatures, srcFeatureNums, "SrcFeatureNums", o);
 
  XmlTag  tagEnd ("TrainingClassList", XmlTag::TagTypes::tagEnd);
  tagEnd.WriteXML (o);
  o << endl;
}
开发者ID:,项目名称:,代码行数:47,代码来源:

示例8: WriteXML

void  FeatureNumList::WriteXML (const KKStr&  varName,
                                ostream&      o
                               )  const
{
  XmlTag  startTag ("FeatureNumList", XmlTag::TagTypes::tagStart);
  if  (!varName.Empty ())
    startTag.AddAtribute ("VarName", varName);
  startTag.AddAtribute ("MaxFeatureNum", maxFeatureNum);
  startTag.AddAtribute ("NumOfFeatures", numOfFeatures);
  startTag.WriteXML (o);

  o << ToString ();

  XmlTag  endTag ("FeatureNumList", XmlTag::TagTypes::tagEnd);
  endTag.WriteXML (o);
  o << endl;
}
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:17,代码来源:FeatureNumList.cpp

示例9: FileFormatsReadAndWriteOptionsStr

KKStr  FeatureFileIO::FileFormatsReadAndWriteOptionsStr ()
{
  KKStr  driversThatCanReadAndWrite (128);

  vector<FeatureFileIOPtr>*  drivers = RegisteredDrivers ();

  vector<FeatureFileIOPtr>::const_iterator  idx;
  for  (idx = drivers->begin ();  idx != drivers->end ();  idx++)
  {
    FeatureFileIOPtr  driver = *idx;
    if  (driver->CanWrite ()  &&  driver->CanWrite ())
    {
      if  (!driversThatCanReadAndWrite.Empty ())
        driversThatCanReadAndWrite << ", ";
      driversThatCanReadAndWrite << driver->DriverName ();
    }
  }
  return driversThatCanReadAndWrite;
}  /* FileFormatsReadAndWriteOptionsStr */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:19,代码来源:FeatureFileIO.cpp

示例10: PerformMorphOperations

void  LogicalFrame::PerformMorphOperations ()
{
  KKStr  ops = parms.MorphOperations ();

  memcpy (origFrameArea, frameArea, frameTotalPixels);
  
  while  (!ops.Empty ())
  {
    KKStr  nextOp = ops.ExtractToken (",\n\r\t");
    nextOp.Upper ();
    if  (nextOp == "O")
      PerformOpening ();

    else if  (nextOp == "C")
      PerformClosing ();

    else if  (nextOp == "D")
      PerformDialation ();

    else if  (nextOp == "E")
      PerformErosion ();
  }

}  /* PerformMorphOperations */
开发者ID:KurtKramer,项目名称:Pices,代码行数:24,代码来源:LogicalFrame.cpp

示例11: featureFileName

FeatureVectorListPtr  FeatureFileIO::LoadInSubDirectoryTree 
                         (FactoryFVProducerPtr  _fvProducerFactory,
                          KKStr                 _rootDir,
                          MLClassList&          _mlClasses,
                          bool                  _useDirectoryNameForClassName,
                          VolConstBool&         _cancelFlag, 
                          bool                  _rewiteRootFeatureFile,
                          RunLog&               _log
                         )
{
  _log.Level (10) << "FeatureFileIO::LoadInSubDirectoryTree    rootDir[" << _rootDir << "]." << endl;

  osAddLastSlash (_rootDir);

  KKStr  featureFileName ("");
  KKStr  fullFeatureFileName ("");

  if  (!_rootDir.Empty ())
  {
    featureFileName = osGetRootNameOfDirectory (_rootDir) + ".data";
    fullFeatureFileName = _rootDir + featureFileName;
  }
  else
  {
    featureFileName     = "Root.data";
    fullFeatureFileName = "Root.data";
  }

  MLClassPtr  unKnownClass = _mlClasses.GetUnKnownClass ();
  if  (_useDirectoryNameForClassName)
  {
    KKStr className = MLClass::GetClassNameFromDirName (_rootDir);
    unKnownClass    = _mlClasses.GetMLClassPtr (className);
  }

  bool  changesMade = false;

  FeatureVectorListPtr  dirImages = NULL;

  if  (_rewiteRootFeatureFile)
  {
    DateTime  timeStamp;
    dirImages = FeatureDataReSink (_fvProducerFactory,
                                   _rootDir,
                                   featureFileName,
                                   unKnownClass,
                                   _useDirectoryNameForClassName,
                                   _mlClasses,
                                   _cancelFlag,
                                   changesMade,
                                   timeStamp,
                                   _log
                                  );
    if  (_useDirectoryNameForClassName)
    {
      FeatureVectorList::iterator  idx;
      for  (idx = dirImages->begin ();  idx != dirImages->end ();  idx++)
      {
        if  ((*idx)->MLClass () != unKnownClass)
        {
          (*idx)->MLClass (unKnownClass);
          changesMade = true;
        }
      }

      if  (changesMade)
      {
        KKStr  fullFileName = osAddSlash (_rootDir) + featureFileName;
        kkuint32  numExamplesWritten = 0;
        bool  cancel     = false;
        bool  successful = false;
        SaveFeatureFile (fullFileName, 
                         dirImages->AllFeatures (), 
                         *dirImages, 
                         numExamplesWritten,
                         cancel,
                         successful,
                         _log
                        );
      }
    }
  }
  else
  {
    dirImages =  _fvProducerFactory->ManufacturFeatureVectorList (true);
  }

  // Now that we have processed all image files in "rootDir",
  // lets process any sub-directories.

  KKStr  dirSearchPath = osAddSlash (_rootDir) + "*.*";

  KKStrListPtr  subDirectories = osGetListOfDirectories (dirSearchPath);
  if  (subDirectories)
  {
    KKStrList::iterator  idx;

    for  (idx = subDirectories->begin ();  (idx != subDirectories->end ()  &&  (!_cancelFlag));   idx++)
    {
      KKStr  subDirName (**idx);
//.........这里部分代码省略.........
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:101,代码来源:FeatureFileIO.cpp

示例12: ProcessCmdLineParameter

/******************************************************************************
 * ProcessCmdLineParamters
 * DESC: Extracts parameters from the command line
 ******************************************************************************/
bool  OurNeighbors::ProcessCmdLineParameter (const KKStr&  parmSwitch, 
                                             const KKStr&  parmValue
                                            )
{
  bool  validParm = true;
  if  (parmSwitch.EqualIgnoreCase ("-BUCKETCOUNT")  ||  parmSwitch.EqualIgnoreCase ("-BC"))
  {
    numOfBuckets = atoi (parmValue.Str ());
    if  (numOfBuckets < 2)
    {
      log.Level (-1) << "ProcessCmdLineParameter   *** Invalid Buckets[" << numOfBuckets << "] parameter" << endl;
      validParm = false;
    }
  }

  else if  (parmSwitch.EqualIgnoreCase ("-BUCKETSIZE")  ||  parmSwitch.EqualIgnoreCase ("-BS"))
  {
    bucketSize = atoi (parmValue.Str ());
    if  (bucketSize < 1)
    {
      log.Level (-1) << "ProcessCmdLineParameter   *** Invalid BucketSize[" << bucketSize << "] parameter" << endl;
      Abort (true);
    }
  }

  else if  (parmSwitch.EqualIgnoreCase ("-EXCLUDECLASS")  ||  parmSwitch.EqualIgnoreCase ("-EC"))
  {
    if  (parmValue.Empty ())
    {
      log.Level (-1) << endl << endl
                     << "ProcessCmdLineParameter   '-ExcludeClass'  missing class name to exclude." << endl
                     << endl;
      Abort (true);
    }

    else 
    {
      if  (!excludedClasses)
        excludedClasses = new MLClassList ();

      if  (excludedClasses->LookUpByName (parmValue) != NULL)
      {
        log.Level (-1) << "ProcessCmdLineParameter  '-ExcludeClass[" << parmValue << "]'  Specified more than once." << endl;
      }
      else
      {
        excludedClasses->PushOnBack (MLClass::CreateNewMLClass (parmValue));
      }
    }
  }


  else if  (parmSwitch.EqualIgnoreCase ("-FROMPLANKTON")  ||  parmSwitch.EqualIgnoreCase ("-FP"))
  {
    fromPlanktonName = parmValue;
  }

  else if  (parmSwitch.EqualIgnoreCase ("-H")  ||  parmSwitch.EqualIgnoreCase ("-HTML"))
		htmlFileName = parmValue;

  else if  (parmSwitch.EqualIgnoreCase ("-ITERATIONS")  ||  parmSwitch.EqualIgnoreCase ("-I"))
  {
    numOfIterations = atoi (parmValue.Str ());
    if  (numOfIterations < 1)
    {
      log.Level (-1) << "ProcessCmdLineParameter   *** Invalid Iterations[" << numOfIterations << "] parameter" << endl;
      Abort (true);
    }
  }


  else if  (parmSwitch.EqualIgnoreCase ("-LLOYDSBINSIZE")      ||  
            parmSwitch.EqualIgnoreCase ("-LBS")                ||  
            parmSwitch.EqualIgnoreCase ("-BASELLOYDSBINSIZE")  ||  
            parmSwitch.EqualIgnoreCase ("-BLBS")
           )
  {
    baseLLoydsBinSize = atoi (parmValue.Str ());
    if  (baseLLoydsBinSize < 10)
    {
      log.Level (-1) << endl << endl 
                     << "ProcessCmdLineParameter   *** Invalid BaseLLoydsBinSize[" << baseLLoydsBinSize << "] parameter  ***" << endl
                     << endl;
      Abort (true);
    }
  }


  else if  (parmSwitch.EqualIgnoreCase ("-NEARESTNEIGHBORTYPE")  ||  parmSwitch.EqualIgnoreCase ("-NNT"))
  {
    if  (parmValue.EqualIgnoreCase ("0")  ||  parmValue.EqualIgnoreCase ("ANY"))
      neighborType = NeighborType::AnyPlankton;

    else if  (parmValue.EqualIgnoreCase ("1")  ||  parmValue.EqualIgnoreCase ("SAME"))
      neighborType = NeighborType::SamePlankton;
  }
//.........这里部分代码省略.........
开发者ID:KurtKramer,项目名称:Pices,代码行数:101,代码来源:OurNeighbors.cpp

示例13: BuildCmdLineParameters

void  CmdLineExpander::BuildCmdLineParameters (const VectorKKStr&  argv)
{
  kkuint32  x = 0;

  while  (x < argv.size ())
  {
    KKStr  s = argv[x];
    x++;

    KKStr  sUpper = s.ToUpper();
    if  ((sUpper == "-L")  ||  (sUpper == "-LOGFILE"))
    {
      if  (x < argv.size ())
      {
        if  (argv[x][(kkint16)0] != '-')
        {
          logFileName = argv[x];
          if  (!logFileName.Empty ())
            log.AttachFile (logFileName);
          x++;
        }
      }

      if  (logFileName.Empty ())
      {
        log.Level (-1) << std::endl << std::endl;
        log.Level (-1) << applicationName   << " - Invalid Log File Parameter (-L)." << endl;
        log.Level (-1) << "                 Name of log file required."              << endl;
        log.Level (-1) << endl;
        parmsGood = false;
      }

    }

    else if  (sUpper == "-CMDFILE")
    {
      KKStr  cmdFileName = "";

      if  (x < argv.size ())
      {
        if  (argv[x][(kkint16)0] != '-')
        {
          cmdFileName = argv[x];
          x++;
        }
      }

      if  (cmdFileName.Empty ())
      {
        log.Level (-1) << endl << endl << endl
             << applicationName  << "  "  << "BuildCmdLineParameters             *** ERROR ***"  << endl << endl
             << "-CMDFILE option did not define a file name." << endl
             << endl;

        parmsGood = false;
      }

      else
      {
        if  (FileInStack (cmdFileName, cmdFileStack))
        {
          log.Level (-1) << endl << endl << endl
               << applicationName  << "  BuildCmdLineParameters             *** ERROR ***"  << endl 
               << endl
               << "-CMDFILE [" << cmdFileName << "]  is being called recursively."  << endl
               << endl;
 
          parmsGood = false;
        }
        else
        {
          bool  validFile = true;
          cmdFileStack.push_back (cmdFileName);
          VectorKKStr  cmdFileParameters;
          ExtractParametersFromFile (cmdFileName, cmdFileParameters, validFile);
          BuildCmdLineParameters (cmdFileParameters);
          cmdFileStack.pop_back ();
          if  (!validFile)
            parmsGood = false;
        }
      }
    }

    else
    {
      expandedParameters.push_back (s);
    }
  }
}  /* BuildCmdLineParameters */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:89,代码来源:CmdLineExpander.cpp

示例14: ProcessCmdLineParameter

bool  MergeFeatureFiles::ProcessCmdLineParameter (const KKStr&  parmSwitch, 
                                                  const KKStr&  parmValue
                                                 )
{
  bool  validParm = true;

  if  (parmSwitch.EqualIgnoreCase ("-S")    ||  
       parmSwitch.EqualIgnoreCase ("-SRC")  ||  
       parmSwitch.EqualIgnoreCase ("-SOURCE")
      )
  {
    KKStr  srcFileName = parmValue;
    if  (!osFileExists (srcFileName))
    {
      log.Level (-1) << "ProcessCmdLineParameter   ***ERROR***    Invalid '-src' [" << srcFileName << "] file." << endl;
      Abort (true);
      validParm = false;
    }

    srcFileNames.push_back (srcFileName);
    srcFormats.push_back   (currentDefaultFormat);
    if  (!currentDefaultFormat->CanRead ())
    {
      log.Level (-1) << "ProcessCmdLineParameter   ***ERROR***    Format[" << currentDefaultFormat->DriverName () << "] does not support read." << endl;
      Abort (true);
      validParm = false;
    }
  }

  else if  
    (parmSwitch.EqualIgnoreCase ("-DEST")        ||  
     parmSwitch.EqualIgnoreCase ("-D")           ||  
     parmSwitch.EqualIgnoreCase ("-DESTINATION")
    )
  {
    if  (!destFileName.Empty ())
    {
      log.Level (-1) << "ProcessCmdLineParameter   ***ERROR***    More than one destination file was specified." << endl;
      Abort (true);
      validParm= false;
    }
    
    destFileName = parmValue;
    if  (osFileExists (destFileName))
    {
      log.Level (-1) << "ProcessCmdLineParameter   ***ERROR***    Destination File[" << destFileName << "] already exists." << endl;
      Abort (true);
      validParm = false;
    }

    if  (!currentDefaultFormat->CanWrite ())
    {
      log.Level (-1) << "ProcessCmdLineParameter   ***ERROR***    Format[" << currentDefaultFormat->DriverName () << "] does not support write." << endl;
      Abort (true);
      validParm = false;
    }

    destFormat = currentDefaultFormat;
  }

  else if  
    (parmSwitch.EqualIgnoreCase ("-F")  ||  
     parmSwitch.EqualIgnoreCase ("-FORMAT")
    )
  {
    FeatureFileIOPtr  newFormat = FeatureFileIO::FileFormatFromStr (parmValue);
    if  (!newFormat)
    {
      log.Level (-1) << "ProcessCmdLineParameter   ***ERROR***    No such format as[" << parmValue<< "]." << endl;
      Abort (true);
      validParm = false;
    }
    else
    {
      currentDefaultFormat = newFormat;
    }
  }

  else if 
    (parmSwitch.EqualIgnoreCase ("-STRAT")  ||  
     parmSwitch.EqualIgnoreCase ("-STRATIFY")
    )
  {
    stratify = true;
    if  (!parmValue.Empty ())
    {
      numOfFolds = parmValue.ToInt ();
      if  ((numOfFolds < 1)  ||  (numOfFolds > 1000))
      {
        log.Level (-1) << "ProcessCmdLineParameter   ***ERROR***    -Folds[" << numOfFolds << "]  must be 1 or greater and less than 10000." << endl;
        Abort (true);
        validParm = false;
      }
    }
  }


  else if  
    (parmSwitch.EqualIgnoreCase ("-RAND")    ||
     parmSwitch.EqualIgnoreCase ("-RANDOM")  ||
//.........这里部分代码省略.........
开发者ID:KurtKramer,项目名称:Pices,代码行数:101,代码来源:MergeFeatureFiles.cpp

示例15: UpdateFullSizeImages

void  UpdateFullSizeImages ()
{
  RunLog  log;
  DataBasePtr  dbConn = new DataBase (log);


  SipperFileListPtr  sipperFiles = dbConn->SipperFileLoad ("ETP2008", "", "");

  SipperFileList::iterator  idx;

  bool   cancelFlag = false;


  KKB::uint  numImages = 0;
  KKB::uint  numImagesSaved = 0;

  for  (idx = sipperFiles->begin ();  idx != sipperFiles->end ();  idx++)
  {
    SipperFilePtr sf = *idx;

    KKStr  fullSipperFileName = InstrumentDataFileManager::GetFullSipperFileName (sf->SipperFileName ());
    if  (fullSipperFileName.Empty ())
    {
      // we do not have access to the sipper file;  no point proessing this file.
      continue;
    }

    int imagesThisSipperFile = 0;

    cout << "Sipper File [" << sf->SipperFileName () << "]" << std::endl;

    bool  cancelFlag = false;
    //DataBaseImageListPtr  images = dbConn->ImagesQuery (NULL, sf->SipperFileName (), NULL, 0.0f, 1.0f, 0, 0, 0.0f, 0.0f, "ETP2008_1AA_01_04560000_0000", 1000, false, cancelFlag);
    DataBaseImageListPtr  images = dbConn->ImagesQuery (NULL, sf->SipperFileName (), NULL, 'P', 0.0f, 1.0f, 0, 0, 0.0f, 0.0f, 0, -1, false, cancelFlag);
    
    map<KKStr, KKStr>*  imagesAlreadtInFullSize = GetImagesAlreadyInImagesFullSize (sf->SipperFileName (), dbConn);
    map<KKStr, KKStr>::iterator  fullSizeIdx;

    DataBaseImageList::iterator  idx;
    for  (idx = images->begin ();  idx != images->end ();  idx++)
    {
      imagesThisSipperFile++;
      numImages++;

      DataBaseImagePtr  i = *idx;
      KKB::uint  maxDim = Max (i->Height (), i->Width ());
      if  (maxDim > 100)
      {
        fullSizeIdx = imagesAlreadtInFullSize->find (i->ImageFileName ());
        if  (fullSizeIdx == imagesAlreadtInFullSize->end ())
        {
          // We need to get the full size version of this image.
          RasterPtr r = i->GetOrigImageFromSipperFile (log);
          if  (r)
          {
            dbConn->ImageFullSizeSave (i->ImageFileName (), *r);
            delete  r;
            r = NULL;
          }
          numImagesSaved++;
        }
      }

      if  ((numImages % 100) == 0)
      {
        cout << sf->SipperFileName () << "\t"
             << StrFormatInt (images->QueueSize (), "ZZ,ZZZ,ZZ0") << "\t"
             << StrFormatInt (imagesThisSipperFile, "ZZ,ZZZ,ZZ0") << "\t"
             << StrFormatInt (numImages,            "ZZ,ZZZ,ZZ0") << "\t"
             << StrFormatInt (numImagesSaved,       "ZZ,ZZZ,ZZ0")
             << endl;
      }

    }

    delete  imagesAlreadtInFullSize;
    imagesAlreadtInFullSize = NULL;

    delete  images;
    images = NULL;
  }
}   /* UpdateFullSizeImages */
开发者ID:KurtKramer,项目名称:Pices,代码行数:82,代码来源:MergeFeatureFiles.cpp


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