2019-02-25 14:48:22 +01:00
|
|
|
/* 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;
|
|
|
|
|
2018-01-04 08:54:18 +01:00
|
|
|
Column::Column(ValueAccessor valueAccessor, ObjectAccessor objectAccessor)
|
|
|
|
: m_ValueAccessor(std::move(valueAccessor)), m_ObjectAccessor(std::move(objectAccessor))
|
2013-03-10 18:49:14 +01:00
|
|
|
{ }
|
|
|
|
|
2015-02-13 15:50:20 +01:00
|
|
|
Value Column::ExtractValue(const Value& urow, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject) const
|
2013-03-10 18:49:14 +01:00
|
|
|
{
|
2013-07-10 16:11:40 +02:00
|
|
|
Value row;
|
2013-03-10 18:49:14 +01:00
|
|
|
|
2017-11-21 11:52:55 +01:00
|
|
|
if (m_ObjectAccessor)
|
2015-02-13 15:50:20 +01:00
|
|
|
row = m_ObjectAccessor(urow, groupByType, groupByObject);
|
2013-03-10 18:49:14 +01:00
|
|
|
else
|
2013-07-10 16:11:40 +02:00
|
|
|
row = urow;
|
2013-03-10 18:49:14 +01:00
|
|
|
|
2013-07-10 16:11:40 +02:00
|
|
|
return m_ValueAccessor(row);
|
2013-03-10 18:49:14 +01:00
|
|
|
}
|