libcyphal icon indicating copy to clipboard operation
libcyphal copied to clipboard

Require NodeID to always contain a valid value

Open pavel-kirienko opened this issue 6 years ago • 0 comments

This is related to type safety; the same principle should be followed wherever applicable.

Objects of NodeID must always contain a valid value of node ID, which is an integer from 0 to 127, inclusive. The validness should be checked in the constructor with an assertion check. There should be no default constructor.

There may exist places where an invalid node ID is required. In that case, std::optional<NodeID> should be used (or a custom replacement if C++17 is not supported).

pavel-kirienko avatar Nov 19 '18 10:11 pavel-kirienko