Refactoring: Frame Index field size increased, Trnasfer ID field size reduced. NodeID class added, Frame class rewritten with stricter runtime checks. All tests were updated accordingly.

This commit is contained in:
Pavel Kirienko
2014-02-17 12:35:12 +04:00
parent 20778f1acb
commit 697a55aebb
18 changed files with 544 additions and 489 deletions
@@ -32,22 +32,20 @@ public:
*/
class TransferBufferManagerKey
{
uint8_t node_id_;
NodeID node_id_;
uint8_t transfer_type_;
public:
TransferBufferManagerKey()
: node_id_(NODE_ID_INVALID)
, transfer_type_(TransferType(0))
: transfer_type_(TransferType(0))
{
assert(isEmpty());
}
TransferBufferManagerKey(uint8_t node_id, TransferType ttype)
TransferBufferManagerKey(NodeID node_id, TransferType ttype)
: node_id_(node_id)
, transfer_type_(ttype)
{
assert(node_id <= NODE_ID_MAX && node_id != NODE_ID_INVALID);
assert(!isEmpty());
}
@@ -56,9 +54,9 @@ public:
return node_id_ == rhs.node_id_ && transfer_type_ == rhs.transfer_type_;
}
bool isEmpty() const { return node_id_ == NODE_ID_INVALID; }
bool isEmpty() const { return !node_id_.isValid(); }
uint8_t getNodeID() const { return node_id_; }
NodeID getNodeID() const { return node_id_; }
TransferType getTransferType() const { return TransferType(transfer_type_); }
std::string toString() const;