Realistic 3D camera system
3D camera system components
Public Member Functions | List of all members
message_callback Struct Referenceabstract

#include <message_host.h>

Public Member Functions

virtual void message_recieved (message_client message)=0
 

Detailed Description

File: message_host.h Author: Martin Kjellqvist marti.nosp@m.n.kj.nosp@m.ellqv.nosp@m.ist@.nosp@m.miun..nosp@m.se

Created on May 7, 2017, 7:38 PM

Considering doing blocking reads to avoid having to deal with races on the camera clients.

The desired API should be used something like

User:

void on_create_message_host(){
  message_host host(port, callback_object_on_connect);
}
// Who is the owner of message_client?
// I'm thinking message_host + weak_ptr to clients.
// the lifetime of clients will not outlive the host.
void callback_on_connect(std::weak_ptr<message_client> client){
    client->set_message_recieved_handler(callback_object_on_message_recieved);
    // async
    client->post("Hello");
    //sync
    client->send("World");
}

void callback_on_message_recieved(std::weak_ptr<message_client> client, const string& message){
   // recieved message
   client->send("I got " + message + ", thank you!");
}

$Id$

Definition at line 44 of file message_host.h.

Member Function Documentation

virtual void message_callback::message_recieved ( message_client  message)
pure virtual

The documentation for this struct was generated from the following file: