• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetRank函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetPreset

u32 CUIMpTradeWnd::GetPresetCost(ETradePreset idx)
{
	const preset_items&		v			=  GetPreset(idx);
	preset_items::const_iterator it		= v.begin();
	preset_items::const_iterator it_e	= v.end();

	u32 result							= 0;
	for(;it!=it_e;++it)
	{
		const _preset_item& _one		= *it;

		u32 _item_cost					= m_item_mngr->GetItemCost(_one.sect_name, GetRank() );

		if(_one.addon_names[0].c_str())
			_item_cost					+= m_item_mngr->GetItemCost(_one.addon_names[0], GetRank() );
		
		if(_one.addon_names[1].c_str())
			_item_cost					+= m_item_mngr->GetItemCost(_one.addon_names[1], GetRank() );

		if(_one.addon_names[2].c_str())
			_item_cost					+= m_item_mngr->GetItemCost(_one.addon_names[2], GetRank() );

		_item_cost						*= _one.count;

		result							+= _item_cost;
	}
	return result;
}
开发者ID:2asoft,项目名称:xray,代码行数:28,代码来源:UIMpTradeWnd_misc.cpp


示例2: assert

// initial condition: out must have all its header fields filled in (gen, num_blocks_gen, block_size)
bool NC::ReEncodeBlock(std::vector<CodedBlockPtr> &buffer, CodedBlock *out) {

	assert( out != NULL);

	int i, j;
	int gen = out->gen;
	int num_blocks_gen = out->num_blocks_gen;
	int block_size = out->block_size;

	/*
	 if( !buffer[gen].size() )
	 return;
	 */

	if (!GetRank(&buffer))
		return false;

	memset(out->coeffs, 0, num_blocks_gen);
	memset(out->sums, 0, (is_sim ? 1 : block_size));

	unsigned char *randCoeffs = new unsigned char[num_blocks_gen];

	// generate randomized coefficients 
	// coefficients are drawn uniform randomly from {1, ..., 2^fsize}

	int field_limit = (int) 1 << (int) field_size;

#ifdef WIN32
	srand((unsigned int)GetTickCount());
#else
	srand(time(NULL));
#endif

	for (i = 0; i < GetRank(&buffer); ++i)
		while (!(randCoeffs[i] = (unsigned char) (rand() % field_limit)))
			;

	// generate a coded piece from a set of coded pieces. { c_0, ... c_{GetRank()-1} }
	// c_i = {COEFFs, SUMs(i.e., coded symbols)} in the buffer (coded piece buffer in NC)
	// re-encoded piece = a_0*c_0 + a_1*c_1 + ... + a_{GetRank()-1}*c_{GetRank()-1}
	// where a_0, a_1, ..., a_{GetRank()} are random coefficients in randCoeffs[i]

	for (i = 0; i < GetRank(&buffer); ++i) {

		for (j = 0; j < num_blocks_gen; ++j) {

			out->coeffs[j] = gf->Add(gf->Mul(buffer[i]->coeffs[j], randCoeffs[i], field_size), out->coeffs[j],
					field_size);
		}
		for (j = 0; j < (is_sim ? 1 : block_size); ++j) {

			out->sums[j] = gf->Add(gf->Mul(buffer[i]->sums[j], randCoeffs[i], field_size), out->sums[j], field_size);
		}
	}

	delete[] randCoeffs;
	return true;
}
开发者ID:uclanrl,项目名称:codetorrent,代码行数:59,代码来源:nc.cpp


示例3: CollectReferences

void
Assignment::Prepare(void)
{
CollectReferences( );      //collect the referenced entities   


vector<Control*>::iterator it=GetSurroundingControls( )->begin();
Condition*   domain=new Condition(new Inequation(true));
while(it != GetSurroundingControls( )->end())
   {
   Control* st;
    
   if((*it)->IsLoop())
      AddCounter( (*it)->GetLoopCounter());

   Condition*   __st_domain=(*it)->GetDomainConstraints(GetRank());

   domain= new Condition(domain,FADA_AND,  __st_domain);
   ++it;
   }

Condition*   __no_not= domain->EliminateNotOperations();
Condition*   __dnform= __no_not->DNForm();
vector<Condition*>* new_domain=new vector<Condition*>();
*new_domain=__dnform->GetTerms();

SetDomain(new_domain);
}
开发者ID:mbelaoucha,项目名称:fadalib,代码行数:28,代码来源:assignment.cpp


示例4: BackSubstitution

bool NC::BackSubstitution(std::vector<CodedBlockPtr> buffer, unsigned char **m_upper, unsigned char **m_data) {

	unsigned char tmp;

	int i, j, k;

	int num_blocks_gen = buffer[0]->num_blocks_gen;
	int block_size = buffer[0]->block_size;

	if (GetRank(&buffer) != num_blocks_gen) //check the GetRank() func parameter
		return false;

	for (i = num_blocks_gen - 1; i >= 0; i--) {

		for (j = 0; j < (is_sim ? 1 : block_size); j++) {

			tmp = (unsigned char) 0x0;

			for (k = i + 1; k < num_blocks_gen; k++) {
				tmp = gf->Add(tmp, gf->Mul(m_upper[i][k], m_data[k][j], field_size), field_size);
			}

			m_data[i][j] = gf->Div(gf->Sub(m_upper[i][num_blocks_gen + j], tmp, field_size), m_upper[i][i], field_size);
		}
	}

	return true;
}
开发者ID:uclanrl,项目名称:codetorrent,代码行数:28,代码来源:nc.cpp


示例5: SetReputation

bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
{
    // used by eluna
    sHookMgr->OnReputationChange(m_player, factionEntry->ID, standing, incremental);

    bool res = false;
    // if spillover definition exists in DB
    if (const RepSpilloverTemplate *repTemplate = sObjectMgr.GetRepSpilloverTemplate(factionEntry->ID))
    {
        for (uint32 i = 0; i < MAX_SPILLOVER_FACTIONS; ++i)
        {
            if (repTemplate->faction[i])
            {
                if (GetRank(repTemplate->faction[i]) <= ReputationRank(repTemplate->faction_rank[i]))
                {
                    // bonuses are already given, so just modify standing by rate
                    int32 spilloverRep = standing * repTemplate->faction_rate[i];
                    SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental);
                }
            }
        }
    }

    // spillover done, update faction itself
    FactionStateList::iterator faction = m_factions.find(factionEntry->reputationListID);
    if (faction != m_factions.end())
    {
        res = SetOneFactionReputation(factionEntry, standing, incremental);
        // only this faction gets reported to client, even if it has no own visible standing
        SendState(&faction->second);
    }

    return res;
}
开发者ID:Blumfield,项目名称:ptc2,代码行数:34,代码来源:ReputationMgr.cpp


示例6: GetRank

short unsigned FiveEval::GetRank(int const card_one, const int card_two,
                                 const int card_three, const int card_four,
                                 const int card_five, const int card_six,
                                 const int card_seven) const {
  int seven_cards[7] = {card_one, card_two, card_three, card_four, card_five,
    card_six, card_seven};
  int temp[5];
  
  short unsigned best_rank_so_far = 0, current_rank = 0;
  int m = 0;
  
  for (int i = 1; i < 7; ++i) {
    for (int j = 0; j < i; ++j) {
      m = 0;
      for (int k = 0; k < 7; ++k) {
        if (k != i && k !=j) {
          temp[m++] = seven_cards[k];
        }
      }
      current_rank = GetRank(temp[0], temp[1], temp[2], temp[3], temp[4]);
      if (best_rank_so_far < current_rank) {
        best_rank_so_far = current_rank;
      }
    }
  }
  return best_rank_so_far;
}
开发者ID:4rapid,项目名称:SpecialKEval,代码行数:27,代码来源:FiveEval.cpp


示例7: DetachAddon

void CUIMpTradeWnd::SellItemAddons(SBuyItemInfo* sell_itm, item_addon_type addon_type)
{
	CInventoryItem* item_	= (CInventoryItem*)sell_itm->m_cell_item->m_pData;
	CWeapon* w				= smart_cast<CWeapon*>(item_);
	if(!w)					return; //ammo,medkit etc.

	if(IsAddonAttached(sell_itm, addon_type))
	{
		SBuyItemInfo* detached_addon	= DetachAddon(sell_itm, addon_type);
		u32 _item_cost					= m_item_mngr->GetItemCost(detached_addon->m_name_sect, GetRank() );
		SetMoneyAmount					(GetMoneyAmount() + _item_cost);
		DestroyItem						(detached_addon);

		if ( addon_type == at_glauncher )
		{
			CWeaponMagazinedWGrenade* wpn2 = smart_cast<CWeaponMagazinedWGrenade*>(item_);
			VERIFY(wpn2);

			for ( u32 ammo_idx							=	0;
					  ammo_idx							<	wpn2->m_ammoTypes2.size();
					++ammo_idx )
			{
				const shared_str&	ammo_name			=	wpn2->m_ammoTypes2[ammo_idx];
				SBuyItemInfo*		ammo				=	NULL;

				while ( (ammo = FindItem(ammo_name, SBuyItemInfo::e_bought)) != NULL )
				{
					SBuyItemInfo*   tempo				=	NULL;
					TryToSellItem(ammo, true, tempo);
				}
			}
		}
	}
}
开发者ID:2asoft,项目名称:xray,代码行数:34,代码来源:UIMpTradeWnd_wpn.cpp


示例8: Initialize

void ReputationMgr::LoadFromDB(PreparedQueryResult result)
{
    // Set initial reputations (so everything is nifty before DB data load)
    Initialize();

    //QueryResult* result = CharacterDatabase.PQuery("SELECT faction, standing, flags FROM character_reputation WHERE guid = '%u'", GetGUIDLow());

    if (result)
    {
        do
        {
            Field* fields = result->Fetch();

            FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16());
            if (factionEntry && (factionEntry->reputationListID >= 0))
            {
                FactionState* faction = &_factions[factionEntry->reputationListID];

                // update standing to current
                faction->Standing = fields[1].GetInt32();

                // update counters
                int32 BaseRep = GetBaseReputation(factionEntry);
                ReputationRank old_rank = ReputationToRank(BaseRep);
                ReputationRank new_rank = ReputationToRank(BaseRep + faction->Standing);
                UpdateRankCounters(old_rank, new_rank);

                uint32 dbFactionFlags = fields[2].GetUInt16();

                if (dbFactionFlags & FACTION_FLAG_VISIBLE)
                    SetVisible(faction);                    // have internal checks for forced invisibility

                if (dbFactionFlags & FACTION_FLAG_INACTIVE)
                    SetInactive(faction, true);              // have internal checks for visibility requirement

                if (dbFactionFlags & FACTION_FLAG_AT_WAR)  // DB at war
                    SetAtWar(faction, true);                 // have internal checks for FACTION_FLAG_PEACE_FORCED
                else                                        // DB not at war
                {
                    // allow remove if visible (and then not FACTION_FLAG_INVISIBLE_FORCED or FACTION_FLAG_HIDDEN)
                    if (faction->Flags & FACTION_FLAG_VISIBLE)
                        SetAtWar(faction, false);            // have internal checks for FACTION_FLAG_PEACE_FORCED
                }

                // set atWar for hostile
                if (GetRank(factionEntry) <= REP_HOSTILE)
                    SetAtWar(faction, true);

                // reset changed flag if values similar to saved in DB
                if (faction->Flags == dbFactionFlags)
                {
                    faction->needSend = false;
                    faction->needSave = false;
                }
            }
        }
        while (result->NextRow());
    }
}
开发者ID:Hlkz2,项目名称:ACoreOld,代码行数:59,代码来源:ReputationMgr.cpp


示例9: GetDescription

string CIncomingClanList :: GetDescription( )
{
	string Description;
	Description += GetName( ) + "\n";
	Description += GetStatus( ) + "\n";
	Description += GetRank( ) + "\n\n";
	return Description;
}
开发者ID:RiseCakoPlusplus,项目名称:brtGHost,代码行数:8,代码来源:bnetprotocol.cpp


示例10: GetInverse

//==========================================================================
// Class:			Matrix
// Function:		GetInverse
//
// Description:		Returns the inverse of this matrix.  If this matrix is badly
//					scaled or is rectangular, the psuedo-inverse is returned.
//
// Input Arguments:
//		None
//
// Output Arguments:
//		inverse	= Matrix&
//
// Return Value:
//		bool, true for success, false otherwise
//
//==========================================================================
bool Matrix::GetInverse(Matrix &inverse) const
{
	if (!IsSquare() || GetRank() != rows)
		return GetPsuedoInverse(inverse);

	// Don't see a point to having two inverse methods -> always use the same method
	return GetPsuedoInverse(inverse);
}
开发者ID:KerryL,项目名称:RPiSousVide,代码行数:25,代码来源:matrix.cpp


示例11: GetRank

// find the indices of the lattice element that contanis (x,y,z) 
int Lattice::GetIndices(float x, float y, float z, int &iidx, int &jidx, int &kidx) {

  int rank = GetRank(x,y,z); 
  if (rank!=-1) {
    GetIndices(rank, iidx, jidx, kidx); 
    return(rank); 
  }
  else return(-1); 

}
开发者ID:recheliu,项目名称:FlowEntropy,代码行数:11,代码来源:Lattice.C


示例12: IncreaseRank

/// increase rank
void nofActiveSoldier::IncreaseRank()
{   
	//max rank reached? -> dont increase!
	if(MAX_MILITARY_RANK - (GetRank() + GAMECLIENT.GetGGS().getSelection(ADDON_MAX_RANK)) < 1)
		return;
	// Einen Rang höher
    job = Job(unsigned(job) + 1);
	// Inventur entsprechend erhöhen und verringern
    gwg->GetPlayer(player)->IncreaseInventoryJob(job, 1);
    gwg->GetPlayer(player)->DecreaseInventoryJob(Job(unsigned(job) - 1), 1);
}
开发者ID:lweberk,项目名称:s25client,代码行数:12,代码来源:nofActiveSoldier.cpp


示例13: a2

void PhraseTableCreator::EncodeTargetPhraseREnc(std::vector<std::string>& s,
    std::vector<std::string>& t,
    std::set<AlignPoint>& a,
    std::ostream& os)
{
  std::stringstream encodedTargetPhrase;

  std::vector<std::vector<size_t> > a2(t.size());
  for(std::set<AlignPoint>::iterator it = a.begin(); it != a.end(); it++)
    a2[it->second].push_back(it->first);

  for(size_t i = 0; i < t.size(); i++) {
    unsigned idxTarget = GetOrAddTargetSymbolId(t[i]);
    unsigned encodedSymbol = -1;

    unsigned bestSrcPos = s.size();
    unsigned bestDiff = s.size();
    unsigned bestRank = m_lexicalTable.size();
    unsigned badRank = m_lexicalTable.size();

    for(std::vector<size_t>::iterator it = a2[i].begin(); it != a2[i].end(); it++) {
      unsigned idxSource = GetSourceSymbolId(s[*it]);
      size_t r = GetRank(idxSource, idxTarget);
      if(r != badRank) {
        if(r < bestRank) {
          bestRank = r;
          bestSrcPos = *it;
          bestDiff = abs(*it-i);
        } else if(r == bestRank && unsigned(abs(*it-i)) < bestDiff) {
          bestSrcPos = *it;
          bestDiff = abs(*it-i);
        }
      }
    }

    if(bestRank != badRank && bestSrcPos < s.size()) {
      if(bestSrcPos == i)
        encodedSymbol = EncodeREncSymbol3(bestRank);
      else
        encodedSymbol = EncodeREncSymbol2(bestSrcPos, bestRank);
      a.erase(AlignPoint(bestSrcPos, i));
    } else {
      encodedSymbol = EncodeREncSymbol1(idxTarget);
    }

    os.write((char*)&encodedSymbol, sizeof(encodedSymbol));
    m_symbolCounter.Increase(encodedSymbol);
  }

  unsigned stopSymbolId = GetTargetSymbolId(m_phraseStopSymbol);
  unsigned encodedSymbol = EncodeREncSymbol1(stopSymbolId);
  os.write((char*)&encodedSymbol, sizeof(encodedSymbol));
  m_symbolCounter.Increase(encodedSymbol);
}
开发者ID:dynotes,项目名称:mosesdecoder,代码行数:54,代码来源:PhraseTableCreator.cpp


示例14: IncreaseRank

/// increase rank
void nofActiveSoldier::IncreaseRank()
{   
	//max rank reached? -> dont increase!
	if(GetRank() >= gwg->GetGGS().GetMaxMilitaryRank())
		return;

    // Einen Rang höher
    // Inventur entsprechend erhöhen und verringern
    gwg->GetPlayer(player).DecreaseInventoryJob(job_, 1);
    job_ = Job(unsigned(job_) + 1);
    gwg->GetPlayer(player).IncreaseInventoryJob(job_, 1);
}
开发者ID:vader1986,项目名称:s25client,代码行数:13,代码来源:nofActiveSoldier.cpp


示例15: g_object_get

	void SourceObject::SetupSource ()
	{
		GstElement *src;
		g_object_get (Dec_, "source", &src, nullptr);

		if (!CurrentSource_.ToUrl ().scheme ().startsWith ("http"))
			return;

		std::shared_ptr<void> soupRankGuard (nullptr,
				[&] (void*) -> void
				{
					if (PrevSoupRank_)
					{
						SetSoupRank (PrevSoupRank_);
						PrevSoupRank_ = 0;
					}
				});

		if (!g_object_class_find_property (G_OBJECT_GET_CLASS (src), "user-agent"))
		{
			qDebug () << Q_FUNC_INFO
					<< "user-agent property not found for"
					<< CurrentSource_.ToUrl ()
					<< (QString ("|") + G_OBJECT_TYPE_NAME (src) + "|")
					<< "soup rank:"
					<< GetRank ("souphttpsrc")
					<< "webkit rank:"
					<< GetRank ("webkitwebsrc");
			return;
		}

		const auto& str = QString ("LeechCraft LMP/%1 (%2)")
				.arg (Core::Instance ().GetProxy ()->GetVersion ())
				.arg (gst_version_string ());
		qDebug () << Q_FUNC_INFO
				<< "setting user-agent to"
				<< str;
		g_object_set (src, "user-agent", str.toUtf8 ().constData (), nullptr);
	}
开发者ID:DJm00n,项目名称:leechcraft,代码行数:39,代码来源:sourceobject.cpp


示例16: reader

// Reads the input and builds ordered FPTrees
const bool Tree::_build() {

	_support *= _global_frequency;
	std::vector<unsigned int> data;

	Reader<DELIM> reader(_inpath, _support, _table);
	while (reader.read(data)) _fptree.insert(data);

	std::cout << ">>> " << GetModuleName() << '[' << GetRank()
		<< "] - # nodes: " << _fptree.nodecount() << std::endl;
	// MemInfo();
	return true;

}
开发者ID:rubenseam,项目名称:dfptree,代码行数:15,代码来源:tree.cpp


示例17: dimsToDrop

    /*static*/ std::shared_ptr<Matrix<ElementType>> NDArrayView::GetMatrixImpl(const TensorView<ElementType>* tensorView, size_t rowColSplitPoint)
    {
        auto tensorShape = tensorView->GetShape();
        if (tensorShape.GetRank() <= 2)
            return tensorView->AsMatrix();

        size_t splitPoint = rowColSplitPoint;
        if (splitPoint == NDArrayView::AutoSelectRowColSplitPoint)
        {
            // Determine the split point
            std::vector<bool> dimsToDrop(tensorShape.GetRank(), false);
            for (size_t k = 1; k < tensorShape.GetRank(); ++k)
                if (tensorShape.CanFlatten(k))
                    dimsToDrop[k - 1] = true;

            // There should be at most 2 dims we cannot drop
            auto numDimsThatCannotBeDropped = std::count_if(dimsToDrop.begin(), dimsToDrop.end(), [](const bool& val) {
                return !val;
            });

            if (numDimsThatCannotBeDropped > 2)
                LogicError("The TensorView underlying this NDArrayView cannot be flattened to a Matrix");

            // If we can fold the entire tensor down to a vector so any of the axes can be a valid split point,
            // let's pick the split point to be 1
            splitPoint = 1;
            if (numDimsThatCannotBeDropped > 1)
            {
                while (dimsToDrop[splitPoint - 1])
                    splitPoint++;
            }
        }

        tensorShape.FlattenTo2DInPlace(splitPoint, "NDArrayView::GetMatrix");

        return tensorView->Reshaped(tensorShape).AsMatrix();
    }
开发者ID:ChiPowers,项目名称:CNTK,代码行数:37,代码来源:NDArrayView.cpp


示例18: ConvertGroup

    std::string NumericRussian::Convert(const unsigned num, const bool skipZero, const Gender gender) const
    {
      unsigned groupBase = Limits.BaseThousand();

      if (num < groupBase)
      {
        return ConvertGroup(num, skipZero, gender);
      }

      unsigned groupNo = GetRank(num, groupBase);

      const unsigned group = num / groupBase;
      const unsigned remain = num % groupBase;
      return ComposeHighestGroupAndRemain(group, Groups[groupNo].Gender, Groups[groupNo].Forms, remain);
    }
开发者ID:rushad,项目名称:numconv,代码行数:15,代码来源:numeric_russian_internal.cpp


示例19: GetRank

bool Guild::CheckGuildStructure()
{
    // Repair the structure of guild
    // If the guildmaster doesn't exist or isn't the member of guild
    // attempt to promote another member
    int32 GM_rights = GetRank(m_LeaderGuid);
    if (GM_rights == -1)
    {
        if (DelMember(m_LeaderGuid))
            return false;                                   // guild will disbanded and deleted in caller
    }
    else if (GM_rights != GR_GUILDMASTER)
        SetLeader(m_LeaderGuid);

    // Allow only 1 guildmaster, set other to officer
    for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
        if (itr->second.RankId == GR_GUILDMASTER && m_LeaderGuid != itr->second.guid)
            itr->second.ChangeRank(GR_OFFICER);

    return true;
}
开发者ID:zeroR2,项目名称:mangos,代码行数:21,代码来源:Guild.cpp


示例20: printf

void TCard::Dump()
{
    // diamond, club, heart, spade
    const char* suitToDisplay[4] = { "\u2666", "\u2663", "\u2665", "\u2660", };
    const char* rankToDisplay[13] =
    {
        "A",
        "2",
        "3",
        "4",
        "5",
        "6",
        "7",
        "8",
        "9",
        "10",
        "J",
        "Q",
        "K",
    };
    printf("[%s%s]", suitToDisplay[GetSuit()], rankToDisplay[GetRank()]);
}
开发者ID:DennisPP,项目名称:GremlinsEngine,代码行数:22,代码来源:Card.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetRating函数代码示例发布时间:2022-05-30
下一篇:
C++ GetRandom函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap