本文整理汇总了C++中CGroup类的典型用法代码示例。如果您正苦于以下问题:C++ CGroup类的具体用法?C++ CGroup怎么用?C++ CGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_maximal_group
bool CRusFormatCaller::format_for_modif_adj_groups (CGroup& G)
{
if (get_maximal_group_no(G.m_iFirstWord) != -1) return false;
int j = G.m_iFirstWord;
if( FindInList((const char*)g_strAdjModif, g_AdjModifCount, Wj.get_lemma()) == -1)
return false;
if( j+1 >= sent.size() )
return false;
const CGroup& H = get_maximal_group(j+1);
if( !is_morph_adj(sent[H.m_MainWordNo]) )
return false;
if( !GetGramTab()->GleicheGenderNumberCase(sent[H.m_MainWordNo].m_type_gram_code, sent[H.m_MainWordNo].m_gramcodes, Wj.m_gramcodes ) )
return false;
G.m_iLastWord = H.m_iLastWord;
G.m_GroupType = MODIF_ADJ;
G.SetGrammems (H.GetGrammems() & sent[j].GetGrammems());
G.m_MainGroup = H;
change_words_in_group_grammems(G, G.GetGrammems(), (rAllNumbers | rAllCases));
create_syn_rel(G, H.m_MainWordNo, j , MODIF_ADJ);
return true;
}
示例2: GetFocusedWidget
bool CWindowManager::CoreHandleKey(chtype key)
{
if (CGroup::CoreHandleKey(key))
return true;
CWidget *focwidget = GetFocusedWidget();
if (focwidget)
{
CGroup *focgroup = GetGroupWidget(focwidget);
if (focgroup)
{
if (IsTAB(key))
{
if (!focgroup->SetNextFocWidget(true))
focgroup->SetNextFocWidget(false);
TUI.UpdateButtonBar();
return true;
}
else if (key == CTRL('p'))
{
if (!focgroup->SetPrevFocWidget(true))
focgroup->SetPrevFocWidget(false);
TUI.UpdateButtonBar();
return true;
}
}
}
return false;
}
示例3: GPOS_ASSERT
//---------------------------------------------------------------------------
// @function:
// CExpressionHandle::CopyCostCtxtProps
//
// @doc:
// Cache plan properties of cost context and its children on the handle
//
//---------------------------------------------------------------------------
void
CExpressionHandle::CopyCostCtxtProps()
{
GPOS_ASSERT(NULL != m_pcc);
GPOS_ASSERT(NULL == m_pdrgpdp);
GPOS_ASSERT(NULL == m_pdp);
// add-ref context properties
CDrvdProp *pdp = m_pcc->Pdpplan();
pdp->AddRef();
m_pdp = pdp;
// add-ref child group expressions' properties
const ULONG ulArity = UlArity();
m_pdrgpdp = GPOS_NEW(m_pmp) DrgPdp(m_pmp, ulArity);
for (ULONG ul = 0; ul < ulArity; ul++)
{
CGroup *pgroupChild = (*m_pgexpr)[ul];
if (!pgroupChild->FScalar())
{
COptimizationContext *pocChild = (*m_pcc->Pdrgpoc())[ul];
GPOS_ASSERT(NULL != pocChild);
CCostContext *pccChild = pocChild->PccBest();
GPOS_ASSERT(NULL != pccChild);
pdp = pccChild->Pdpplan();
pdp->AddRef();
m_pdrgpdp->Append(pdp);
}
}
}
示例4: requestGroup
CGroup* CMilitary::requestGroup(MilitaryGroupBehaviour type) {
CGroup *group = ReusableObjectFactory<CGroup>::Instance();
group->ai = ai;
group->reset();
group->reg(*this);
LOG_II("CMilitary::requestGroup " << (*group))
switch(type) {
case SCOUT:
activeScoutGroups[group->key] = group;
break;
case BOMBER:
activeBomberGroups[group->key] = group;
break;
case ENGAGE:
activeAttackGroups[group->key] = group;
break;
case AIRFIGHTER:
activeAirFighterGroups[group->key] = group;
break;
default:
LOG_EE("CMilitary::requestGroup invalid group behaviour: " << type)
}
return group;
}
示例5: FindGroup
CGroup* CGroup::FindGroup(const std::string& szName
, const int& depth) const
{
//TODO once we get a depth first traversal func we should use that here
int size = this->m_vChildren.size();
for (int i = 0; i < size; ++i)
{
if (this->m_vChildren[i]->GetName() == szName && this->m_vChildren[i]->IsGroup())
{
return dynamic_cast<CGroup*>(this->m_vChildren[i]);
}
}
//If we get here then search our children's children for the object
for (int i = 0; i < size; ++i)
{
if (this->m_vChildren[i]->IsGroup())
{
CGroup* pGroup = static_cast<CGroup*>(this->m_vChildren[i]);
CGroup* ret = pGroup->FindGroup(szName);
if (ret)
return ret;
}
}
return null;
}
示例6: GetRestrictedPhysicalMemoryLimit
size_t GetRestrictedPhysicalMemoryLimit()
{
CGroup cgroup;
size_t physical_memory_limit;
if (!cgroup.GetPhysicalMemoryLimit(&physical_memory_limit))
physical_memory_limit = SIZE_T_MAX;
struct rlimit curr_rlimit;
size_t rlimit_soft_limit = RLIM_INFINITY;
if (getrlimit(RLIMIT_AS, &curr_rlimit) == 0)
{
rlimit_soft_limit = curr_rlimit.rlim_cur;
}
physical_memory_limit = (physical_memory_limit < rlimit_soft_limit) ?
physical_memory_limit : rlimit_soft_limit;
// Ensure that limit is not greater than real memory size
long pages = sysconf(_SC_PHYS_PAGES);
if (pages != -1)
{
long pageSize = sysconf(_SC_PAGE_SIZE);
if (pageSize != -1)
{
physical_memory_limit = (physical_memory_limit < (size_t)pages * pageSize)?
physical_memory_limit : (size_t)pages * pageSize;
}
}
return physical_memory_limit;
}
示例7: getName_c_s
void getName_c_s(CStateInstance* entity, CScriptStack& stack)
{
IScriptContext* ctx = (IScriptContext*)stack.top();
CGroup* group = dynamic_cast<CGroup*>(ctx);
if (group)
stack.top() = group->getName();
else
stack.top() = string();
}
示例8: GetCpuLimit
bool GetCpuLimit(uint32_t* val)
{
CGroup cgroup;
if (val == nullptr)
return false;
return cgroup.GetCpuLimit(val);
}
示例9: LOG_II
void CEconomy::addUnitOnFinished(CUnit &unit) {
LOG_II("CEconomy::addUnitOnFinished " << unit)
unitCategory c = unit.type->cats;
if ((c&BUILDER).any() || ((c&ASSISTER).any() && (c&MOBILE).any())) {
CGroup *group = requestGroup();
group->addUnit(unit);
}
}
示例10: requestGroup
CGroup* CEconomy::requestGroup() {
CGroup *group = ReusableObjectFactory<CGroup>::Instance();
group->ai = ai;
group->reset();
group->reg(*this);
activeGroups[group->key] = group;
return group;
}
示例11: PAL_GetCpuLimit
BOOL
PALAPI
PAL_GetCpuLimit(UINT* val)
{
CGroup cgroup;
if (val == nullptr)
return FALSE;
return cgroup.GetCpuLimit(val);
}
示例12: GML_RECMUTEX_LOCK
void CGroupHandler::GroupCommand(int num, const std::string& cmd)
{
GML_RECMUTEX_LOCK(grpsel); // GroupCommand
CGroup* group = groups[num];
if ((cmd == "set") || (cmd == "add")) {
if (cmd == "set") {
group->ClearUnits();
}
const CUnitSet& selUnits = selectedUnits.selectedUnits;
CUnitSet::const_iterator ui;
for(ui = selUnits.begin(); ui != selUnits.end(); ++ui) {
(*ui)->SetGroup(group);
}
}
else if (cmd == "selectadd") {
// do not select the group, just add its members to the current selection
CUnitSet::const_iterator ui;
for (ui = group->units.begin(); ui != group->units.end(); ++ui) {
selectedUnits.AddUnit(*ui);
}
return;
}
else if (cmd == "selectclear") {
// do not select the group, just remove its members from the current selection
CUnitSet::const_iterator ui;
for (ui = group->units.begin(); ui != group->units.end(); ++ui) {
selectedUnits.RemoveUnit(*ui);
}
return;
}
else if (cmd == "selecttoggle") {
// do not select the group, just toggle its members with the current selection
const CUnitSet& selUnits = selectedUnits.selectedUnits;
CUnitSet::const_iterator ui;
for (ui = group->units.begin(); ui != group->units.end(); ++ui) {
if (selUnits.find(*ui) == selUnits.end()) {
selectedUnits.AddUnit(*ui);
} else {
selectedUnits.RemoveUnit(*ui);
}
}
return;
}
if ((selectedUnits.selectedGroup == num) && !group->units.empty()) {
const float3 groupCenter = group->CalculateCenter();
camHandler->GetCurrentController().SetPos(groupCenter);
}
selectedUnits.SelectGroup(num);
}
示例13: firstGroup
void AttackTask::onUpdate() {
CGroup *group = firstGroup();
if (group->isMicroing() && group->isIdle()) {
targetAlt = -1; // for sure
group->micro(false);
}
if (isMoving) {
/* Keep tracking the target */
pos = ai->cbc->GetUnitPos(target);
float3 gpos = group->pos();
float dist = gpos.distance2D(pos);
float range = group->getRange();
/* See if we can attack our target already */
if (dist <= range) {
bool canAttack = true;
/*
// for ground units prevent shooting across hill...
if ((group->cats&AIR).none()) {
// FIXME: improve
dist = ai->pathfinder->getPathLength(*group, pos);
canAttack = (dist <= range * 1.1f);
}
*/
if (canAttack) {
if ((group->cats&BUILDER).any())
group->reclaim(target);
else
group->attack(target);
isMoving = false;
ai->pathfinder->remove(*group);
group->micro(true);
}
}
}
/* See if we can attack a target we found on our path */
if (!(group->isMicroing() || urgent())) {
if ((group->cats&BUILDER).any())
resourceScan(); // builders should not be too aggressive
else
enemyScan(targetAlt);
}
}
示例14: format_for_geo_names
bool CGerFormatCaller :: format_for_geo_names (CGroup& G)
{
size_t j = get_main_word(G.m_iFirstWord);
if (!CanBeCityType(Wj))
return false;
size_t i = j;
if( ++i >= sent.size() )
return false;
int main_word = get_main_word(i);
if (main_word == -1) return false;
if ( !sent[main_word].HasFlag(fl_morph_predicted)
&& !sent[main_word].has_grammem(gStd)
)
return false;
G.m_iLastWord = get_maximal_group(i).m_iLastWord;
G.m_GroupType = gGEOGR;
G.SetGrammems( get_maximal_group(j).GetGrammems() );
G.m_MainGroup = get_maximal_group(j);
create_syn_rel(G, j, main_word, gGEOGR);
return true;
};
示例15: format_for_rank_fam
// Kanzler Gerhard Schröder
// Bundeskanzler Alexey Sokirko
// A-Techniker Gerhard Schroder
bool CGerFormatCaller :: format_for_rank_fam (CGroup& G)
{
int i = get_main_word(G.m_iFirstWord);
if (!Wi.m_lemma) return false;
if ( !Wi.HasFlag(fl_ranknoun) ) return false;
size_t j = 0;
const CGroup& main_gr = get_maximal_group(G.m_iFirstWord);
j = main_gr.m_iLastWord+1;
if ( j == sent.size() ) return false;
const CGroup& next_gr = get_maximal_group(j);
if ( next_gr.m_GroupType!= gFAMILIE_GROUP
&& next_gr.m_GroupType!= gSPNAME
&& next_gr.m_GroupType!= gPNAME
) return false;
G.m_iLastWord = next_gr.m_iLastWord;
G.SetGrammems( Wi.GetGrammems() );
G.m_MainGroup = main_gr;
G.m_GroupType = gBERUF_NP;
create_syn_rel(G,i,j,gBERUF_NP);
return true;
};