#pragma once #include #include #include #include #include #include "storage/model/properties/flags.hpp" #include "utils/underlying_cast.hpp" class Null; class Property { public: using sptr = std::shared_ptr; static const Null Null; Property(Flags flags); virtual bool operator==(const Property &other) const = 0; bool operator!=(const Property &other) const; template bool is() const { return underlying_cast(flags) & underlying_cast(T::type); } template T &as() { assert(this->is()); return *static_cast(this); } template const T &as() const { assert(this->is()); return *static_cast(this); } virtual std::ostream &print(std::ostream &stream) const = 0; friend std::ostream &operator<<(std::ostream &stream, const Property &prop); const Flags flags; }; using properties_t = std::vector;