EMANE  1.2.1
EMANE::StatisticTable< Key, Compare, sortIndex > Class Template Reference

A two dimentional statistic table that holds Any values. More...

#include <statistictable.h>

Inheritance diagram for EMANE::StatisticTable< Key, Compare, sortIndex >:
EMANE::StatisticTablePublisher

Public Member Functions

 ~StatisticTable ()
 
void setCell (const Key &key, std::size_t columnIndex, const Any &any)
 
void setRow (const Key &key, const std::vector< Any > &anys)
 
void addRow (const Key &key, const std::vector< Any > &anys={})
 
void deleteRow (const Key &key)
 
StatisticTableLabels getLabels () const override
 
StatisticTableValues getValues () const override
 
void clear () override
 

Detailed Description

template<typename Key, typename Compare = std::less<EMANE::Any>, std::size_t sortIndex = 0>
class EMANE::StatisticTable< Key, Compare, sortIndex >

A two dimentional statistic table that holds Any values.

Template Parameters
KeyType of the keys. Each row in the table is uniquely identified by its key value
CompareA binary predicate that takes two element keys as arguments and returns a bool
scolumnThe column used when sorting the table using Compare

Definition at line 62 of file statistictable.h.

Constructor & Destructor Documentation

◆ ~StatisticTable()

template<typename Key , typename Compare , std::size_t sortIndex>
EMANE::StatisticTable< Key, Compare, sortIndex >::~StatisticTable ( )

Destroys an instance

Definition at line 41 of file statistictable.inl.

Member Function Documentation

◆ addRow()

template<typename Key, typename Compare , std::size_t sortIndex>
void EMANE::StatisticTable< Key, Compare, sortIndex >::addRow ( const Key &  key,
const std::vector< Any > &  anys = {} 
)

Adds a row to the table

Parameters
keyTable row key
anysVector of any values
Exceptions
StatisticTableExceptionwhen either the row key is already in use or the number of columns in the row values does not match the table

Definition at line 98 of file statistictable.inl.

◆ clear()

template<typename Key , typename Compare , std::size_t sortIndex>
void EMANE::StatisticTable< Key, Compare, sortIndex >::clear ( )
overridevirtual

Clears the table

Implements EMANE::StatisticTablePublisher.

Definition at line 172 of file statistictable.inl.

◆ deleteRow()

template<typename Key, typename Compare , std::size_t sortIndex>
void EMANE::StatisticTable< Key, Compare, sortIndex >::deleteRow ( const Key &  key)

Deletes a row from the table

Parameters
keyTable row key

Definition at line 127 of file statistictable.inl.

◆ getLabels()

template<typename Key , typename Compare , std::size_t sortIndex>
EMANE::StatisticTableLabels EMANE::StatisticTable< Key, Compare, sortIndex >::getLabels ( ) const
overridevirtual

Gets the table column labels

Returns
labels

Implements EMANE::StatisticTablePublisher.

Definition at line 164 of file statistictable.inl.

◆ getValues()

template<typename Key , typename Compare , std::size_t sortIndex>
EMANE::StatisticTableValues EMANE::StatisticTable< Key, Compare, sortIndex >::getValues ( ) const
overridevirtual

Gets the table values

Returns
values

Implements EMANE::StatisticTablePublisher.

Definition at line 136 of file statistictable.inl.

◆ setCell()

template<typename Key, typename Compare , std::size_t sortIndex>
void EMANE::StatisticTable< Key, Compare, sortIndex >::setCell ( const Key &  key,
std::size_t  columnIndex,
const Any any 
)

Sets a specified table cell

Parameters
keyTable row key
columnIndexRow column index (indexed from 0)
anyValue to set
Exceptions
StatisticTableExceptionwhen either the row key of column index are invalid

Definition at line 45 of file statistictable.inl.

◆ setRow()

template<typename Key, typename Compare , std::size_t sortIndex>
void EMANE::StatisticTable< Key, Compare, sortIndex >::setRow ( const Key &  key,
const std::vector< Any > &  anys 
)

Sets a column of a specified row

Parameters
keyTable row key
anysVector of any values
Exceptions
StatisticTableExceptionwhen either the row key is invalid or the number of columns in the row values does not match the table

Definition at line 72 of file statistictable.inl.


The documentation for this class was generated from the following files: