1 // Asynchronous communicator
12 enum message_type { INFO, CREDIT, LOAD, CTRL_CLOSE, DATA_CLOSE };
14 message(message_type t, double a): type(t), amount(a) { }
16 message_type get_type() const { return type; }
17 double get_amount() const { return amount; }
29 void send(const char* dest, message* msg);
30 bool recv(message*& msg, m_host_t& from, bool wait);
33 void next_close_on_ctrl_is_last();
34 void next_close_on_data_is_last();
39 // List of pending send communications
40 std::list<msg_comm_t> sent_comm;
42 // Control channel for receiving
43 std::string ctrl_mbox;
46 bool ctrl_close_is_last;
48 // Data channel for receiving
49 std::string data_mbox;
52 bool data_close_is_last;
54 const char* get_ctrl_mbox() const { return ctrl_mbox.c_str(); }
55 const char* get_data_mbox() const { return data_mbox.c_str(); }
56 static bool comm_test_n_destroy(msg_comm_t& comm);
60 #endif // !COMMUNICATOR_H