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


C++ priority函数代码示例

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


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

示例1: adoptPtr

PassOwnPtr<CrossThreadResourceRequestData> ResourceRequest::copyData() const
{
    OwnPtr<CrossThreadResourceRequestData> data = adoptPtr(new CrossThreadResourceRequestData());
    data->m_url = url().copy();
    data->m_cachePolicy = getCachePolicy();
    data->m_timeoutInterval = timeoutInterval();
    data->m_firstPartyForCookies = firstPartyForCookies().copy();
    data->m_requestorOrigin = requestorOrigin() ? requestorOrigin()->isolatedCopy() : nullptr;
    data->m_httpMethod = httpMethod().string().isolatedCopy();
    data->m_httpHeaders = httpHeaderFields().copyData();
    data->m_priority = priority();
    data->m_intraPriorityValue = m_intraPriorityValue;

    if (m_httpBody)
        data->m_httpBody = m_httpBody->deepCopy();
    data->m_allowStoredCredentials = m_allowStoredCredentials;
    data->m_reportUploadProgress = m_reportUploadProgress;
    data->m_hasUserGesture = m_hasUserGesture;
    data->m_downloadToFile = m_downloadToFile;
    data->m_useStreamOnResponse = m_useStreamOnResponse;
    data->m_skipServiceWorker = m_skipServiceWorker;
    data->m_shouldResetAppCache = m_shouldResetAppCache;
    data->m_requestorID = m_requestorID;
    data->m_requestorProcessID = m_requestorProcessID;
    data->m_appCacheHostID = m_appCacheHostID;
    data->m_requestContext = m_requestContext;
    data->m_frameType = m_frameType;
    data->m_fetchRequestMode = m_fetchRequestMode;
    data->m_fetchCredentialsMode = m_fetchCredentialsMode;
    data->m_fetchRedirectMode = m_fetchRedirectMode;
    data->m_loFiState = m_loFiState;
    data->m_referrerPolicy = m_referrerPolicy;
    data->m_didSetHTTPReferrer = m_didSetHTTPReferrer;
    data->m_checkForBrowserSideNavigation = m_checkForBrowserSideNavigation;
    data->m_uiStartTime = m_uiStartTime;
    data->m_originatesFromReservedIPRange = m_originatesFromReservedIPRange;
    data->m_inputPerfMetricReportPolicy = m_inputPerfMetricReportPolicy;
    data->m_followedRedirect = m_followedRedirect;
    return data.release();
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:40,代码来源:ResourceRequest.cpp

示例2: main

int main(int argc, char *argv[])
{
	int choice;

	if (argc != 2)
	{
		fprintf(stderr, "Usage: [%s] + num_process\n", argv[0]);
	}

	while (true)
	{
		menu_show();
		scanf("%d", &choice);

		switch(choice)
		{
			case 1:
				priority_create(atoi(argv[1]));
				priority();
				break;
			case 2:
				fcfs_create(atoi(argv[1]));
				fcfs();
				break;
			case 3:
				sjf_create(atoi(argv[1]));
				sjf();
				break;
			case 0:
				printf("退出程序...\n");
				break;
			default:
				printf("选择错误,请重新选择!\n");
				break;
		}	
		if (choice == 0)
			break;
	}
	return EXIT_SUCCESS;
}
开发者ID:astrotycoon,项目名称:operating-system-experience,代码行数:40,代码来源:main.c

示例3: setPriority

bool GRIProcessThread::ChangePriority(bool is_up) {
  int current_priority = (int)(priority());
  int normal_priority = (int)QThread::NormalPriority;

  if (is_up) {
    if (current_priority >= normal_priority) {
      if (last_adjustment_to_sat_ >= num_packets_to_sat_) {
	setPriority((QThread::Priority)(++current_priority));
	last_adjustment_to_sat_ = 0;
	return true;
      }
      return false;
    }  else {
      if (last_adjustment_from_sat_ >= num_packets_from_sat_) {
	setPriority((QThread::Priority)(++current_priority));
	last_adjustment_from_sat_ = 0;
	return true;
      }
      return false;
    }
  } else {
    if (current_priority <= normal_priority) {
      if (last_adjustment_to_sat_ >= num_packets_to_sat_) {
	setPriority((QThread::Priority)(--current_priority));
	last_adjustment_to_sat_ = 0;
	return true;
      }
      return false;
    } else {
      if (last_adjustment_from_sat_ >= num_packets_from_sat_) {
	setPriority((QThread::Priority)(--current_priority));
	last_adjustment_from_sat_ = 0;
	return true;
      }
      return false;
    }
  }
}
开发者ID:bearing,项目名称:grif,代码行数:38,代码来源:GRIProcessThread.cpp

示例4: getenv

Priority Logger::getLogLevelFromEnv()
{
    char* loglevel = getenv("BASE_LOG_LEVEL");
    if(!loglevel)
        return UNKNOWN_P;

    std::string priority(loglevel);
    std::transform(priority.begin(), priority.end(),priority.begin(), (int(*)(int)) std::toupper);
    
    int index = 0;
    std::vector<std::string>::iterator it = mPriorityNames.begin();
    for(;it != mPriorityNames.end(); it++)
    {
        if(*it != priority)
        {
            index++;
        } else {
            return (Priority) index; 
        }
    }

    return UNKNOWN_P;
}
开发者ID:doudou,项目名称:base-types,代码行数:23,代码来源:logging_printf_style.cpp

示例5: adoptPtr

PassOwnPtr<CrossThreadResourceRequestData> ResourceRequestBase::copyData() const
{
    OwnPtr<CrossThreadResourceRequestData> data = adoptPtr(new CrossThreadResourceRequestData());
    data->m_url = url().copy();
    data->m_cachePolicy = cachePolicy();
    data->m_timeoutInterval = timeoutInterval();
    data->m_firstPartyForCookies = firstPartyForCookies().copy();
    data->m_httpMethod = httpMethod().crossThreadString();
    data->m_httpHeaders = httpHeaderFields().copyData();
    data->m_priority = priority();

#if PLATFORM(MAC) || PLATFORM(WIN)
    data->m_responseContentDispositionEncodingFallbackArray.reserveInitialCapacity(m_responseContentDispositionEncodingFallbackArray.size());
    size_t encodingArraySize = m_responseContentDispositionEncodingFallbackArray.size();
    for (size_t index = 0; index < encodingArraySize; ++index) {
        data->m_responseContentDispositionEncodingFallbackArray.append(m_responseContentDispositionEncodingFallbackArray[index].crossThreadString());
    }
#endif
    if (m_httpBody)
        data->m_httpBody = m_httpBody->deepCopy();
    data->m_allowCookies = m_allowCookies;
    return asResourceRequest().doPlatformCopyData(data.release());
}
开发者ID:1833183060,项目名称:wke,代码行数:23,代码来源:ResourceRequestBase.cpp

示例6: priority

///
/// ソート時のキーとなるスコア計算
void Sprite::calcSortScore() {
    int score = priority() * 100;

    //  ブレンドモードによって描画グループを分ける為にスコアを変える
    constexpr int BLEND_SCORE_MODE_NORMAL = 0;
    constexpr int BLEND_SCORE_MODE_ADD = 20;
    constexpr int BLEND_SCORE_MODE_NONE = 40;
    int blend_score = BLEND_SCORE_MODE_NORMAL;
    if (blend_mode_ == cross::RenderSystem::BlendMode::ADD) {
        //  加算半透明
        blend_score = BLEND_SCORE_MODE_ADD;
    }
    else if (blend_mode_ == cross::RenderSystem::BlendMode::NONE) {
        //  ブレンド無し
        blend_score = BLEND_SCORE_MODE_NONE;
    }

    //  スプライトのプライオリティとブレンドモードのスコアから最終的なスコアを求める
    score += blend_score;

    //  計算結果を設定
    sort_score_ = score;
}
开发者ID:doscoy,项目名称:tri_engine,代码行数:25,代码来源:tri_sprite.cpp

示例7: OstTraceFunctionEntry0

//-----------------------------------------------------------------------------
//  RCmDestinationExt::PriorityL()
//-----------------------------------------------------------------------------
//
EXPORT_C TUint RCmDestinationExt::PriorityL(
        const RCmConnectionMethodExt& aConnectionMethod )
    {
    OstTraceFunctionEntry0( RCMDESTINATIONEXT_PRIORITYL_ENTRY );

    if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() )
        {
        User::Leave( KErrBadHandle );
        }
    if ( !aConnectionMethod.iCmConnectionMethodWrapper ||
            !aConnectionMethod.iCmConnectionMethodWrapper->SessionConnected() )
        {
        User::Leave( KErrArgument );
        }

    TUint priority( 0 );
    TInt handle = aConnectionMethod.iCmConnectionMethodWrapper->GetHandle();
    TInt err = iCmDestinationWrapper->Priority( handle, priority );
    User::LeaveIfError( err );

    OstTraceFunctionExit0( RCMDESTINATIONEXT_PRIORITYL_EXIT );
    return priority;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:27,代码来源:cmdestinationext.cpp

示例8: system

void emu_options::update_slot_options(const software_part *swpart)
{
	// look up the system configured by name; if no match, do nothing
	const game_driver *cursystem = system();
	if (cursystem == nullptr)
		return;
	machine_config config(*cursystem, *this);

	// iterate through all slot devices
	slot_interface_iterator iter(config.root_device());
	for (device_slot_interface *slot = iter.first(); slot != nullptr; slot = iter.next())
	{
		// retrieve info about the device instance
		const char *name = slot->device().tag() + 1;
		if (exists(name) && !slot->option_list().empty())
		{
			std::string defvalue = slot->get_default_card_software();
			if (defvalue.empty())
			{
				// keep any non-default setting
				if (priority(name) > OPTION_PRIORITY_DEFAULT)
					continue;

				// reinstate the actual default value as configured
				if (slot->default_option() != nullptr)
					defvalue.assign(slot->default_option());
			}

			// set the value and hide the option if not selectable
			set_default_value(name, defvalue.c_str());
			const device_slot_option *option = slot->option(defvalue.c_str());
			set_flag(name, ~OPTION_FLAG_INTERNAL, (option != nullptr && !option->selectable()) ? OPTION_FLAG_INTERNAL : 0);
		}
	}
	while (add_slot_options(swpart)) { }
	add_device_options();
}
开发者ID:RJRetro,项目名称:mame,代码行数:37,代码来源:emuopts.cpp

示例9: msg

bool JContactResource::event(QEvent *ev)
{
	if (ev->type() == ChatStateEvent::eventType()) {
		ChatStateEvent *chatEvent = static_cast<ChatStateEvent *>(ev);
		Jreen::ChatState::State state = static_cast<Jreen::ChatState::State>(chatEvent->chatState());

		Jreen::Message msg(Jreen::Message::Chat,
						   d_func()->id);
		msg.addExtension(new Jreen::ChatState(state));
		JAccount *account = qobject_cast<JAccount*>(d_func()->contact);
		if (!account)
			account = static_cast<JAccount*>(static_cast<ChatUnit*>(d_func()->contact)->account());
		account->messageSessionManager()->send(msg);
		return true;
	} else if (ev->type() == ToolTipEvent::eventType()) {
		ToolTipEvent *event = static_cast<ToolTipEvent*>(ev);
		event->addField(QT_TRANSLATE_NOOP("ContactResource", "Resource"),
						QString("%1 (%2)").arg(id()).arg(priority()), 75);
		if (!text().isEmpty())
			event->addField(text(), QString());
		event->addHtml("<font size=-1>", 50);
		QString client = property("client").toString();
		if (!client.isEmpty()) {
			event->addField(QT_TRANSLATE_NOOP("ContactResource", "Possible client"),
							client,
							property("clientIcon").toString(),
							ToolTipEvent::IconBeforeDescription,
							25);
			QString os = property("os").toString();
			if (!os.isEmpty())
				event->addField(QT_TRANSLATE_NOOP("ContactResource", "OS"), os, 25);
		}
		event->addHtml("</font>", 10);
		return true;
	}
	return Buddy::event(ev);
}
开发者ID:AlexeyProkhin,项目名称:qutim,代码行数:37,代码来源:jcontactresource.cpp

示例10: facility_name

std::string Syslog_print::build_message_prefix(const std::string& binary_name) {
  /* PRI FAC_NAME PRI_NAME TIMESTAMP APP-NAME IDENT PROCID */

  // First: Priority- and facility-value (PRIVAL)
  std::string message = "<" + std::to_string(calculate_pri()) + "> ";

  // Second : Facility and priority/severity in plain text with colors
  message += pri_colors.at(priority()) + "<" + facility_name() + "." +
    priority_name() + "> " + COLOR_END;

  // Third: Timestamp
  char timebuf[TIMELEN];
  time_t now;
  time(&now);
  strftime(timebuf, TIMELEN, "%FT%T.000Z", localtime(&now));
  message += std::string{timebuf} + " ";

  // Fourth: App-name
  message += std::string(binary_name);

  // Fifth: Add ident if is set (through openlog)
  if (ident_is_set())
    message += " " + std::string{ident()};

  // Sixth: Add PID (PROCID) if LOG_PID is specified (through openlog)
  if (logopt() & LOG_PID)
    message += "[" + std::to_string(getpid()) + "]";

  message += ": ";

  // NEW: Was only in plugin
  // Add ident before message (buf) if is set (through openlog)
  // if (ident_is_set())
  //    message += std::string{ident()} + " ";

  return message;
}
开发者ID:hioa-cs,项目名称:IncludeOS,代码行数:37,代码来源:syslog_facility.cpp

示例11: main

int main()
{
  typedef itk::Image<itk::CovariantVector<float, 3>, 2> ImageType;

  ImageType::Pointer image = ImageType::New();
  Testing::GetBlankImage(image.GetPointer(), 4);

  Mask::Pointer mask = Mask::New();
  Testing::GetFullyValidMask(mask.GetPointer());

  vtkSmartPointer<vtkStructuredGrid> structuredGrid = vtkSmartPointer<vtkStructuredGrid>::New();

  unsigned int patchRadius = 5;
  PriorityCurvature<itk::Index<2> > priority(structuredGrid, patchRadius);

  itk::Index<2> filledPixel = {{0,0}};
  itk::Index<2> sourcePixel = {{0,0}};
  priority.Update(sourcePixel, filledPixel);

  itk::Index<2> queryPixel = {{0,0}};
  priority.ComputePriority(queryPixel);

  return EXIT_SUCCESS;
}
开发者ID:SXYJerry,项目名称:PatchBasedInpainting,代码行数:24,代码来源:TestPriorityCurvature.cpp

示例12: calculation

void calculation (struct stack ** oper, struct stack ** numbers, unsigned int prior) {
	unsigned int ch;
	int first, second;
	int cond = (4 > prior);
	
	while ( (((int)prior <= priority(top(oper))) && (!empty(oper)) && cond) || ( (!empty(oper)) && (!cond) ) ) {
		ch = pop(oper);
		if ( ('(' == ch && !empty(numbers)) && (!cond) ) {
			return;
		}
		if ( empty(numbers) || empty(&((*numbers)->next)) ) {
			printf("syntax error");
			exit(0);
		}
		second = pop(numbers);
		first = pop(numbers);
		if (compute(ch, first, second, numbers)) {
			printf("division by zero\n");
			exit(0);//only student solution
		}
	}

	return;
}
开发者ID:Logan54,项目名称:labs,代码行数:24,代码来源:calculation.c

示例13: infix_to_postfix

  void infix_to_postfix()
  {
     int i,p=0;char next,symbol;
     for(i=0;i<strlen(infix);i++)
     {
	 symbol=infix[i];
	 if(symbol!=' ')
	 {
	    switch(symbol)
	    {
	       case '(':
		 push(symbol);
		 break;
	       case ')':
		  while((next=pop())!='(')
		    postfix[p++]=next
		  break;
	       case '+':
	       case '-':
	       case '*':
	       case '/':
	       case '%':
	       case '^':
		 while(!isEmpty() && priority(stack[top])>=priotity(symbol))
		    postfix[p++]=pop();
		 push(symbol);
		 break;
	       default:
		 postfix[p++];
	    }
	 }
     }
     while(!isEmpty())
       postfix[p++]=pop();
       postfix[p]=NULL;
     }
开发者ID:AbhayGoyal,项目名称:Starters,代码行数:36,代码来源:INFIX2.C

示例14: twoop

/* Two operand functions for infix calc */
void
twoop(int keynum)
{
  if (flagINV) {
    flagINV=0;
    DrawDisplay();
  }

  if (!entered) {		/* something like "5+*" */
    if (!isopempty())
      (void) PopOp();			/* replace the prev op */
    PushOp(keynum);		/* with the new one */
    return;
  }

  if (entered==1)
    parse_double(&dnum);

  clrdisp=CLR=1;
  entered=Dpoint=exponent=0;

  if (!isopempty()) {  /* there was a previous op */
    lastop=PopOp();   /* get it */

    if (lastop==kLPAR) {  /* put it back */
      PushOp(kLPAR);
      PushOp(keynum);
      PushNum(dnum);
      return;
    }

    /* now, if the current op (keynum) is of
       higher priority than the lastop, the current
       op and number are just pushed on top
       Priorities:  (Y^X) > *,/ > +,- > >>,<< > & > ^ > ~ */

    if (priority(keynum) > priority(lastop)) {
      PushNum(dnum);
      PushOp(lastop);
      PushOp(keynum);
    } else {  /* execute lastop on lastnum and dnum, push
	       result and current op on stack */
      acc=PopNum();
      switch (lastop) { /* perform the operation */
      case kADD: acc += dnum;  break;
      case kSUB: acc -= dnum;  break;
      case kMUL: acc *= dnum;  break;
      case kDIV: acc /= dnum;  break;
      case kPOW: acc =  pow(acc,dnum);  break;
      case kMOD: acc = (long)acc %  (long)dnum;  break;
      case kAND: acc = (long)acc &  (long)dnum;  break;
      case kOR:  acc = (long)acc |  (long)dnum;  break;
      case kXOR: acc = (long)acc ^  (long)dnum;  break;
      case kSHL: acc = (long)acc << (long)dnum;  break;
      case kSHR: acc = (long)acc >> (long)dnum;  break;
      }

      PushNum(acc);
      PushOp(keynum);
      format_double(acc);
      DrawDisplay();
      dnum=acc;
    }
  }
开发者ID:thentenaar,项目名称:xcalc,代码行数:65,代码来源:math.c

示例15: priority

LogStream& LogStream::notice(const std::string& message)
{
	_buf.logger().notice(message);
	return priority(Message::PRIO_NOTICE);
}
开发者ID:carvalhomb,项目名称:tsmells,代码行数:5,代码来源:LogStream.cpp


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