17 #ifndef EVENTMANAGER_HPP_
18 #define EVENTMANAGER_HPP_
29 #include "kaa/gen/EndpointGen.hpp"
40 class IExecutorContext;
49 : context_(context), currentEventIndex_(0),eventTransport_(nullptr)
56 ,
const std::vector<std::uint8_t>& data
57 ,
const std::string& target
87 struct EventListenersInfo {
88 std::list<std::string> eventFQNs_;
92 void onEventFromServer(
const std::string& eventClassFQN
93 ,
const std::vector<std::uint8_t>& data
94 ,
const std::string& source);
96 void generateUniqueRequestId(std::string& requstId);
101 IKaaClientContext &context_;
103 std::set<IEventFamily*> eventFamilies_;
104 std::map<std::int32_t, Event> pendingEvents_;
105 KAA_MUTEX_MUTABLE_DECLARE(pendingEventsGuard_);
107 std::int32_t currentEventIndex_;
109 EventTransport * eventTransport_;
111 std::map<std::int32_t, std::shared_ptr<EventListenersInfo> > eventListenersRequests_;
112 KAA_MUTEX_MUTABLE_DECLARE(eventListenersGuard_);
virtual void setTransport(EventTransport *transport)
virtual std::map< std::int32_t, std::list< std::string > > getPendingListenerRequests()
virtual bool hasPendingListenerRequests() const
virtual void produceEvent(const std::string &fqn, const std::vector< std::uint8_t > &data, const std::string &target, TransactionIdPtr trxId)
std::shared_ptr< TransactionId > TransactionIdPtr
virtual TransactionIdPtr beginTransaction(IKaaClientContext &context_)
virtual void commit(TransactionIdPtr trxId, IKaaClientContext &context_)
virtual std::map< std::int32_t, Event > releasePendingEvents()
virtual void rollback(TransactionIdPtr trxId, IKaaClientContext &context_)
virtual void registerEventFamily(IEventFamily *eventFamily)
virtual void onEventsReceived(const EventSyncResponse::events_t &events)
virtual std::int32_t findEventListeners(const std::list< std::string > &eventFQNs, IFetchEventListenersPtr listener)
EventManager(IKaaClientContext &context)
virtual TransactionIdPtr beginTransaction()
std::shared_ptr< IFetchEventListeners > IFetchEventListenersPtr
virtual bool hasPendingEvents() const
virtual void rollback(TransactionIdPtr trxId)
virtual void onEventListenersReceived(const EventSyncResponse::eventListenersResponses_t &listeners)