#include <string>
#include <msg/msg.h>
#include "synchro.h"
+#include "sync_queue.h"
class message {
public:
- enum message_type { INFO, CREDIT, LOAD, CTRL_CLOSE, DATA_CLOSE };
+ enum message_type { CTRL, DATA, CTRL_CLOSE, DATA_CLOSE };
- message(message_type t, double a): type(t), amount(a) { }
+ message(message_type t, double a, double c = 0.0);
message_type get_type() const { return type; }
double get_amount() const { return amount; }
- double get_size() const;
+ double get_credit() const { return credit; }
+ double get_size() const { return size; }
std::string to_string();
private:
message_type type;
double amount;
+ double credit;
+ double size;
};
class message_queue {
private:
mutex_t mutex;
condition_t cond;
- std::queue<m_task_t> queue;
+ sync_queue<m_task_t> queue;
};
#endif // !MESSAGES_H