9#include <boost/mpl/vector.hpp>
10#include <boost/lexical_cast.hpp>
16class VistleInteractor;
24typedef boost::mpl::vector<Integer, Float, ParamVector, std::string>
Parameters;
52 Parameter(
int moduleId, const std::
string &name, Type = Invalid, Presentation = Generic);
58 void setPresentation(Presentation presentation);
59 void setDescription(const std::
string &description);
60 void setChoices(const std::vector<std::
string> &choices);
62 void setGroup(const std::
string &group);
63 const std::
string &group() const;
65 virtual operator std::
string() const = 0;
66 virtual
bool isDefault() const = 0;
67 virtual
bool checkChoice(const std::vector<std::
string> &choices)
const {
return true; }
69 const std::string &getName()
const;
71 Presentation presentation()
const;
72 const std::string &description()
const;
73 const std::vector<std::string> &choices()
const;
81 std::string m_description;
84 enum Presentation m_presentation;
92 static bool check(
const std::vector<std::string> &,
const T &) {
return true; }
107 friend class ::VistleInteractor;
109 virtual bool setValue(T value,
bool init =
false,
bool delayed =
false)
112 m_defaultValue = value;
115 this->m_value = value;
118 virtual void setMinimum(
const T &value) { m_minimum = value; }
119 virtual void setMaximum(
const T &value) { m_maximum = value; }
127 , m_defaultValue(value)
133 , m_value(other.m_value)
134 , m_defaultValue(other.m_defaultValue)
135 , m_minimum(other.m_minimum)
136 , m_maximum(other.m_maximum)
142 bool isDefault()
const {
return m_value == m_defaultValue; }
159 if (value < m_minimum)
161 if (value > m_maximum)
168 virtual bool checkChoice(
const std::vector<std::string> &ch)
const
174 virtual T
minimum()
const {
return m_minimum; }
175 virtual T
maximum()
const {
return m_maximum; }
176 operator std::string()
const {
return boost::lexical_cast<std::string>(m_value); }
181 T m_minimum, m_maximum;
188 static const bool isNumber =
true;
189 static T min() {
return std::numeric_limits<T>::lowest(); }
190 static T max() {
return std::numeric_limits<T>::max(); }
197 static const bool isNumber =
true;
198 static T min() {
return std::numeric_limits<T>::lowest(); }
199 static T max() {
return std::numeric_limits<T>::max(); }
206 static const bool isNumber =
true;
208 static T max() {
return T::max(); }
215 static const bool isNumber =
true;
217 static T max() {
return T::max(); }
222 typedef std::string
T;
224 static const bool isNumber =
false;
231 static bool check(
const std::vector<std::string> &choices,
const Integer &value)
233 if (choices.empty()) {
237 if (value < 0 ||
size_t(value) >= choices.size()) {
238 std::cerr <<
"IntParameter: choice out of range" << std::endl;
247 static bool check(
const std::vector<std::string> &choices,
const std::string &value)
249 if (choices.empty()) {
253 if (std::find(choices.begin(), choices.end(), value) == choices.end()) {
255 std::cerr <<
"StringParameter: choice \"" << value <<
"\" not valid" << std::endl;
262#define V_PARAM_TYPE(ValueType, Name) \
263 extern template class V_COREEXPORT ParameterBase<ValueType>; \
264 typedef ParameterBase<ValueType> Name;
Definition: parameter.h:100
const T getValue(RangeType rt) const
Definition: parameter.h:145
const T getValue() const
Definition: parameter.h:144
ParameterBase(int moduleId, const std::string &name, T value=T())
Definition: parameter.h:124
const T getDefaultValue() const
Definition: parameter.h:143
virtual T minimum() const
Definition: parameter.h:174
virtual ~ParameterBase()
Definition: parameter.h:138
T ValueType
Definition: parameter.h:122
friend class Renderer
Definition: parameter.h:103
virtual T maximum() const
Definition: parameter.h:175
virtual bool checkValue(const T &value) const
Definition: parameter.h:156
friend class VistleConnection
Definition: parameter.h:105
bool isDefault() const
Definition: parameter.h:142
virtual bool checkChoice(const std::vector< std::string > &ch) const
Definition: parameter.h:168
ParameterBase(const ParameterBase< T > &other)
Definition: parameter.h:131
virtual ParameterBase< T > * clone() const
Definition: parameter.h:140
Definition: parametermanager.h:16
Definition: paramvector.h:18
Definition: parameter.h:26
Minimum() const std::string Type
Definition: parameter.h:52
std::vector< std::string > m_choices
Definition: parameter.h:76
DEFINE_ENUM_WITH_STRING_CONVERSIONS(Type,(Unknown)(Float)(Integer)(Vector)(IntVector)(String)(Invalid)) DEFINE_ENUM_WITH_STRING_CONVERSIONS(Presentation
Minimum() const std::string & name
Definition: parameter.h:52
Minimum() Value(Maximum)) Parameter(int moduleId
Type type() const
Definition: parameter.cpp:54
Presentation presentation() const
Definition: parameter.cpp:64
request parameter value update or notify that a parameter value has been changed
Definition: messages.h:501
#define V_COREEXPORT
Definition: export.h:9
#define V_ENUM_OUTPUT_OP(name, scope)
Definition: enum.h:72
Definition: parameter.h:18
std::string module(const std::string &prefix)
Definition: directory.cpp:61
static T min(T a, T b)
Definition: messages.cpp:28
Definition: allobjects.cpp:30
ParameterVector< Integer > IntParamVector
Definition: paramvector.h:188
double Float
Definition: scalar.h:18
Vector3 Vector
Definition: vector.h:36
DEFINE_ENUM_WITH_STRING_CONVERSIONS(FieldCompressionMode,(Uncompressed)(ZfpFixedRate)(ZfpAccuracy)(ZfpPrecision)) namespace detail
Definition: archives_config.h:38
boost::mpl::vector< Integer, Float, ParamVector, std::string > Parameters
Definition: parameter.h:24
int64_t Integer
Definition: scalar.h:19
ParameterVector< Float > ParamVector
Definition: paramvector.h:187
Definition: parameter.h:88
#define V_PARAM_TYPE(ValueType, Name)
Definition: parameter.h:262
static bool check(const std::vector< std::string > &choices, const Integer &value)
Definition: parameter.h:231
static bool check(const std::vector< std::string > &choices, const std::string &value)
Definition: parameter.h:247
Definition: parameter.h:91
static bool check(const std::vector< std::string > &, const T &)
Definition: parameter.h:92
static T max()
Definition: parameter.h:199
static T min()
Definition: parameter.h:198
Float T
Definition: parameter.h:195
static T max()
Definition: parameter.h:217
IntParamVector T
Definition: parameter.h:213
static T min()
Definition: parameter.h:216
static T max()
Definition: parameter.h:190
Integer T
Definition: parameter.h:186
static T min()
Definition: parameter.h:189
ParamVector T
Definition: parameter.h:204
static T max()
Definition: parameter.h:208
static T min()
Definition: parameter.h:207
static T max()
Definition: parameter.h:226
std::string T
Definition: parameter.h:222
static T min()
Definition: parameter.h:225