本文整理汇总了C++中servicegroup::Ptr::GetMembers方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::GetMembers方法的具体用法?C++ Ptr::GetMembers怎么用?C++ Ptr::GetMembers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类servicegroup::Ptr
的用法示例。
在下文中一共展示了Ptr::GetMembers方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NumServicesAccessor
Value ServiceGroupsTable::NumServicesAccessor(const Value& row)
{
ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
if (!sg)
return Empty;
return sg->GetMembers().size();
}
示例2: NumServicesHardUnknownAccessor
Value ServiceGroupsTable::NumServicesHardUnknownAccessor(const Value& row)
{
ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
if (!sg)
return Empty;
int num_services = 0;
for (const Service::Ptr& service : sg->GetMembers()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceUnknown)
num_services++;
}
return num_services;
}
示例3: NumServicesPendingAccessor
Value ServiceGroupsTable::NumServicesPendingAccessor(const Value& row)
{
ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
if (!sg)
return Empty;
int num_services = 0;
for (const Service::Ptr& service : sg->GetMembers()) {
if (!service->GetLastCheckResult())
num_services++;
}
return num_services;
}
示例4: NumServicesCritAccessor
Value ServiceGroupsTable::NumServicesCritAccessor(const Value& row)
{
ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
if (!sg)
return Empty;
int num_services = 0;
for (const Service::Ptr& service : sg->GetMembers()) {
if (service->GetState() == ServiceCritical)
num_services++;
}
return num_services;
}
示例5: WorstServiceStateAccessor
Value ServiceGroupsTable::WorstServiceStateAccessor(const Value& row)
{
ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
if (!sg)
return Empty;
Value worst_service = ServiceOK;
for (const Service::Ptr& service : sg->GetMembers()) {
if (service->GetState() > worst_service)
worst_service = service->GetState();
}
return worst_service;
}
示例6: OnConfigUpdate
void ServiceGroupDbObject::OnConfigUpdate(void)
{
ServiceGroup::Ptr group = static_pointer_cast<ServiceGroup>(GetObject());
BOOST_FOREACH(const Service::Ptr& service, group->GetMembers()) {
DbQuery query1;
query1.Table = DbType::GetByName("ServiceGroup")->GetTable() + "_members";
query1.Type = DbQueryInsert;
query1.Category = DbCatConfig;
query1.Fields = make_shared<Dictionary>();
query1.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
query1.Fields->Set("servicegroup_id", DbValue::FromObjectInsertID(group));
query1.Fields->Set("service_object_id", service);
OnQuery(query1);
}
}
示例7: MembersAccessor
Value ServiceGroupsTable::MembersAccessor(const Value& row)
{
ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
if (!sg)
return Empty;
ArrayData result;
for (const Service::Ptr& service : sg->GetMembers()) {
result.push_back(new Array({
service->GetHost()->GetName(),
service->GetShortName()
}));
}
return new Array(std::move(result));
}