#pragma once /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ /** @file */ /** @copyright 2021 MPLv2 */ #include #include #include //#define DEFINE_TYPE_NAME(type, name) template<> Whisper::PayloadType GetType(){return name;} /** * @brief This is the main namespace for all whisper-com related datatypes and classed. */ namespace Whisper { enum class PayloadType : std::uint8_t { UINT8, UINT16, UINT32, UINT64, INT8, INT16, INT32, INT64, FLOAT, DOUBLE, STRING, PAYLOAD }; template Whisper::PayloadType GetType(); template class Payload : public Tree::BaseNode { private: std::string fieldName_; T value_; public: Payload(const std::string field, T value) : fieldName_(field), value_(value), Tree::BaseNode() {} Payload(const std::string field) : fieldName_(field), Tree::BaseNode() {} Whisper::PayloadType getType() {return Whisper::GetType();} T getValue() const { return value_;} std::string getFieldName() const { return fieldName_;} }; // class Payload }; // namespace Whisper