本文整理汇总了C++中configitem::Ptr::GetFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::GetFilter方法的具体用法?C++ Ptr::GetFilter怎么用?C++ Ptr::GetFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configitem::Ptr
的用法示例。
在下文中一共展示了Ptr::GetFilter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EvaluateObjectRule
bool ServiceGroup::EvaluateObjectRule(const Service::Ptr& service, const ConfigItem::Ptr& group)
{
String group_name = group->GetName();
CONTEXT("Evaluating rule for group '" + group_name + "'");
Host::Ptr host = service->GetHost();
ScriptFrame frame;
if (group->GetScope())
group->GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);
frame.Locals->Set("service", service);
if (!group->GetFilter()->Evaluate(frame).GetValue().ToBool())
return false;
Log(LogDebug, "ServiceGroup")
<< "Assigning membership for group '" << group_name << "' to service '" << service->GetName() << "'";
Array::Ptr groups = service->GetGroups();
groups->Add(group_name);
return true;
}
示例2: EvaluateObjectRule
bool UserGroup::EvaluateObjectRule(const User::Ptr& user, const ConfigItem::Ptr& group)
{
String group_name = group->GetName();
CONTEXT("Evaluating rule for group '" + group_name + "'");
ScriptFrame frame;
if (group->GetScope())
group->GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("user", user);
if (!group->GetFilter()->Evaluate(frame).GetValue().ToBool())
return false;
Log(LogDebug, "UserGroup")
<< "Assigning membership for group '" << group_name << "' to user '" << user->GetName() << "'";
Array::Ptr groups = user->GetGroups();
groups->Add(group_name);
return true;
}
示例3: EvaluateObjectRule
bool HostGroup::EvaluateObjectRule(const Host::Ptr& host, const ConfigItem::Ptr& group)
{
String groupName = group->GetName();
CONTEXT("Evaluating rule for group '" + groupName + "'");
ScriptFrame frame(true);
if (group->GetScope())
group->GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);
if (!group->GetFilter()->Evaluate(frame).GetValue().ToBool())
return false;
Log(LogDebug, "HostGroup")
<< "Assigning membership for group '" << groupName << "' to host '" << host->GetName() << "'";
Array::Ptr groups = host->GetGroups();
if (groups && !groups->Contains(groupName))
groups->Add(groupName);
return true;
}