icinga2/lib/livestatus/column.cpp

22 lines
549 B
C++
Raw Normal View History

/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2013-03-10 18:49:14 +01:00
2014-05-25 16:23:35 +02:00
#include "livestatus/column.hpp"
2013-03-10 18:49:14 +01:00
using namespace icinga;
Column::Column(ValueAccessor valueAccessor, ObjectAccessor objectAccessor)
: m_ValueAccessor(std::move(valueAccessor)), m_ObjectAccessor(std::move(objectAccessor))
2013-03-10 18:49:14 +01:00
{ }
Value Column::ExtractValue(const Value& urow, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject) const
2013-03-10 18:49:14 +01:00
{
Value row;
2013-03-10 18:49:14 +01:00
if (m_ObjectAccessor)
row = m_ObjectAccessor(urow, groupByType, groupByObject);
2013-03-10 18:49:14 +01:00
else
row = urow;
2013-03-10 18:49:14 +01:00
return m_ValueAccessor(row);
2013-03-10 18:49:14 +01:00
}