eRPC Generator (erpcgen)  Rev. 1.5.0
NXP Semiconductors
SizedIntegerValue Class Reference

Adds a word size attribute to IntegerValue. More...

#include <Value.h>

Inheritance diagram for SizedIntegerValue:
IntegerValue Value

Public Types

enum  int_size_t {
  kWordSize,
  kHalfWordSize,
  kByteSize
}
 Supported sizes of integers. More...
 

Public Member Functions

 SizedIntegerValue (uint32_t value, int_size_t size=kWordSize)
 
 SizedIntegerValue (uint16_t value)
 
 SizedIntegerValue (uint8_t value)
 
 SizedIntegerValue (const SizedIntegerValue &other)
 
virtual std::string getTypeName () const
 
virtual size_t getSize () const
 
int_size_t getWordSize () const
 
void setWordSize (int_size_t size)
 
uint32_t getWordSizeMask () const
 Returns a 32-bit mask value dependant on the word size attribute. More...
 
virtual Value * clone () const
 
Assignment operators

These operators set the word size as well as the integer value.

SizedIntegerValue & operator= (uint8_t value)
 
SizedIntegerValue & operator= (uint16_t value)
 
SizedIntegerValue & operator= (uint32_t value)
 
- Public Member Functions inherited from IntegerValue
 IntegerValue (int32_t value)
 
 IntegerValue (const IntegerValue &other)
 
int32_t getValue () const
 
 operator int32_t () const
 
IntegerValue & operator= (int32_t value)
 
virtual std::string toString () const
 
- Public Member Functions inherited from Value
 Value (value_type_t theType)
 
virtual value_type_t getType () const
 

Protected Attributes

int_size_t m_size
 Size of the integer.
 
- Protected Attributes inherited from IntegerValue
int32_t m_value
 The integer value.
 

Detailed Description

Adds a word size attribute to IntegerValue.

The word size really only acts as an attribute that is carried along with the integer value. It doesn't affect the actual value at all. However, you can use the getWordSizeMask() method to mask off bits that should not be there.

The word size defaults to a 32-bit word.

Member Enumeration Documentation

Supported sizes of integers.

Enumerator
kWordSize 

32-bit word.

kHalfWordSize 

16-bit half word.

kByteSize 

8-bit byte.

Member Function Documentation

size_t SizedIntegerValue::getSize ( ) const
virtual

Returns a varying size depending on the word size attribute.

Reimplemented from IntegerValue.

uint32_t SizedIntegerValue::getWordSizeMask ( ) const

Returns a 32-bit mask value dependant on the word size attribute.

The resulting mask can be used to truncate the integer value to be certain it doesn't extend beyond the associated word size.


The documentation for this class was generated from the following files: