Value HostGroupsTable::NameAccessor(const Value& row)
{
- return static_cast<HostGroup::Ptr>(row)->GetName();
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
+ return hg->GetName();
}
Value HostGroupsTable::AliasAccessor(const Value& row)
{
- return static_cast<HostGroup::Ptr>(row)->GetDisplayName();
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
+ return hg->GetDisplayName();
}
Value HostGroupsTable::NotesAccessor(const Value& row)
{
- return static_cast<HostGroup::Ptr>(row)->GetNotes();
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
+ return hg->GetNotes();
}
Value HostGroupsTable::NotesUrlAccessor(const Value& row)
{
- return static_cast<HostGroup::Ptr>(row)->GetNotesUrl();
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
+ return hg->GetNotesUrl();
}
Value HostGroupsTable::ActionUrlAccessor(const Value& row)
{
- return static_cast<HostGroup::Ptr>(row)->GetActionUrl();
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
+ return hg->GetActionUrl();
}
Value HostGroupsTable::MembersAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
Array::Ptr members = new Array();
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
members->Add(host->GetName());
}
Value HostGroupsTable::MembersWithStateAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
Array::Ptr members = new Array();
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
Array::Ptr member_state = new Array();
member_state->Add(host->GetName());
member_state->Add(host->GetState());
Value HostGroupsTable::WorstHostStateAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int worst_host = HostUp;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
if (host->GetState() > worst_host)
worst_host = host->GetState();
}
Value HostGroupsTable::NumHostsAccessor(const Value& row)
{
- return static_cast<long>(static_cast<HostGroup::Ptr>(row)->GetMembers().size());
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
+ return hg->GetMembers().size();
}
Value HostGroupsTable::NumHostsPendingAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int num_hosts = 0;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
/* no checkresult */
if (!host->GetLastCheckResult())
num_hosts++;
Value HostGroupsTable::NumHostsUpAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int num_hosts = 0;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
if (host->GetState() == HostUp)
num_hosts++;
}
Value HostGroupsTable::NumHostsDownAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int num_hosts = 0;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
if (host->GetState() == HostDown)
num_hosts++;
}
Value HostGroupsTable::NumHostsUnreachAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int num_hosts = 0;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
if (!host->IsReachable())
num_hosts++;
}
Value HostGroupsTable::NumServicesAccessor(const Value& row)
{
- int num_services = 0;
HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+ if (!hg)
+ return Empty;
+
+ int num_services = 0;
+
if (hg->GetMembers().size() == 0)
return 0;
Value HostGroupsTable::WorstServicesStateAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
Value worst_service = ServiceOK;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() > worst_service)
worst_service = service->GetState();
Value HostGroupsTable::NumServicesPendingAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (!service->GetLastCheckResult())
num_services++;
Value HostGroupsTable::NumServicesOkAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() == ServiceOK)
num_services++;
Value HostGroupsTable::NumServicesWarnAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() == ServiceWarning)
num_services++;
Value HostGroupsTable::NumServicesCritAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() == ServiceCritical)
num_services++;
Value HostGroupsTable::NumServicesUnknownAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() == ServiceUnknown)
num_services++;
Value HostGroupsTable::WorstServiceHardStateAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
Value worst_service = ServiceOK;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard) {
if (service->GetState() > worst_service)
Value HostGroupsTable::NumServicesHardOkAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceOK)
num_services++;
Value HostGroupsTable::NumServicesHardWarnAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceWarning)
num_services++;
Value HostGroupsTable::NumServicesHardCritAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceCritical)
num_services++;
Value HostGroupsTable::NumServicesHardUnknownAccessor(const Value& row)
{
+ HostGroup::Ptr hg = static_cast<HostGroup::Ptr>(row);
+
+ if (!hg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceUnknown)
num_services++;
Value ServiceGroupsTable::NameAccessor(const Value& row)
{
- return static_cast<ServiceGroup::Ptr>(row)->GetName();
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
+ return sg->GetName();
}
Value ServiceGroupsTable::AliasAccessor(const Value& row)
{
- return static_cast<ServiceGroup::Ptr>(row)->GetDisplayName();
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
+ return sg->GetDisplayName();
}
Value ServiceGroupsTable::NotesAccessor(const Value& row)
{
- return static_cast<ServiceGroup::Ptr>(row)->GetNotes();
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
+ return sg->GetNotes();
}
Value ServiceGroupsTable::NotesUrlAccessor(const Value& row)
{
- return static_cast<ServiceGroup::Ptr>(row)->GetNotesUrl();
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
+ return sg->GetNotesUrl();
}
Value ServiceGroupsTable::ActionUrlAccessor(const Value& row)
{
- return static_cast<ServiceGroup::Ptr>(row)->GetActionUrl();
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
+ return sg->GetActionUrl();
}
Value ServiceGroupsTable::MembersAccessor(const Value& row)
{
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
Array::Ptr members = new Array();
- BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Array::Ptr host_svc = new Array();
host_svc->Add(service->GetHost()->GetName());
host_svc->Add(service->GetShortName());
Value ServiceGroupsTable::MembersWithStateAccessor(const Value& row)
{
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
Array::Ptr members = new Array();
- BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Array::Ptr host_svc = new Array();
host_svc->Add(service->GetHost()->GetName());
host_svc->Add(service->GetShortName());
Value ServiceGroupsTable::WorstServiceStateAccessor(const Value& row)
{
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
Value worst_service = ServiceOK;
- BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
if (service->GetState() > worst_service)
worst_service = service->GetState();
}
Value ServiceGroupsTable::NumServicesAccessor(const Value& row)
{
- return static_cast<long>(static_cast<ServiceGroup::Ptr>(row)->GetMembers().size());
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
+ return sg->GetMembers().size();
}
Value ServiceGroupsTable::NumServicesOkAccessor(const Value& row)
{
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
if (service->GetState() == ServiceOK)
num_services++;
}
Value ServiceGroupsTable::NumServicesWarnAccessor(const Value& row)
{
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
if (service->GetState() == ServiceWarning)
num_services++;
}
Value ServiceGroupsTable::NumServicesCritAccessor(const Value& row)
{
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
if (service->GetState() == ServiceCritical)
num_services++;
}
Value ServiceGroupsTable::NumServicesUnknownAccessor(const Value& row)
{
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
if (service->GetState() == ServiceUnknown)
num_services++;
}
Value ServiceGroupsTable::NumServicesPendingAccessor(const Value& row)
{
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
if (!service->GetLastCheckResult())
num_services++;
}
Value ServiceGroupsTable::NumServicesHardOkAccessor(const Value& row)
{
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceOK)
num_services++;
}
Value ServiceGroupsTable::NumServicesHardWarnAccessor(const Value& row)
{
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceWarning)
num_services++;
}
Value ServiceGroupsTable::NumServicesHardCritAccessor(const Value& row)
{
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceCritical)
num_services++;
}
Value ServiceGroupsTable::NumServicesHardUnknownAccessor(const Value& row)
{
+ ServiceGroup::Ptr sg = static_cast<ServiceGroup::Ptr>(row);
+
+ if (!sg)
+ return Empty;
+
int num_services = 0;
- BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
+ BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceUnknown)
num_services++;
}