- // arbitrary: 8 for type, and 8 for amount
- double size = 16;
- if (type == LOAD)
- size += opt::comm_cost(amount);
- return size;
+ std::ostringstream oss;
+ switch (type) {
+ case message_type::CTRL:
+ oss << "CTRL: " << amount << " (info)";
+ if (opt::bookkeeping)
+ oss << "; " << credit << " (credit)";
+ break;
+ case message_type::DATA:
+ oss << "DATA: " << amount << " (load)";
+ break;
+ case message_type::CTRL_CLOSE:
+ oss << "CTRL_CLOSE";
+ break;
+ case message_type::DATA_CLOSE:
+ oss << "DATA_CLOSE";
+ break;
+ default:
+ oss << "UNKNOWN MESSAGE TYPE: " << static_cast<int>(type);
+ break;
+ }
+ return oss.str();