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


C++ Run类代码示例

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


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

示例1: try_merge

    inline bool
    try_merge(Run& run, Iterator iter, Range const& range)
    {
        // if *iter intersects with, or is adjacent to, 'range'...
        if (can_merge(*iter, range))
        {
            typedef typename Range::value_type value_type;
            typedef integer_traits<value_type> integer_traits;

            // merge range and *iter
            merge(*iter, range);

            // collapse all subsequent ranges that can merge with *iter:
            Iterator i = iter+1;
            // 1. skip subsequent ranges completely included in *iter
            while (i != run.end() && i->last <= iter->last)
                ++i;
            // 2. collapse next range if adjacent or overlapping with *iter
            if (i != run.end() && i->first-1 <= iter->last)
            {
                iter->last = i->last;
                ++i;
            }

            // erase all ranges that were collapsed
            run.erase(iter+1, i);
            return true;
        }
        return false;
    }
开发者ID:ARK1988,项目名称:nupic.core,代码行数:30,代码来源:range_run_impl.hpp

示例2: g_strdup

char*
TextSelection::GetText ()
{
    if (anchor.GetParent() == moving.GetParent() &&
            anchor.GetLocation () == moving.GetLocation())
        return g_strdup ("");

    GString *gstr = g_string_new ("");
    TextPointer tp = anchor;

    while (tp.CompareTo_np (moving) < 0) {
        if (tp.GetParent()->Is (Type::RUN)) {
            Run *run = (Run*)tp.GetParent();
            if (tp.GetParent() == moving.GetParent()) {
                // tp and moving are in the same element, so we append the substring and set tp = moving.
                g_string_append_len (gstr, run->GetText() + tp.ResolveLocation(), moving.ResolveLocation() - tp.ResolveLocation());
                tp = moving;
            }
            else {
                g_string_append (gstr, run->GetText());
                tp = run->GetContentEnd_np();
                tp = tp.GetPositionAtOffset_np (1, tp.GetLogicalDirection());
            }
        }
        else {
            tp = tp.GetPositionAtOffset_np (1, tp.GetLogicalDirection());
        }
    }

    printf ("returning %s from TextSelection::GetText\n", gstr->str);

    return g_string_free (gstr, FALSE);
}
开发者ID:snorp,项目名称:moon,代码行数:33,代码来源:textselection.cpp

示例3: skipRun

void VTTScanner::skipRun(const Run& run)
{
    ASSERT(run.start() <= end());
    ASSERT(run.end() >= run.start());
    ASSERT(run.end() <= end());
    seekTo(run.end());
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:7,代码来源:VTTScanner.cpp

示例4: estimateSteps

/*!\brief Estimating the necessary number of steps for each benchmark.
//
// \param run The parameters for the benchmark run.
// \return void
//
// This function estimates the necessary number of steps for the given benchmark based on the
// performance of the Blaze library.
*/
void estimateSteps( Run& run )
{
   using blazemark::element_t;
   using blaze::columnVector;

   ::blaze::setSeed( ::blazemark::seed );

   const size_t N( run.getSize() );

   blaze::DynamicVector<element_t,columnVector> a( N ), b( N ), c( N );
   blaze::timing::WcTimer timer;
   double wct( 0.0 );
   size_t steps( 1UL );

   blazemark::blaze::init( a );
   blazemark::blaze::init( b );

   while( true ) {
      timer.start();
      for( size_t i=0UL; i<steps; ++i ) {
         c = a * b;
      }
      timer.end();
      wct = timer.last();
      if( wct >= 0.2 ) break;
      steps *= 2UL;
   }

   if( c.size() != N )
      std::cerr << " Line " << __LINE__ << ": ERROR detected!!!\n";

   run.setSteps( blaze::max( 1UL, ( blazemark::runtime * steps ) / timer.last() ) );
}
开发者ID:EricSchles,项目名称:blaze-lib,代码行数:41,代码来源:DVecDVecMult.cpp

示例5: if

bool operator<(const Run& run1, const Run& run2)
{
    Run::RunStatus s1 = run1.getStatus();
    Run::RunStatus s2 = run2.getStatus();
    fptype t1 = run1.getTotalTime(); // time in seconds
    fptype t2 = run2.getTotalTime();

    // add penalties
    if (s1 == Run::DQF)
    {
	t1 += 200000;
    }
    else if (s1 == Run::DNF)
    {
	t1 += 100000;
    }

    if (s2 == Run::DQF)
    {
	t2 += 200000;
    }
    else if (s2 == Run::DNF)
    {
	t2 += 100000;
    }

    return t1 < t2;
}
开发者ID:karamellpelle,项目名称:open-forest,代码行数:28,代码来源:run.cpp

示例6: Text

		void Paragraph::AddSpace(const size_t count)
		{
			Run run;
			RunItemBase* text = new Text(std::string(count, ' '));
			run.add(text);
			Items->push_back(run);
		}
开发者ID:Alsan,项目名称:ONLYOFFICE-OnlineEditors,代码行数:7,代码来源:Paragraph.cpp

示例7: getMatchingExit

const Run<PPEvent>::iterator
getMatchingExit(Run<PPEvent>::iterator It, const Run<PPEvent>::iterator &End) {
  using namespace fmt;
  const Run<PPEvent>::iterator Cur = It;

  while (It != End) {
    PPEventType T = It->event();
    if (It->id() == Cur->id()) {
      switch(Cur->event()) {
        case RegionEnter:
          if (T == RegionExit) {
            return It;
          }
          break;
        case ScopEnter:
          if (T == ScopExit) {
            return It;
          }
          break;
        default:
          break;
      }
    }
    ++It;
  }

  //FIXME: Record an error event, this should not happen.
  static_assert("BUG: No matching Exit to this Entry", "");
  return Cur;
}
开发者ID:CIB,项目名称:polli,代码行数:30,代码来源:pprof.cpp

示例8: sleep

	int sleep (
		Run& run, Value& ret, Value* args, size_t nargs, 
		const char_t* name, size_t len)
	{
		if (args[0].isIndexed()) 
		{
			run.setError (QSE_AWK_EINVAL);
			return -1;
		}

		Awk::int_t x = args[0].toInt();

		/*Value arg;
		if (run.getGlobal(idLastSleep, arg) == 0)
			qse_printf (QSE_T("GOOD: [%d]\n"), (int)arg.toInt());
		else { qse_printf (QSE_T("BAD:\n")); }
		*/

		if (run.setGlobal (idLastSleep, x) <= -1) return -1;

	#if defined(_WIN32)
		::Sleep ((DWORD)(x * 1000));
		return ret.setInt (0);
	#elif defined(__OS2__)
		::DosSleep ((ULONG)(x * 1000));
		return ret.setInt (0);
	#else
		return ret.setInt (::sleep (x));
	#endif
	}
开发者ID:apense,项目名称:qse,代码行数:30,代码来源:awk25.cpp

示例9: estimateSteps

/*!\brief Estimating the necessary number of steps for each benchmark.
//
// \param run The parameters for the benchmark run.
// \return void
//
// This function estimates the necessary number of steps for the given benchmark based on the
// performance of the Blaze library.
*/
void estimateSteps( Run& run )
{
   using blazemark::element_t;
   using blaze::columnMajor;

   ::blaze::setSeed( ::blazemark::seed );

   const size_t N( run.getSize() );
   const size_t F( run.getNonZeros() );

   blaze::DynamicMatrix<element_t,columnMajor> A( N, N ), C( N, N );
   blaze::CompressedMatrix<element_t,columnMajor> B( N, N, N*F );
   blaze::timing::WcTimer timer;
   double wct( 0.0 );
   size_t steps( 1UL );

   blazemark::blaze::init( A );
   blazemark::blaze::init( B, F );

   while( true ) {
      timer.start();
      for( size_t i=0UL; i<steps; ++i ) {
         C = A + B;
      }
      timer.end();
      wct = timer.last();
      if( wct >= 0.2 ) break;
      steps *= 2UL;
   }

   if( C.rows() != N )
      std::cerr << " Line " << __LINE__ << ": ERROR detected!!!\n";

   run.setSteps( blaze::max( 1UL, ( blazemark::runtime * steps ) / timer.last() ) );
}
开发者ID:EricSchles,项目名称:blaze-lib,代码行数:43,代码来源:TDMatTSMatAdd.cpp

示例10: addStringLog

/** Add a sample log (property) with value as string
 * @brief AddSampleLog::addStringLog
 * @param theRun
 * @param propName
 * @param propValue
 * @param propUnit
 */
void AddSampleLog::addStringLog(Run &theRun, const std::string &propName,
                                const std::string &propValue,
                                const std::string &propUnit) {
  theRun.addLogData(new PropertyWithValue<std::string>(propName, propValue));
  theRun.getProperty(propName)->setUnits(propUnit);
  return;
}
开发者ID:mantidproject,项目名称:mantid,代码行数:14,代码来源:AddSampleLog.cpp

示例11: estimateFlops

/*!\brief Estimating the necessary number of floating point operations.
//
// \param run The parameters for the benchmark run.
// \return void
//
// This function estimates the number of floating point operations required for a single
// computation of the (composite) arithmetic operation.
*/
void estimateFlops( Run& run )
{
   const size_t N( run.getSize()     );
   const size_t F( run.getNonZeros() );

   run.setFlops( N*F );
}
开发者ID:EricSchles,项目名称:blaze-lib,代码行数:15,代码来源:TDMatTSMatAdd.cpp

示例12: Drawing

		Paragraph::Paragraph(const RId& rId, const OOX::CPath& filename, const long xEmu, const std::string& hRelativeFrom, const long yEmu, const std::string& vRelativeFrom, const long widthEmu, const long heightEmu)

		{
			RunItemBase* drawing = new Drawing(rId, filename, xEmu, hRelativeFrom, yEmu, vRelativeFrom, widthEmu, heightEmu);
			Run run;
			run.add(drawing);
			Items->push_back(run);
		}
开发者ID:Alsan,项目名称:ONLYOFFICE-OnlineEditors,代码行数:8,代码来源:Paragraph.cpp

示例13: mergeKeepExisting

/**
 * Copy logs from the input workspace to the output workspace
 * and don't replace any mathcing logs in the output workspace.
 */
void CopyLogs::mergeKeepExisting(
    const std::vector<Kernel::Property *> &inputLogs, Run &outputRun) {
  for (auto prop : inputLogs) {
    // add the log only if it doesn't already exist
    if (!outputRun.hasProperty(prop->name())) {
      outputRun.addLogData(prop->clone());
    }
  }
}
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:13,代码来源:CopyLogs.cpp

示例14: mergeKeepExisting

/**
 * Copy logs from the input workspace to the output workspace
 * and don't replace any mathcing logs in the output workspace.
 */
void CopyLogs::mergeKeepExisting(
    const std::vector<Kernel::Property *> &inputLogs, Run &outputRun) {
  for (auto iter = inputLogs.begin(); iter != inputLogs.end(); ++iter) {
    Kernel::Property *prop = *iter;
    // add the log only if it doesn't already exist
    if (!outputRun.hasProperty(prop->name())) {
      outputRun.addLogData(prop->clone());
    }
  }
}
开发者ID:spaceyatom,项目名称:mantid,代码行数:14,代码来源:CopyLogs.cpp

示例15: mergeReplaceExisting

/**
 * Copy logs from the input workspace to the output workspace
 * and replace any matching logs with the ones from the input workspace.
 */
void CopyLogs::mergeReplaceExisting(
    const std::vector<Kernel::Property *> &inputLogs, Run &outputRun) {
  for (auto prop : inputLogs) {
    // if the log exists, remove and replace it
    if (outputRun.hasProperty(prop->name())) {
      outputRun.removeLogData(prop->name());
    }
    outputRun.addLogData(prop->clone());
  }
}
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:14,代码来源:CopyLogs.cpp


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