ngscopeclient 0.1-dev+51fbda87c
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members

A parameter to a filter. More...

#include <FilterParameter.h>

Collaboration diagram for FilterParameter:
Collaboration graph
[legend]

Public Types

enum  ParameterTypes {
  TYPE_FLOAT , TYPE_INT , TYPE_BOOL , TYPE_FILENAME ,
  TYPE_ENUM , TYPE_STRING , TYPE_8B10B_PATTERN
}
 Types of data a parameter can store.
 

Public Member Functions

 FilterParameter (ParameterTypes type=FilterParameter::TYPE_FLOAT, Unit unit=Unit(Unit::UNIT_FS))
 Creates a parameter. More...
 
void ParseString (const std::string &str, bool useDisplayLocale=true)
 Sets the parameter to a value represented as a string. More...
 
std::string ToString (bool useDisplayLocale=true) const
 Returns a pretty-printed representation of the parameter's value.
 
bool GetBoolVal () const
 Returns the value of the parameter interpreted as a boolean.
 
int64_t GetIntVal () const
 Returns the value of the parameter interpreted as an integer.
 
float GetFloatVal () const
 Returns the value of the parameter interpreted as a floating point number.
 
std::vector< T8B10BSymbolGet8B10BPattern ()
 Access to the underlying pattern.
 
std::string GetFileName () const
 Returns the value of the parameter interpreted as a file path.
 
void SetBoolVal (bool b)
 Sets the parameter to a boolean value.
 
void SetIntVal (int64_t i)
 Sets the parameter to an integer value.
 
void SetFloatVal (float f)
 Sets the parameter to a floating point value.
 
void SetStringVal (const std::string &f)
 Sets the parameter to a string.
 
void SetFileName (const std::string &f)
 Sets the parameter to a file path.
 
void Set8B10BPattern (const std::vector< T8B10BSymbol > &pattern)
 
ParameterTypes GetType () const
 Returns the type of the parameter.
 
Unit GetUnit () const
 Returns the units of the parameter.
 
void SetUnit (Unit u)
 Change the units of the parameter.
 
void AddEnumValue (const std::string &name, int value)
 Adds a (name, value) pair to a TYPE_ENUM parameter.
 
void GetEnumValues (std::vector< std::string > &values)
 Gets a list of valid enumerated parameter names for a TYPE_ENUM parameter.
 
void ClearEnumValues ()
 Clears the list of enumerated values for a TYPE_ENUM parameter.
 
void Reinterpret ()
 Reinterprets our string representation (in case our type or enums changed)
 
sigc::signal< void()> signal_changed ()
 Signal emitted every time the parameter's value changes.
 
sigc::signal< void()> signal_enums_changed ()
 Signal emitted every time the list of enumeration values changes.
 
void MarkHidden ()
 Marks this parameter to be hidden from the GUI. More...
 
bool IsHidden ()
 Checks if this parameter should be hidden in the GUI.
 
void MarkReadOnly ()
 Marks this parameter as read-only in the GUI. More...
 
bool IsReadOnly ()
 Checks if this parameter should be read-only in the GUI.
 

Static Public Member Functions

static FilterParameter UnitSelector ()
 Constructs a FilterParameter object for choosing from available units.
 

Public Attributes

std::string m_fileFilterMask
 
std::string m_fileFilterName
 
bool m_fileIsOutput
 

Protected Attributes

ParameterTypes m_type
 
sigc::signal< void()> m_changeSignal
 
sigc::signal< void()> m_enumSignal
 
Unit m_unit
 
std::map< std::string, int > m_forwardEnumMap
 
std::map< int, std::string > m_reverseEnumMap
 
std::vector< T8B10BSymbolm_8b10bPattern
 
int64_t m_intval
 
float m_floatval
 
std::string m_string
 
bool m_hidden
 
bool m_readOnly
 

Detailed Description

A parameter to a filter.

Parameters are used for some scalar inputs, configuration settings, and generally any input a filter takes which is not some kind of waveform.

Constructor & Destructor Documentation

◆ FilterParameter()

FilterParameter::FilterParameter ( ParameterTypes  type = FilterParameter::TYPE_FLOAT,
Unit  unit = Unit(Unit::UNIT_FS) 
)

Creates a parameter.

Parameters
typeType of parameter
unitUnit of measurement (ignored for non-numeric types)

Member Function Documentation

◆ MarkHidden()

void FilterParameter::MarkHidden ( )
inline

Marks this parameter to be hidden from the GUI.

The most common use case for this is a derived filter class that wraps a base filter class but automatically calculates coefficients or other configuration based on user input. The coefficients are no longer direct user inputs, so they should be marked hidden to avoid confusing the user.

◆ MarkReadOnly()

void FilterParameter::MarkReadOnly ( )
inline

Marks this parameter as read-only in the GUI.

This is typically used for a filter to output configuration values to the user (bandwidth, resolution, etc) calculated from user input, while not allowing the user to override them.

◆ ParseString()

void FilterParameter::ParseString ( const std::string &  str,
bool  useDisplayLocale = true 
)

Sets the parameter to a value represented as a string.

The string is converted to the appropriate internal representation.


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