ADD: Message container and Join Message
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user