ADD: Message container and Join Message

This commit is contained in:
Henry Winkel
2022-11-11 14:36:57 +01:00
parent 2d077f4ff4
commit 3006f79883
13 changed files with 545 additions and 23 deletions

View File

@@ -15,5 +15,59 @@
*/
namespace WHISPER
{
void whispercomm::connect(std::shared_ptr<threadSafeQueue<std::string>> receiver)
{
this->receiveQueue = receiver;
this->derivedConnect();
receiveThread = std::thread(&WHISPER::whispercomm::receive,this);
}
void whispercomm::disconnect()
{
}
void whispercomm::publish(std::string msg){
this->derivedPublish(msg);
}
void whispercomm::receive(){
this->derivedReceive();
connected = true;
while(!stopReceiveThread)
{
derivedReceive();
}
}
void whispercomm::subscribe(std::string topic)
{
this->subscribedTopics.push_back(topic);
}
void whispercomm::unsubscribe(std::string topic)
{
for (std::vector<std::string>::iterator it = subscribedTopics.begin(); it != subscribedTopics.end();it++)
{
if (*it == topic)
{
it = subscribedTopics.erase(it);
}
}
}
void whispercomm::addMsgToReceiverQueue(std::string)
{
}
// Add datatypes here
} // namespace WHISPER