// Copyright (C) 2014-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_STUB_HPP_ #define COMMONAPI_STUB_HPP_ #include #include #include #include #include namespace CommonAPI { class StubAdapter { public: virtual ~StubAdapter() {} inline const Address &getAddress() const { return address_; } protected: Address address_; }; class StubBase { public: virtual ~StubBase() {} virtual bool hasElement(const uint32_t _id) const = 0; }; template class Stub: public virtual StubBase { static_assert(std::is_base_of::value, "Invalid StubAdapter Class!"); public: typedef StubAdapter_ StubAdapterType; typedef StubRemoteEventHandler_ RemoteEventHandlerType; virtual ~Stub() {} virtual StubRemoteEventHandler_* initStubAdapter(const std::shared_ptr &_stubAdapter) = 0; inline const std::shared_ptr getStubAdapter() const { return stubAdapter_.lock(); } protected: std::weak_ptr stubAdapter_; }; enum SelectiveBroadcastSubscriptionEvent { SUBSCRIBED, UNSUBSCRIBED }; } // namespace CommonAPI #endif // COMMONAPI_STUB_HPP_