summaryrefslogtreecommitdiffstats
path: root/lib/livestatus/column.cpp
blob: c915b3df3c674923866a694fa651bc1273e3d346 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */

#include "livestatus/column.hpp"

using namespace icinga;

Column::Column(ValueAccessor valueAccessor, ObjectAccessor objectAccessor)
	: m_ValueAccessor(std::move(valueAccessor)), m_ObjectAccessor(std::move(objectAccessor))
{ }

Value Column::ExtractValue(const Value& urow, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject) const
{
	Value row;

	if (m_ObjectAccessor)
		row = m_ObjectAccessor(urow, groupByType, groupByObject);
	else
		row = urow;

	return m_ValueAccessor(row);
}