diff options
Diffstat (limited to 'core/src/Model/EvaluatedValue.hpp')
-rw-r--r-- | core/src/Model/EvaluatedValue.hpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/core/src/Model/EvaluatedValue.hpp b/core/src/Model/EvaluatedValue.hpp new file mode 100644 index 0000000..838fc39 --- /dev/null +++ b/core/src/Model/EvaluatedValue.hpp @@ -0,0 +1,64 @@ +#pragma once + +#include <chrono> +#include <cstdint> +#include <string> + +class BaseValue { +public: + enum Type { + NumericType, + TextType, + DateTimeType, + + /// An unspecified type, otherwise known as "any" in some contexts. + InvalidType, + TypeCount = InvalidType, + }; + +private: + Type mType; + +public: + BaseValue(Type type); + virtual ~BaseValue() = default; + + BaseValue(const BaseValue&) = delete; + BaseValue& operator=(const BaseValue&) = delete; + BaseValue(BaseValue&&) = default; + BaseValue& operator=(BaseValue&&) = default; + + Type GetType() const; +}; + +class NumericValue : public BaseValue { +private: + double mValue; + +public: + NumericValue(); + + int64_t GetInt() const; + double GetValue() const; + void SetValue(double value); +}; + +class TextValue : public BaseValue { +private: + std::string mValue; + +public: + TextValue(); + const std::string& GetValue() const; + void SetValue(const std::string& value); +}; + +class DateTimeValue : public BaseValue { +private: + std::chrono::time_point<std::chrono::system_clock> mValue; + +public: + DateTimeValue(); + const std::chrono::time_point<std::chrono::system_clock>& GetValue() const; + void SetValue(const std::chrono::time_point<std::chrono::system_clock>& value); +}; |