}
/**
- * @brief The element access operator to provide access syntax like regular
- * arrays.
+ * @brief Array Subscript Operator.
+ *
+ * The element access operator to provide access syntax like regular
+ * arrays. This version is used when this object is constant.
+ *
+ * @return A non-modifiable reference to the object indexed by the offset.
*/
const uint8_t& MessagePayload::operator[]( size_t offset ) const
{
}
/**
- * @brief The element access operator to provide access syntax like regular
- * arrays.
+ * @brief Array Subscript Operator.
+ *
+ * The element access operator to provide access syntax like regular
+ * arrays. This version is used by non-const objects.
+ *
+ * @return A modifiable reference to the object indexed by the offset.
*/
uint8_t& MessagePayload::operator[]( size_t offset )
{
* @param right_byte the index of the right byte
*
* @return a concatenation of the byte indexed by left_byte with the byte
- * indexed by right_byte
+ * indexed by right_byte.
*/
uint16_t MessagePayload::decode16(
const int left_byte,
BOOST_ASSERT( ( 0 <= left_byte ) && ( left_byte < static_cast<int>(PayloadSizeInBytes) ) );
BOOST_ASSERT( ( 0 <= right_byte ) && ( right_byte < static_cast<int>(PayloadSizeInBytes) ) );
BOOST_ASSERT( left_byte < right_byte );
- BOOST_ASSERT( ( right_byte - left_byte ) == sizeof(uint16_t) );
+ BOOST_ASSERT( ( ( right_byte - left_byte ) + 1 ) == sizeof(uint16_t) );
uint32_t value = static_cast<uint16_t>( Payload[ left_byte ] << 8 );
value += static_cast<uint16_t>( Payload[ right_byte ] );
const uint16_t value
)
{
- BOOST_ASSERT( ( 0 < left_byte ) && ( left_byte < static_cast<int>(PayloadSizeInBytes) ) );
- BOOST_ASSERT( ( 0 < right_byte ) && ( right_byte < static_cast<int>(PayloadSizeInBytes) ) );
+ BOOST_ASSERT( ( 0 <= left_byte ) && ( left_byte < static_cast<int>(PayloadSizeInBytes) ) );
+ BOOST_ASSERT( ( 0 <= right_byte ) && ( right_byte < static_cast<int>(PayloadSizeInBytes) ) );
BOOST_ASSERT( left_byte < right_byte );
- BOOST_ASSERT( ( right_byte - left_byte ) == sizeof(uint16_t) );
+ BOOST_ASSERT( ( ( right_byte - left_byte ) + 1 ) == sizeof(uint16_t) );
Payload[ left_byte ] = static_cast<uint8_t>( value >> 8 );
Payload[ right_byte ] = static_cast<uint8_t>( value & 0xFF );
BOOST_ASSERT( ( 0 <= first_byte ) && ( first_byte < static_cast<int>(PayloadSizeInBytes) ) );
BOOST_ASSERT( ( 0 <= last_byte ) && ( last_byte < static_cast<int>(PayloadSizeInBytes) ) );
BOOST_ASSERT( first_byte < last_byte );
- BOOST_ASSERT( ( last_byte - first_byte ) == sizeof(uint32_t) );
+ BOOST_ASSERT( ( ( last_byte - first_byte ) + 1 ) == sizeof(uint32_t) );
int current_byte = first_byte;
BOOST_ASSERT( ( 0 < first_byte ) && ( first_byte < static_cast<int>(PayloadSizeInBytes) ) );
BOOST_ASSERT( ( 0 < last_byte ) && ( last_byte < static_cast<int>(PayloadSizeInBytes) ) );
BOOST_ASSERT( first_byte < last_byte );
- BOOST_ASSERT( ( last_byte - first_byte ) == sizeof(uint32_t) );
+ BOOST_ASSERT( ( ( last_byte - first_byte ) + 1 ) == sizeof(uint32_t) );
int current_byte = first_byte;