// Copyright (C) 2013-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // 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 http://mozilla.org/MPL/2.0/. #if !defined (COMMONAPI_INTERNAL_COMPILATION) #error "Only can be included directly, this file may disappear or change contents." #endif #ifndef COMMONAPI_INPUT_STREAM_HPP_ #define COMMONAPI_INPUT_STREAM_HPP_ #include #include #include #include #include #include #include #include #include namespace CommonAPI { template class InputStream { public: template InputStream &readValue(bool &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(int8_t &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(int16_t &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(int32_t &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(int64_t &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(uint8_t &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(uint16_t &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(uint32_t &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(uint64_t &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(float &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(double &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(std::string &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(Enumeration &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(RangedInteger &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(Struct &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(std::shared_ptr &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(Variant &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(std::vector &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(std::unordered_map &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } template InputStream &readValue(Version &_value, const Deployment_ *_depl = nullptr) { return get()->readValue(_value, _depl); } bool hasError() const { return get()->hasError(); } private: inline Derived_ *get() { return static_cast(this); } inline const Derived_ *get() const { return static_cast(this); } }; template InputStream &operator>>(InputStream &_input, bool &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, int8_t &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, int16_t &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, int32_t &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, int64_t &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, uint8_t &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, uint16_t &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, uint32_t &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, uint64_t &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, float &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, double &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, std::string &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, Version &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, Enumeration &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, Struct &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, std::shared_ptr &_value) { return _input.template readValue(_value); } template InputStream & operator>>(InputStream &_input, Variant &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, std::vector &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, std::unordered_map &_value) { return _input.template readValue(_value); } template InputStream &operator>>(InputStream &_input, Deployable &_value) { return _input.template readValue(_value.getValue(), _value.getDepl()); } } // namespace CommonAPI #endif // COMMONAPI_INPUT_STREAM_HPP_