MineLink
 All Data Structures Functions Variables Pages
delphos::SelectionAvg Class Reference

Abstracts average-type functions to be evaluated over a set of blocks. More...

#include <blocksel.h>

Inheritance diagram for delphos::SelectionAvg:
Inheritance graph
Collaboration diagram for delphos::SelectionAvg:
Collaboration graph

Public Member Functions

 SelectionAvg (const string &column_to_add)
 Defines the attribute column that is going to be averaged. More...
 
 SelectionAvg (const string &column_to_add, const string &weight)
 Defines the attributes to be used on a weighted average function. More...
 
virtual ~SelectionAvg ()
 Destroys the object.
 
const string & WeightColumn () const
 Retrieves the name of the weight column. More...
 
virtual double Eval (const delphos::BlockSelection &bsel) const
 Evaluates the defined average function over the given selection. More...
 
- Public Member Functions inherited from delphos::SelectionSum
 SelectionSum (const string &column_to_add)
 Defines the attribute to be added. More...
 
virtual const string & ColumnToAdd () const
 Retrieves rhe name of the attribute column that is going to be added.
 
- Public Member Functions inherited from delphos::SelectionFunctor
virtual ~SelectionFunctor ()
 Destroys the selection functor.
 

Static Public Attributes

static string NO_WEIGHT_COLUMN =string("NO_WEIGHT_COLUMN")
 "No Weight" column name. This name is used in case no weight is wanted for averaging.
 

Detailed Description

Abstracts average-type functions to be evaluated over a set of blocks.

Constructor & Destructor Documentation

delphos::SelectionAvg::SelectionAvg ( const string &  column_to_add)

Defines the attribute column that is going to be averaged.

Parameters
column_to_addThe name of the column to average.
delphos::SelectionAvg::SelectionAvg ( const string &  column_to_add,
const string &  weight 
)

Defines the attributes to be used on a weighted average function.

Parameters
column_to_addThe name of the column that is going to be added.
weightThe name of the column that is going to be used as weight for the sum.

Member Function Documentation

double delphos::SelectionAvg::Eval ( const delphos::BlockSelection bsel) const
virtual

Evaluates the defined average function over the given selection.

Parameters
bselThe BlockSelection instance to be averaged.
Returns
The defined average of the correponding attribute(s) over the given selection.

If an attribute column is not found in the given selection's subyacent BlockModel instance, an exception is thrown.

Reimplemented from delphos::SelectionSum.

const string & delphos::SelectionAvg::WeightColumn ( ) const

Retrieves the name of the weight column.

Returns
The name of the defined weight column.

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