26 #ifndef Common_StatsSerializable_h
27 #define Common_StatsSerializable_h
66 void encode(uint8_t **bufp)
const;
69 void decode(
const uint8_t **bufp,
size_t *remainp);
76 return !(*
this == other);
100 virtual void encode_group(
int group, uint8_t **bufp)
const = 0;
109 virtual void decode_group(
int group, uint16_t len,
const uint8_t **bufp,
110 size_t *remainp) = 0;
126 #endif // Common_StatsSerializable_h
Abstract base class for managing serialized statistics.
StatsSerializable(uint16_t _id, uint8_t _group_count)
Constructor; creates a new object with an ID and a number of groups.
uint8_t group_count
Number of groups in group_ids.
virtual void decode_group(int group, uint16_t len, const uint8_t **bufp, size_t *remainp)=0
Abstruct function to deserialize a group from a memory buffer.
virtual void encode_group(int group, uint8_t **bufp) const =0
Abstruct function to serialize a group into a memory buffer.
size_t encoded_length() const
Returns the encoded length of this object.
bool operator!=(const StatsSerializable &other) const
Not Equal operator.
void decode(const uint8_t **bufp, size_t *remainp)
Deserializes this object from a buffer.
bool operator==(const StatsSerializable &other) const
Equal operator.
virtual size_t encoded_length_group(int group) const =0
Abstruct function returning the serialized length of a group.
StatsSerializable & operator=(const StatsSerializable &other)
Assignment operator.
uint16_t id
The statistics ID.
Identifier
Statistics identifer; assigned in constructor.
uint8_t group_ids[32]
The actual group IDs.
void encode(uint8_t **bufp) const
Encodes the statistics to a serialized buffer.