10#include <boost/algorithm/string.hpp>
11#include <boost/format.hpp>
14namespace MDAlgorithms {
23template <
typename Derived,
typename ElemType>
29 std::string toXMLString()
const;
30 Derived &operator=(
const Derived &other);
33 ElemType getX()
const;
34 ElemType getY()
const;
35 ElemType getZ()
const;
36 virtual bool isValid()
const;
37 ElemType &operator[](
int index);
48template <
typename Derived,
typename ElemType>
51 this->m_isValid = other.m_isValid;
52 this->m_vector.swap(std::vector<ElemType>(3));
53 std::copy(other.m_vector.begin(), other.m_vector.end(), this->m_vector.begin());
55 return *(
dynamic_cast<Derived *
>(
this));
58template <
typename Derived,
typename ElemType>
60 return std::equal(m_vector.begin(), m_vector.end(), other.m_vector.begin());
63template <
typename Derived,
typename ElemType>
65 return !(*
this == other);
68template <
typename Derived,
typename ElemType>
72 if (
true == other.m_isValid) {
79template <
typename Derived,
typename ElemType>
82template <
typename Derived,
typename ElemType>
103 std::string valueXMLtext = boost::str(boost::format(
"%.4f, %.4f, %.4f") % m_vector[0] % m_vector[1] % m_vector[2]);
104 return this->parameterXMLTemplate(valueXMLtext);
108 return m_vector[
index];
118#define DECLARE_3D_VECTOR_PARAMETER(classname, type_) \
119 class classname : public Mantid::MDAlgorithms::Vector3DParameter<classname, double> { \
121 using SuperType = Vector3DParameter<classname, type_> SuperType; \
122 static std::string parameterName() { return #classname; } \
123 classname(type_ a, type_ b, type_ c) : SuperType(a, b, c) {} \
124 classname() : SuperType() {} \
125 std::string getName() const { return #classname; } \
126 classname *clone() const { return new classname(m_vector[0], m_vector[1], m_vector[2]); } \
std::map< DeltaEMode::Type, std::string > index
Abstract parameter type for use with IImplicitFunctions.
Vector3DParameter is abstract type implementing curiously recurring template pattern to implement com...
bool operator==(const Derived &other) const
bool operator!=(const Derived &other) const
Derived & operator=(const Derived &other)
std::vector< ElemType > m_vector
virtual bool isValid() const
std::string toXMLString() const
ElemType & operator[](int index)
Helper class which provides the Collimation Length for SANS instruments.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr bool operator!=(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)