//..............................................................................
//
// Some standard stats collected via selection processors
//

import "ui_InformationGrid.jnc"

namespace ui {

//! \addtogroup common-ui
//! @{

//..............................................................................

class ThroughputInfoSet
{
	bitflag enum InfoId
	{
		TimeSpan,
		TxTotalSize,
		TxThroughput,
		RxTotalSize,
		RxThroughput,
		TotalSize,
		TotalThroughput,

		Default =
			TimeSpan |
			TxTotalSize |
			TxThroughput |
			RxTotalSize |
			RxThroughput,
	}

	InformationValue* m_timeSpanInfo;
	InformationValue* m_txTotalSizeInfo;
	InformationValue* m_txThroughputInfo;
	InformationValue* m_rxTotalSizeInfo;
	InformationValue* m_rxThroughputInfo;
	InformationValue* m_totalSizeInfo;
	InformationValue* m_totalThroughputInfo;

	createInformationValues(
		InformationGrid* informationGrid,
		InformationGroup* group = null,
		InformationValue* insertBefore = null,
		InfoId mask = InfoId.Default
		);

	createInformationValuesGrouped(
		InformationGrid* informationGrid,
		InformationGroup* group = null,
		InformationValue* insertBefore = null,
		InfoId mask = InfoId.Default
		);
}

// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ThroughputInfoSet.createInformationValues(
	InformationGrid* informationGrid,
	InformationGroup* group,
	InformationValue* insertBefore,
	InfoId mask
	)
{
	if (mask & InfoId.TimeSpan)
		m_timeSpanInfo = informationGrid.createValue(group, insertBefore, true, "Time span");

	if (mask & InfoId.TxTotalSize)
		m_txTotalSizeInfo = informationGrid.createValue(group, insertBefore, true, "TX total bytes");

	if (mask & InfoId.TxThroughput)
		m_txThroughputInfo = informationGrid.createValue(group, insertBefore, true, "TX throughput");

	if (mask & InfoId.RxTotalSize)
		m_rxTotalSizeInfo = informationGrid.createValue(group, insertBefore, true, "RX total bytes");

	if (mask & InfoId.RxThroughput)
		m_rxThroughputInfo = informationGrid.createValue(group, insertBefore, true, "RX throughput");

	if (mask & InfoId.TotalSize)
		m_totalSizeInfo = informationGrid.createValue(group, insertBefore, true, "Total bytes");

	if (mask & InfoId.TotalThroughput)
		m_totalThroughputInfo = informationGrid.createValue(group, insertBefore, true, "Total throughput");
}

ThroughputInfoSet.createInformationValuesGrouped(
	InformationGrid* informationGrid,
	InformationGroup* group,
	InformationValue* insertBefore,
	InfoId mask
	)
{
	InformationGroup* subGroup = informationGrid.createGroup(
		group,
		insertBefore,
		"Throughput calculator",
		"Make a selection in the log to calculate throughput"
		);

	createInformationValues(informationGrid, subGroup,, mask);
}

//..............................................................................

//! @}

} // namespace ui
