9 #include "../framework/bridgetask.h"
33 const std::string &msg) = 0;
52 double start()
override;
60 while (!incoming_messages.empty()) {
61 std::string msg = incoming_messages.front();
62 incoming_messages.pop_front();
63 log() <<
"sendMsgToAgent " << msg;
68 std::deque<std::string> incoming_messages;
Tasks may use a bridge to communicate with an application running outside the event loop.
Definition: bridgetask.h:43
void sendMsgToAgent(const std::string &msg)
Send message to the agent.
Definition: bridgetask.h:128
BridgeTask(Task *agent=nullptr)
Create a bridge to the given agent task.
Definition: bridgetask.h:51
std::ostream & log() const
Write a line of info log.
Definition: logger.h:328
A bridge that "owns" the client.
Definition: synchronousbridge.h:44
void sendMsgToClient(const std::string &msg) override
Will call the client's SynchronousClient::newEventFromAgent method.
Definition: synchronousbridge.cpp:23
double start() override
See Task::start.
Definition: synchronousbridge.cpp:12
Client that only exists (or, rather, executes code) from within the bridge.
Definition: synchronousbridge.h:17
virtual void newEventFromAgent(std::deque< std::string > &return_msgs, const std::string &msg)=0
Retrieve a new message from the agent.
virtual void initialMsgToAgent(std::deque< std::string > &return_msgs)
Send initial messages to the agent.
Definition: synchronousbridge.cpp:8
The purpose of a task is to manage socket connections, and/or to execute timers.
Definition: task.h:39