本文整理汇总了C++中array::Ptr::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::Clear方法的具体用法?C++ Ptr::Clear怎么用?C++ Ptr::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类array::Ptr
的用法示例。
在下文中一共展示了Ptr::Clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ArrayClear
static void ArrayClear(void)
{
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
self->Clear();
}
示例2: BeginExecuteNotification
//.........这里部分代码省略.........
fstate = ServiceStateToFilter(service->GetState());
stateStr = NotificationServiceStateToString(service->GetState());
} else {
fstate = HostStateToFilter(host->GetState());
stateStr = NotificationHostStateToString(host->GetState());
}
Log(LogDebug, "Notification")
<< "State '" << stateStr << "', StateFilter: " << NotificationFilterToString(GetStateFilter(), GetStateFilterMap())
<< " (FState=" << fstate << ", StateFilter=" << GetStateFilter() << ")";
if (!(fstate & GetStateFilter())) {
Log(LogNotice, "Notification")
<< "Not sending " << (reminder ? "reminder " : " ") << "notifications for notification object '" << GetName() << "': state '" << stateStr
<< "' does not match state filter: " << NotificationFilterToString(GetStateFilter(), GetStateFilterMap()) << ".";
return;
}
}
} else {
Log(LogNotice, "Notification")
<< "Not checking " << (reminder ? "reminder " : " ") << "notification filters for notification object '" << GetName() << "': Notification was forced.";
}
{
ObjectLock olock(this);
UpdateNotificationNumber();
double now = Utility::GetTime();
SetLastNotification(now);
if (type == NotificationProblem && GetInterval() <= 0)
SetNoMoreNotifications(true);
else
SetNoMoreNotifications(false);
if (type == NotificationProblem && GetInterval() > 0)
SetNextNotification(now + GetInterval());
if (type == NotificationProblem)
SetLastProblemNotification(now);
}
std::set<User::Ptr> allUsers;
std::set<User::Ptr> users = GetUsers();
std::copy(users.begin(), users.end(), std::inserter(allUsers, allUsers.begin()));
for (const UserGroup::Ptr& ug : GetUserGroups()) {
std::set<User::Ptr> members = ug->GetMembers();
std::copy(members.begin(), members.end(), std::inserter(allUsers, allUsers.begin()));
}
std::set<User::Ptr> allNotifiedUsers;
Array::Ptr notifiedProblemUsers = GetNotifiedProblemUsers();
for (const User::Ptr& user : allUsers) {
String userName = user->GetName();
if (!user->GetEnableNotifications()) {
Log(LogNotice, "Notification")
<< "Disabled notifications for user '" << userName << "'. Not sending notification.";
continue;
}
if (!CheckNotificationUserFilters(type, user, force, reminder)) {
Log(LogNotice, "Notification")
<< "Notification filters for user '" << userName << "' not matched. Not sending notification.";
continue;
}
/* on recovery, check if user was notified before */
if (type == NotificationRecovery) {
if (!notifiedProblemUsers->Contains(userName)) {
Log(LogNotice, "Notification")
<< "We did not notify user '" << userName << "' for a problem before. Not sending recovery notification.";
continue;
}
}
Log(LogInformation, "Notification")
<< "Sending " << (reminder ? "reminder " : "") << "'" << NotificationTypeToStringInternal(type) << "' notification '"
<< GetName() << " for user '" << userName << "'";
Utility::QueueAsyncCallback(boost::bind(&Notification::ExecuteNotificationHelper, this, type, user, cr, force, author, text));
/* collect all notified users */
allNotifiedUsers.insert(user);
/* store all notified users for later recovery checks */
if (type == NotificationProblem && !notifiedProblemUsers->Contains(userName))
notifiedProblemUsers->Add(userName);
}
/* if this was a recovery notification, reset all notified users */
if (type == NotificationRecovery)
notifiedProblemUsers->Clear();
/* used in db_ido for notification history */
Service::OnNotificationSentToAllUsers(this, checkable, allNotifiedUsers, type, cr, author, text, MessageOrigin::Ptr());
}