namespace saga { namespace messaging { enum state { Unknown = 0, New = 1, Open = 2, Closed = 3, Dropped = 4 }; class message : public saga::buffer { public: message (void); message (int size); message (void * data); message (saga::buffer buf, int size = -1); ~message (void); std::string get_sender (void); std::string get_id (void); }; class reliable_pubsub_endpoint : public saga::object , public saga::async , public saga::monitorable { // default properties for the reliable pubsub endpoint are: // Topology : PublishSubscriber // Reliability : Reliable, // Atomicity : ExactlyOnce, // Correctness : Verified, // Ordering : Unordered public: reliable_pubsub_endpoint (void); reliable_pubsub_endpoint (saga::object & obj); ~reliable_pubsub_endpoint (void); // inspection saga::url get_url (void); std::list get_receivers (void); // management methods void serve (int n_clients = -1); reliable_pubsub_endpoint serve_once (float timout = -1.0); void connect (float timout = -1.0); void disconnect (void); // I/O methods void send (message m, saga::url client = "", float timout = -1.0); int test (saga::url client = "", float timout = -1.0); message receive (saga::url client = "", float timout = -1.0) }; class unreliable_pubsub_endpoint ... class reliable_atomic_point2point_endpoint ... class reliable_atomic_point2point_endpoint ... class unreliable_point2point_endpoint ... ... } } ////////////////////////////////////////////////////////////////////// // // application example // class geometry { // ... }; class geometry_message : public saga::messaging::message { // define how the message is serialized into and deserialized from a message // buffer }; void mapper_to_renderer (geometry geom) { // Our set of specific endpoints does not offer any endpoint with the exact // properties we want, so we uses the closest match, which is the reliable // pubsub endpoint, which has Atomicity set to ExactlyOnce, instead of the // AtMostOnce we actually want. saga::messaging::reliable_pubsub_endpoint ep ("geom://remote.host.net:1234/renderer/"); geometry_message gm (geom); ep.send (gm); }