HiveMind
BittyBuzzMessageService.h
Go to the documentation of this file.
1 #ifndef __BITTYBUZZMESSAGESERVICE_H_
2 #define __BITTYBUZZMESSAGESERVICE_H_
3 
5 #include <bbzmsg.h>
6 #include <bsp/IBSP.h>
7 #include <cpp-common/ICircularQueue.h>
8 #include <logger/ILogger.h>
9 
11  public:
12  BittyBuzzMessageService(ICircularQueue<MessageDTO>& hostQueue,
13  ICircularQueue<MessageDTO>& remoteQueue,
14  ICircularQueue<MessageDTO>& buzzQueue,
15  IBSP& bsp,
16  ILogger& logger);
17 
18  ~BittyBuzzMessageService() override = default;
19 
20  bool callHostFunction(uint16_t agentId,
21  const char* functionName,
22  const FunctionCallArgumentDTO* args,
23  uint16_t argsLength) override;
24 
25  bool callBuzzFunction(uint16_t agentId,
26  const char* functionName,
27  const FunctionCallArgumentDTO* args,
28  uint16_t argsLength) override;
29 
30  bool queueBuzzMessages() override;
31 
32  private:
33  std::optional<std::reference_wrapper<BuzzMessageDTO>> getNextMessage();
34  bool flush();
35 
36  ICircularQueue<MessageDTO>& m_hostQueue;
37  ICircularQueue<MessageDTO>& m_remoteQueue;
38  ICircularQueue<MessageDTO>& m_buzzQueue;
39  BuzzMessagesDTO m_messages;
42 };
43 
44 #endif // __BITTYBUZZMESSAGESERVICE_H_
BittyBuzzMessageService::~BittyBuzzMessageService
~BittyBuzzMessageService() override=default
IBittyBuzzMessageService.h
IBSP.h
BittyBuzzMessageService::queueBuzzMessages
bool queueBuzzMessages() override
queues the buzz messages
Definition: BittyBuzzMessageService.cpp:66
BittyBuzzMessageService::m_remoteQueue
ICircularQueue< MessageDTO > & m_remoteQueue
Definition: BittyBuzzMessageService.h:37
BittyBuzzMessageService::BittyBuzzMessageService
BittyBuzzMessageService(ICircularQueue< MessageDTO > &hostQueue, ICircularQueue< MessageDTO > &remoteQueue, ICircularQueue< MessageDTO > &buzzQueue, IBSP &bsp, ILogger &logger)
Definition: BittyBuzzMessageService.cpp:6
BittyBuzzMessageService
Definition: BittyBuzzMessageService.h:10
BittyBuzzMessageService::m_bsp
IBSP & m_bsp
Definition: BittyBuzzMessageService.h:40
BittyBuzzMessageService::m_logger
ILogger & m_logger
Definition: BittyBuzzMessageService.h:41
IBSP
Definition: IBSP.h:6
ILogger
A logger class with basic logging capabilities.
Definition: ILogger.h:35
BittyBuzzMessageService::flush
bool flush()
Definition: BittyBuzzMessageService.cpp:105
BittyBuzzMessageService::callBuzzFunction
bool callBuzzFunction(uint16_t agentId, const char *functionName, const FunctionCallArgumentDTO *args, uint16_t argsLength) override
call a function to a buzz vm
Definition: BittyBuzzMessageService.cpp:42
BittyBuzzMessageService::m_hostQueue
ICircularQueue< MessageDTO > & m_hostQueue
Definition: BittyBuzzMessageService.h:36
BittyBuzzMessageService::m_messages
BuzzMessagesDTO m_messages
Definition: BittyBuzzMessageService.h:39
IBittyBuzzMessageService
message service use by the BBVM. Constructs the messages and dispatches it at the appropriate place (...
Definition: IBittyBuzzMessageService.h:9
BittyBuzzMessageService::callHostFunction
bool callHostFunction(uint16_t agentId, const char *functionName, const FunctionCallArgumentDTO *args, uint16_t argsLength) override
call a function to a host
Definition: BittyBuzzMessageService.cpp:17
BittyBuzzMessageService::getNextMessage
std::optional< std::reference_wrapper< BuzzMessageDTO > > getNextMessage()
Definition: BittyBuzzMessageService.cpp:91
BittyBuzzMessageService::m_buzzQueue
ICircularQueue< MessageDTO > & m_buzzQueue
Definition: BittyBuzzMessageService.h:38
ILogger.h