0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Hypertable::StatsSerializable Class Referenceabstract

Abstract base class for managing serialized statistics. More...

#include <StatsSerializable.h>

Inheritance diagram for Hypertable::StatsSerializable:
Inheritance graph
[legend]

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...
 
StatsSerializableoperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

StatsSerializable::StatsSerializable ( uint16_t  _id,
uint8_t  _group_count 
)

Constructor; creates a new object with an ID and a number of groups.

Parameters
_idThe ID of this object; see Identifier
_group_countNumber 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.

Member Function Documentation

void StatsSerializable::decode ( const uint8_t **  bufp,
size_t *  remainp 
)

Deserializes this object from a buffer.

Definition at line 77 of file StatsSerializable.cc.

virtual void Hypertable::StatsSerializable::decode_group ( int  group,
uint16_t  len,
const uint8_t **  bufp,
size_t *  remainp 
)
protectedpure virtual

Abstruct function to deserialize a group from a memory buffer.

Parameters
groupThe group id
lenThe size of the serialized group data
bufpPointer to pointer to the serialized data
remainpPointer 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.

virtual void Hypertable::StatsSerializable::encode_group ( int  group,
uint8_t **  bufp 
) const
protectedpure virtual

Abstruct function to serialize a group into a memory buffer.

Parameters
groupThe group id
bufpPointer 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.

virtual size_t Hypertable::StatsSerializable::encoded_length_group ( int  group) const
protectedpure virtual

Abstruct function returning the serialized length of a group.

Parameters
groupThe group id
Returns
The size of the serialized group, in bytes

Implemented in Hypertable::StatsSystem, Hypertable::StatsTable, and Hypertable::StatsRangeServer.

bool Hypertable::StatsSerializable::operator!= ( const StatsSerializable other) const
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.

Member Data Documentation

uint8_t Hypertable::StatsSerializable::group_count
protected

Number of groups in group_ids.

Definition at line 116 of file StatsSerializable.h.

uint8_t Hypertable::StatsSerializable::group_ids[32]
protected

The actual group IDs.

Definition at line 119 of file StatsSerializable.h.

uint16_t Hypertable::StatsSerializable::id
protected

The statistics ID.

Definition at line 113 of file StatsSerializable.h.


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