From 1a7c0ee65be1420590c0c350af9315f32c9b558d Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Thu, 27 Feb 2014 08:35:07 +0400 Subject: [PATCH] DataTypeDescriptor::MaxDataTypeID --- libuavcan/include/uavcan/internal/data_type.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libuavcan/include/uavcan/internal/data_type.hpp b/libuavcan/include/uavcan/internal/data_type.hpp index 49c1a79478..a11211064d 100644 --- a/libuavcan/include/uavcan/internal/data_type.hpp +++ b/libuavcan/include/uavcan/internal/data_type.hpp @@ -87,6 +87,8 @@ public: struct DataTypeDescriptor { + enum { MaxDataTypeID = Frame::MaxDataTypeID }; + DataTypeKind kind; uint16_t id; DataTypeSignature signature; @@ -101,7 +103,10 @@ struct DataTypeDescriptor : kind(kind) , id(id) , signature(signature) - { } + { + assert(id <= MaxDataTypeID); + assert(kind < NumDataTypeKinds); + } bool operator!=(const DataTypeDescriptor& rhs) const { return !operator==(rhs); } bool operator==(const DataTypeDescriptor& rhs) const