37#ifndef FilterParameter_h
38#define FilterParameter_h
114 {
return (m_intval != 0); }
130 if(m_reverseEnumMap.find(m_intval) == m_reverseEnumMap.end())
132 LogWarning(
"Attempted to convert value %" PRIi64 " to a %s but it is not a legal enum member\n",
135 return static_cast<T>(m_reverseEnumMap.begin()->first);
138 return static_cast<T>(m_intval);
145 {
return m_floatval; }
151 {
return m_8b10bPattern; }
164 void Set8B10BPattern(
const std::vector<T8B10BSymbol>&
pattern);
185 std::string m_fileFilterMask;
186 std::string m_fileFilterName;
196 m_forwardEnumMap[name] = value;
197 m_reverseEnumMap[value] = name;
206 for(
auto it : m_forwardEnumMap)
215 m_forwardEnumMap.clear();
216 m_reverseEnumMap.clear();
226 {
return m_changeSignal; }
232 {
return m_enumSignal; }
257 { m_readOnly =
true; }
263 {
return m_readOnly; }
268 sigc::signal<
void()> m_changeSignal;
269 sigc::signal<
void()> m_enumSignal;
273 std::map<std::string, int> m_forwardEnumMap;
274 std::map<int, std::string> m_reverseEnumMap;
276 std::vector<T8B10BSymbol> m_8b10bPattern;
280 std::string m_string;
Definition AcceleratorBuffer.h:204
A parameter to a filter.
Definition FilterParameter.h:86
sigc::signal< void()> signal_enums_changed()
Signal emitted every time the list of enumeration values changes.
Definition FilterParameter.h:231
void MarkReadOnly()
Marks this parameter as read-only in the GUI.
Definition FilterParameter.h:256
bool GetBoolVal() const
Returns the value of the parameter interpreted as a boolean.
Definition FilterParameter.h:113
const std::vector< T8B10BSymbol > & Get8B10BPattern()
Access to the underlying pattern.
Definition FilterParameter.h:150
void SetIntVal(int64_t i)
Sets the parameter to an integer value.
Definition FilterParameter.cpp:307
bool IsReadOnly()
Checks if this parameter should be read-only in the GUI.
Definition FilterParameter.h:262
bool IsHidden()
Checks if this parameter should be hidden in the GUI.
Definition FilterParameter.h:247
ParameterTypes GetType() const
Returns the type of the parameter.
Definition FilterParameter.h:169
int64_t GetIntVal() const
Returns the value of the parameter interpreted as an integer.
Definition FilterParameter.h:119
ParameterTypes
Types of data a parameter can store.
Definition FilterParameter.h:93
T GetEnumVal() const
Returns the value of the parameter interpreted as an enum.
Definition FilterParameter.h:126
const std::string & GetFileName() const
Returns the value of the parameter interpreted as a file path.
Definition FilterParameter.h:156
void AddEnumValue(const std::string &name, int value)
Adds a (name, value) pair to a TYPE_ENUM parameter.
Definition FilterParameter.h:194
void ClearEnumValues()
Clears the list of enumerated values for a TYPE_ENUM parameter.
Definition FilterParameter.h:213
sigc::signal< void()> signal_changed()
Signal emitted every time the parameter's value changes.
Definition FilterParameter.h:225
void SetFloatVal(float f)
Sets the parameter to a floating point value.
Definition FilterParameter.cpp:323
void SetStringVal(const std::string &f)
Sets the parameter to a string.
Definition FilterParameter.cpp:336
void SetBoolVal(bool b)
Sets the parameter to a boolean value.
Definition FilterParameter.cpp:294
void GetEnumValues(std::vector< std::string > &values)
Gets a list of valid enumerated parameter names for a TYPE_ENUM parameter.
Definition FilterParameter.h:204
void MarkHidden(bool hidden=true)
Marks this parameter to be hidden from the GUI.
Definition FilterParameter.h:241
void SetFileName(const std::string &f)
Sets the parameter to a file path.
Definition FilterParameter.cpp:344
float GetFloatVal() const
Returns the value of the parameter interpreted as a floating point number.
Definition FilterParameter.h:144
void SetUnit(Unit u)
Change the units of the parameter.
Definition FilterParameter.h:181
static FilterParameter UnitSelector()
Constructs a FilterParameter object for choosing from available units.
Definition FilterParameter.cpp:67
Unit GetUnit() const
Returns the units of the parameter.
Definition FilterParameter.h:175
std::string ToString(bool useDisplayLocale=true, int sigfigs=-1) const
Returns a pretty-printed representation of the parameter's value.
Definition FilterParameter.cpp:225
void Reinterpret()
Reinterprets our string representation (in case our type or enums changed)
Definition FilterParameter.cpp:100
void ParseString(const std::string &str, bool useDisplayLocale=true)
Sets the parameter to a value represented as a string.
Definition FilterParameter.cpp:110
An 8B/10B symbol within a pattern, used for trigger matching.
Definition FilterParameter.h:45
A unit of measurement, plus conversion to pretty-printed output.
Definition Unit.h:59