13 #ifndef ML_MULTI_FIELDS_H
14 #define ML_MULTI_FIELDS_H
36 template <
class DATATYPE>
inline std::ostream&
operator<<(std::ostream& s,
const std::vector<DATATYPE>& vec)
39 for (
size_t i = 0; i < vec.size(); i++) {
48 template <
class DATATYPE>
inline std::istream&
operator>>(std::istream& s, std::vector<DATATYPE>& vec)
82 std::istringstream ist(value);
103 if (
nullptr == values){
106 "Ignoring function call");
110 _fields.resize(numValues);
113 for (
size_t c=0; c < numValues; ++c){ _fields[c] = values[c]; }
131 if (
nullptr == values){
134 "Ignoring function call");
138 if (numValues > _fields.size()){ numValues = _fields.size(); }
141 for (
size_t c=0; c < numValues; ++c){ values[c] = _fields[c]; }
150 std::ostringstream ost;
176 return _fields.size();
181 std::vector<DATATYPE> _fields;
188 #if !defined(_WIN32) && !defined(WIN32)
193 template class MultiField<MLdouble>;
194 template class MultiField<MLfloat>;
195 template class MultiField<MLint>;
196 template class MultiField<MLint32>;
197 template class MultiField<MLuint32>;
204 #pragma warning( push )
209 #pragma warning(disable : 4275 )
286 #pragma warning( pop )
ML_CLASS_HEADER(DoubleMultiField)
Macro to implement the interface for the Runtime Type System and for the initialization of this class...
DoubleMultiField(const std::string &name="")
Constructor. See constructor of MultiField for documentation.
Base class for all fields used in the ML.
Class FloatMultiField. See MultiField for documentation.
FloatMultiField(const std::string &name="")
Constructor. See constructor of MultiField for documentation.
ML_CLASS_HEADER(FloatMultiField)
Macro to implement the interface for the Runtime Type System and for the initialization of this class...
Class Int32MultiField. See MultiField for documentation.
ML_CLASS_HEADER(Int32MultiField)
Macro to implement the interface for the Runtime Type System and for the initialization of this class...
Int32MultiField(const std::string &name="")
Constructor. See constructor of MultiField for documentation.
Class IntMultiField. See MultiField for documentation.
ML_CLASS_HEADER(IntMultiField)
Macro to implement the interface for the Runtime Type System and for the initialization of this class...
IntMultiField(const std::string &name="")
Constructor. See constructor of MultiField for documentation.
Field to represent a dynamic vector of DATATYPE values.
std::vector< DATATYPE > & getNonConstMultiField()
Returns the vector of the field as modifiable reference.
void setMultiField(const std::vector< DATATYPE > &value)
Set values of the field to value which is a std::vector.
void setMultiField(const DATATYPE values[], size_t numValues)
Set values of the field to values which is an array of values.
void setStringValue(const std::string &value) override
Set value to value.
const std::vector< DATATYPE > & getMultiField() const
Returns the vector of the field.
std::string getStringValue() const override
Return the value as string value.
size_t getSize() const
Returns number of entries in vector.
void getMultiField(DATATYPE values[], size_t numValues)
Get values from the field into values which is an array of values.
MultiField(const std::string &name="")
Empty Constructor: Create a field with name name.
Class UInt32MultiField. See MultiField for documentation.
UInt32MultiField(const std::string &name="")
Constructor. See constructor of MultiField for documentation.
ML_CLASS_HEADER(UInt32MultiField)
Macro to implement the interface for the Runtime Type System and for the initialization of this class...
#define ML_BAD_POINTER_OR_0
A pointer is NULL or a value is NULL or 0 where it should not be.
std::istream & operator>>(std::istream &in, ml::Variant &variant)
std::ostream & operator<<(std::ostream &s, const std::vector< DATATYPE > &vec)
Helper output/input stream operators.
void ML_UTILS_EXPORT printTemplateFatalError(const char *location, MLErrorCode reason, const std::string_view &handling)