OpenCurves  0.9
FunctionClean Class Reference

A function which filters out infinite and NaN values. More...

#include <functionclean.h>

Inheritance diagram for FunctionClean:
FunctionDefinition

Public Member Functions

 FunctionClean (const QString &category=QString())
 Constructor.
 
void evaluate (PlotFunctionResult &result, double time, unsigned int argc, const double *argv, const PlotFunctionInfo &info, void *context) const override
 Evaluates the function, filtering infinite and NaN values. More...
 
- Public Member Functions inherited from FunctionDefinition
 FunctionDefinition (const QString &category, const QString &name, unsigned argc=0, bool variadic=false)
 Construct a function definition. More...
 
 FunctionDefinition (const QString &category, const QString &name, const QString &description, unsigned argc=0, bool variadic=false)
 Construct a function definition. More...
 
virtual ~FunctionDefinition ()
 Virtual destructor.
 
const QString & category () const
 Access the function categorisation for UI grouping. More...
 
void setCategory (const QString &category)
 Set the category name for the function. More...
 
const QString & name () const
 Access the function name as used by the expression generator. More...
 
void setName (const QString &name)
 Set the function name as used by the generator. More...
 
const QString & displayName () const
 Return the function name as displayed with the user. More...
 
void setDisplayName (const QString &name)
 Set the function name as displayed to the user. More...
 
const QString & description () const
 Access the function description. More...
 
void setDesciption (const QString &description)
 Set the function description. More...
 
unsigned argc () const
 Access the minimum argument count. More...
 
void setArgc (unsigned count)
 Set the minimum required arguments. More...
 
bool variadic () const
 Is the function variadic beyond argc()? More...
 
void setVariadic (bool variadic)
 Set the variadic flag. More...
 
virtual void * createContext () const
 Called to create an operating context for calculating function values. More...
 
virtual void destroyContext (void *context) const
 Destroys the context created by createContext(). More...
 
QString deduceDisplayName () const
 Deduces the display name of the function to show usage. More...
 

Detailed Description

A function which filters out infinite and NaN values.

Requires only one argument, but uses up to three as follows:

clean(x, zeroInf=1, zeroNaN=1)

The zeroInf and zeroNaN arguments control how infinite and NaN values are respectively handled. When zero, such values are set to maintain continuity in the display curve, otherwise invalid values are set to zero.

Member Function Documentation

void FunctionClean::evaluate ( PlotFunctionResult result,
double  time,
unsigned int  argc,
const double *  argv,
const PlotFunctionInfo info,
void *  context 
) const
overridevirtual

Evaluates the function, filtering infinite and NaN values.

The PlotFunctionInfo is used as follows:

  • PlotFunctionInfo::displayValue - always contains the filtered values.
  • PlotFunctionInfo::logicalValue - always contains the original, unfiltered values.
Parameters
[out]resultThe evaluation result is written here.
timeThe sample time being evaluated for.
argcThe number of arguments actually given.
argvThe list of calculated arguments, length argc. These are always logical values.
infoAdditional information about the current sampling.
contextAdditional context of the operation. May hold working data. This is optained via createContext().

Implements FunctionDefinition.


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