本文整理汇总了C++中notification::Ptr::GetCheckable方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::GetCheckable方法的具体用法?C++ Ptr::GetCheckable怎么用?C++ Ptr::GetCheckable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类notification::Ptr
的用法示例。
在下文中一共展示了Ptr::GetCheckable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ScriptFunc
void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification, const User::Ptr& user, const CheckResult::Ptr& cr, int itype,
const String& author, const String& comment)
{
NotificationCommand::Ptr commandObj = notification->GetCommand();
NotificationType type = static_cast<NotificationType>(itype);
Checkable::Ptr checkable = notification->GetCheckable();
Dictionary::Ptr notificationExtra = make_shared<Dictionary>();
notificationExtra->Set("type", Notification::NotificationTypeToString(type));
notificationExtra->Set("author", author);
notificationExtra->Set("comment", comment);
Host::Ptr host;
Service::Ptr service;
tie(host, service) = GetHostService(checkable);
MacroProcessor::ResolverList resolvers;
resolvers.push_back(std::make_pair("user", user));
resolvers.push_back(std::make_pair("notification", notificationExtra));
resolvers.push_back(std::make_pair("notification", notification));
if (service)
resolvers.push_back(std::make_pair("service", service));
resolvers.push_back(std::make_pair("host", host));
resolvers.push_back(std::make_pair("command", commandObj));
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
PluginUtility::ExecuteCommand(commandObj, checkable, cr, resolvers, boost::bind(&PluginNotificationTask::ProcessFinishedHandler, checkable, _1, _2));
}
示例2: ScriptFunc
void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification,
const User::Ptr& user, const CheckResult::Ptr& cr, int itype,
const String& author, const String& comment, const Dictionary::Ptr& resolvedMacros,
bool useResolvedMacros)
{
REQUIRE_NOT_NULL(notification);
REQUIRE_NOT_NULL(user);
NotificationCommand::Ptr commandObj = notification->GetCommand();
auto type = static_cast<NotificationType>(itype);
Checkable::Ptr checkable = notification->GetCheckable();
Dictionary::Ptr notificationExtra = new Dictionary({
{ "type", Notification::NotificationTypeToString(type) },
{ "author", author },
{ "comment", comment }
});
Host::Ptr host;
Service::Ptr service;
tie(host, service) = GetHostService(checkable);
MacroProcessor::ResolverList resolvers;
resolvers.emplace_back("user", user);
resolvers.emplace_back("notification", notificationExtra);
resolvers.emplace_back("notification", notification);
if (service)
resolvers.emplace_back("service", service);
resolvers.emplace_back("host", host);
resolvers.emplace_back("command", commandObj);
resolvers.emplace_back("icinga", IcingaApplication::GetInstance());
int timeout = commandObj->GetTimeout();
PluginUtility::ExecuteCommand(commandObj, checkable, cr, resolvers,
resolvedMacros, useResolvedMacros, timeout,
std::bind(&PluginNotificationTask::ProcessFinishedHandler, checkable, _1, _2));
}