本文整理汇总了C++中ApplyRule::GetIgnoreOnError方法的典型用法代码示例。如果您正苦于以下问题:C++ ApplyRule::GetIgnoreOnError方法的具体用法?C++ ApplyRule::GetIgnoreOnError怎么用?C++ ApplyRule::GetIgnoreOnError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApplyRule
的用法示例。
在下文中一共展示了ApplyRule::GetIgnoreOnError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EvaluateApplyRuleInstance
bool Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& name, ScriptFrame& frame, const ApplyRule& rule)
{
if (!rule.EvaluateFilter(frame))
return false;
DebugInfo di = rule.GetDebugInfo();
Log(LogDebug, "Service")
<< "Applying service '" << name << "' to host '" << host->GetName() << "' for rule " << di;
ConfigItemBuilder::Ptr builder = new ConfigItemBuilder(di);
builder->SetType("Service");
builder->SetName(name);
builder->SetScope(frame.Locals->ShallowClone());
builder->SetIgnoreOnError(rule.GetIgnoreOnError());
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "name"), OpSetLiteral, MakeLiteral(name), di));
String zone = host->GetZoneName();
if (!zone.IsEmpty())
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "zone"), OpSetLiteral, MakeLiteral(zone), di));
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "package"), OpSetLiteral, MakeLiteral(rule.GetPackage()), di));
builder->AddExpression(new OwnedExpression(rule.GetExpression()));
ConfigItem::Ptr serviceItem = builder->Compile();
serviceItem->Register();
return true;
}
示例2: EvaluateApplyRuleInstance
bool Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule)
{
if (!rule.EvaluateFilter(frame))
return false;
DebugInfo di = rule.GetDebugInfo();
#ifdef _DEBUG
Log(LogDebug, "Dependency")
<< "Applying dependency '" << name << "' to object '" << checkable->GetName() << "' for rule " << di;
#endif /* _DEBUG */
ConfigItemBuilder builder{di};
builder.SetType(Dependency::TypeInstance);
builder.SetName(name);
builder.SetScope(frame.Locals->ShallowClone());
builder.SetIgnoreOnError(rule.GetIgnoreOnError());
Host::Ptr host;
Service::Ptr service;
tie(host, service) = GetHostService(checkable);
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "parent_host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "child_host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
if (service)
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "child_service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
String zone = checkable->GetZoneName();
if (!zone.IsEmpty())
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "zone"), OpSetLiteral, MakeLiteral(zone), di));
builder.AddExpression(new SetExpression(MakeIndexer(ScopeThis, "package"), OpSetLiteral, MakeLiteral(rule.GetPackage()), di));
builder.AddExpression(new ImportDefaultTemplatesExpression());
builder.AddExpression(new OwnedExpression(rule.GetExpression()));
ConfigItem::Ptr dependencyItem = builder.Compile();
dependencyItem->Register();
return true;
}
示例3: EvaluateApplyRuleInstance
bool Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule)
{
if (!rule.EvaluateFilter(frame))
return false;
DebugInfo di = rule.GetDebugInfo();
Log(LogDebug, "Notification")
<< "Applying notification '" << name << "' to object '" << checkable->GetName() << "' for rule " << di;
ConfigItemBuilder::Ptr builder = new ConfigItemBuilder(di);
builder->SetType("Notification");
builder->SetName(name);
builder->SetScope(frame.Locals->ShallowClone());
builder->SetIgnoreOnError(rule.GetIgnoreOnError());
Host::Ptr host;
Service::Ptr service;
tie(host, service) = GetHostService(checkable);
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "host_name"), OpSetLiteral, MakeLiteral(host->GetName()), di));
if (service)
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
String zone = checkable->GetZoneName();
if (!zone.IsEmpty())
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "zone"), OpSetLiteral, MakeLiteral(zone), di));
builder->AddExpression(new SetExpression(MakeIndexer(ScopeThis, "package"), OpSetLiteral, MakeLiteral(rule.GetPackage()), di));
builder->AddExpression(new OwnedExpression(rule.GetExpression()));
ConfigItem::Ptr notificationItem = builder->Compile();
notificationItem->Register();
return true;
}