Abstract base class for managing serialized statistics. More...
#include <StatsSerializable.h>
Public Member Functions | |
StatsSerializable (uint16_t _id, uint8_t _group_count) | |
Constructor; creates a new object with an ID and a number of groups. More... | |
StatsSerializable (const StatsSerializable &other) | |
Copy constructor. More... | |
StatsSerializable & | operator= (const StatsSerializable &other) |
Assignment operator. More... | |
size_t | encoded_length () const |
Returns the encoded length of this object. More... | |
void | encode (uint8_t **bufp) const |
Encodes the statistics to a serialized buffer. More... | |
void | decode (const uint8_t **bufp, size_t *remainp) |
Deserializes this object from a buffer. More... | |
bool | operator== (const StatsSerializable &other) const |
Equal operator. More... | |
bool | operator!= (const StatsSerializable &other) const |
Not Equal operator. More... | |
Protected Types | |
enum | Identifier { SYSTEM = 1, RANGE = 2, TABLE = 3, RANGE_SERVER = 4 } |
Statistics identifer; assigned in constructor. More... | |
Protected Member Functions | |
virtual size_t | encoded_length_group (int group) const =0 |
Abstruct function returning the serialized length of a group. More... | |
virtual void | encode_group (int group, uint8_t **bufp) const =0 |
Abstruct function to serialize a group into a memory buffer. More... | |
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. More... | |
Protected Attributes | |
uint16_t | id |
The statistics ID. More... | |
uint8_t | group_count |
Number of groups in group_ids. More... | |
uint8_t | group_ids [32] |
The actual group IDs. More... | |
Abstract base class for managing serialized statistics.
A StatsSerializable has an ID and a number of groups (max. 32). Derived subclasses have to implement functions to serialize and unserialize these groups.
Definition at line 47 of file StatsSerializable.h.
StatsSerializable::StatsSerializable | ( | uint16_t | _id, |
uint8_t | _group_count | ||
) |
Constructor; creates a new object with an ID and a number of groups.
_id | The ID of this object; see Identifier |
_group_count | Number of statistical groups; must not exceed 32 |
Definition at line 33 of file StatsSerializable.cc.
StatsSerializable::StatsSerializable | ( | const StatsSerializable & | other | ) |
Copy constructor.
Definition at line 38 of file StatsSerializable.cc.
void StatsSerializable::decode | ( | const uint8_t ** | bufp, |
size_t * | remainp | ||
) |
Deserializes this object from a buffer.
Definition at line 77 of file StatsSerializable.cc.
|
protectedpure virtual |
Abstruct function to deserialize a group from a memory buffer.
group | The group id |
len | The size of the serialized group data |
bufp | Pointer to pointer to the serialized data |
remainp | Pointer to the remaining size |
Implemented in Hypertable::StatsSystem, Hypertable::StatsTable, and Hypertable::StatsRangeServer.
void StatsSerializable::encode | ( | uint8_t ** | bufp | ) | const |
Encodes the statistics to a serialized buffer.
Definition at line 60 of file StatsSerializable.cc.
|
protectedpure virtual |
Abstruct function to serialize a group into a memory buffer.
group | The group id |
bufp | Pointer to a pointer to the memory buffer |
Implemented in Hypertable::StatsSystem, Hypertable::StatsTable, and Hypertable::StatsRangeServer.
size_t StatsSerializable::encoded_length | ( | ) | const |
Returns the encoded length of this object.
Definition at line 51 of file StatsSerializable.cc.
|
protectedpure virtual |
Abstruct function returning the serialized length of a group.
group | The group id |
Implemented in Hypertable::StatsSystem, Hypertable::StatsTable, and Hypertable::StatsRangeServer.
|
inline |
Not Equal operator.
Definition at line 75 of file StatsSerializable.h.
StatsSerializable & StatsSerializable::operator= | ( | const StatsSerializable & | other | ) |
Assignment operator.
Definition at line 44 of file StatsSerializable.cc.
bool StatsSerializable::operator== | ( | const StatsSerializable & | other | ) | const |
Equal operator.
Definition at line 111 of file StatsSerializable.cc.
|
protected |
Number of groups in group_ids.
Definition at line 116 of file StatsSerializable.h.
|
protected |
The actual group IDs.
Definition at line 119 of file StatsSerializable.h.
|
protected |
The statistics ID.
Definition at line 113 of file StatsSerializable.h.