+message::message(message_type t, double a, double c)
+ : type(t), amount(a) , credit(c)
+{
+ // compute message size
+ // arbitrary: 8 for type, and 8 for each double
+ switch (type) {
+ case message_type::CTRL:
+ size = opt::bookkeeping ? 24 : 16; // type + amount + (credit)?
+ break;
+ case message_type::DATA:
+ size = 16 + opt::comm_cost(amount); // type + amount + data size
+ break;
+ default:
+ size = 8; // type
+ break;
+ }
+}
+