MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00005 00012 #ifndef __WEMPrimitiveValueList_H 00013 #define __WEMPrimitiveValueList_H 00014 00015 #include "MLWEMIncludes.h" 00016 00017 00018 ML_START_NAMESPACE 00019 00021 00022 00025 class MLWEM_EXPORT WEMPrimitiveValueList 00026 { 00027 00028 public: 00029 00031 WEMPrimitiveValueList(); 00032 00034 WEMPrimitiveValueList(std::string description); 00035 00037 WEMPrimitiveValueList(const WEMPrimitiveValueList& valueList); 00038 00040 ~WEMPrimitiveValueList(); 00041 00043 void copyProperties(const WEMPrimitiveValueList& valueList); 00044 00046 inline std::string getDescription() const { return _description; } 00047 00049 inline std::string getUnits() const { return _units; } 00051 inline void setUnits(std::string units) { _units = units; } 00052 00054 inline PrimitiveValueListTypes getPrimitiveValueListType() const { return _primitiveValueListType; } 00056 inline void setPrimitiveValueListType(PrimitiveValueListTypes primitiveValueListType) { _primitiveValueListType = primitiveValueListType; } 00057 00060 bool isValid()const; 00062 inline unsigned int getNumValues() const { return static_cast<unsigned int>(_values.size()); } 00063 00065 inline bool isPersistent() const { return _persistent; } 00067 inline void setPersistence(bool persistent) { _persistent = persistent; } 00068 00070 inline MLDataType getDataType() const { return _dataType; } 00072 inline void setDataType(MLDataType dataType) { _dataType = dataType; } 00073 00075 inline double getMinValue() const { return _minValue; } 00077 inline double getMaxValue() const { return _maxValue; } 00079 inline double getMeanValue() const { return _meanValue; } 00081 inline double getStandardDeviationValue() const { return _stdValue; } 00083 inline double getRootMeanSquareDeviationValue() const { return _rmsdValue; } 00084 00086 inline void setMinMaxValue(double minValue, double maxValue) { _minValue = minValue; _maxValue = maxValue; _fixedMinMaxValues = true; } 00088 void computeAndSetMinMaxFixedValues(); 00090 void clampMinValue(double minValue); 00092 void clampMaxValue(double maxValue); 00093 00095 void updateStatistics(); 00096 00098 inline double getValue(unsigned int index) const { return (index < _values.size()) ? _values[index] : 0.0f; } 00101 void setValue(unsigned int index, double value); 00104 inline void appendValue(double value) { _values.push_back(value); } 00106 inline void setValueFrom(unsigned int index, unsigned int source) { _values[index] = _values[source]; } 00108 inline void addValueFrom(unsigned int index, unsigned int source, double modifier) { _values[index] += _values[source] * modifier; } 00109 00111 void resetValues(); 00113 void initializeValues(unsigned int number, double value); 00116 void multiplyValues(double modifier); 00119 void extendValues(unsigned int number, double value); 00120 00122 void saveTo(std::ostream& outstream); 00124 unsigned int loadFrom(std::istream& instream, short version, bool swapBytes); 00126 unsigned int loadFrom(char* map, short version, bool swapBytes); 00127 00131 00132 00133 inline double getStdValue() const { return getStandardDeviationValue(); } 00135 inline double getRMSDValue() const { return getRootMeanSquareDeviationValue(); } 00137 00138 private: 00139 00141 std::string _description; 00142 00144 std::string _units; 00145 00147 PrimitiveValueListTypes _primitiveValueListType; 00148 00150 MLDataType _dataType; 00151 00153 bool _fixedMinMaxValues; 00154 00156 double _minValue; 00158 double _maxValue; 00160 double _meanValue; 00162 double _stdValue; 00164 double _rmsdValue; 00165 00167 std::vector<double> _values; 00168 00170 bool _persistent; 00171 00172 }; 00173 00175 00176 00177 ML_END_NAMESPACE 00178 00179 00180 #endif // __WEMPrimitiveValueList_H 00181 00182