Generic SmartRest library

Dependents:   SmartRestUnitTest MbedSmartRest MbedSmartRestStreaming

Embed: (wiki syntax)

« Back to documentation index

Aggregator Class Reference

Aggregator Class Reference

An aggregator of data generators. More...

#include <Aggregator.h>

Inherits DataGenerator.

Public Member Functions

 Aggregator (size_t=AGGREGATOR_INITIAL_CAPACITY, bool=true, bool=false)
 Creates a new Aggregator instance.
 Aggregator (bool=false)
 Creates a new Aggregator instance.
bool add (const DataGenerator &)
 Adds a data generator to the aggregator.
void clear ()
 Clears the aggregator.
size_t length ()
 Returns the number of data generators aggregated by this instance.
bool full ()
 Returns whether the aggregator is full.
size_t capacity ()
 Returns the capacity of the aggregator.

Detailed Description

An aggregator of data generators.

This class can aggregate instances of itself. If the aggregator is set to copying all added data generators using the copy() method, all objects are being properly deallocated on destruction.

Definition at line 54 of file Aggregator.h.


Constructor & Destructor Documentation

Aggregator ( size_t  capacity = AGGREGATOR_INITIAL_CAPACITY,
bool  growing = true,
bool  copy = false 
)

Creates a new Aggregator instance.

Parameters:
capacitythe initial capacity of the instance
growingspecifies the capability of this instance to grow
copyspecifies whether all added data generators shall be copied using the copy() method

Definition at line 33 of file Aggregator.cpp.

Aggregator ( bool  copy = false )

Creates a new Aggregator instance.

Parameters:
copyspecifies whether all added data generators shall be copied using the copy() method

Definition at line 42 of file Aggregator.cpp.


Member Function Documentation

bool add ( const DataGenerator &  generator )

Adds a data generator to the aggregator.

Parameters:
generatorthe data generator to add
Returns:
true if added, false otherwise.

Definition at line 60 of file Aggregator.cpp.

size_t capacity (  )

Returns the capacity of the aggregator.

This will always return zero if the aggregator is growing.

Definition at line 127 of file Aggregator.cpp.

void clear (  )

Clears the aggregator.

The capacity will shrink to it's initial size.

Definition at line 93 of file Aggregator.cpp.

bool full (  )

Returns whether the aggregator is full.

If growing, this will always return false.

Returns:
whether the aggregator is full

Definition at line 118 of file Aggregator.cpp.

size_t length (  )

Returns the number of data generators aggregated by this instance.

Returns:
the number of data generators aggregated

Definition at line 113 of file Aggregator.cpp.