mbed.org implementation of the abstract SmartREST library for the Cumulocity Platform SmartREST protocol.
Dependents: MbedSmartRestMain MbedSmartRestMain
Diff: Aggregator.h
- Revision:
- 11:e1bee9a77652
- Parent:
- 6:cd7ba1ddb664
diff -r 97077cfa13fc -r e1bee9a77652 Aggregator.h --- a/Aggregator.h Thu Oct 23 14:41:58 2014 +0200 +++ b/Aggregator.h Sat Nov 15 11:21:01 2014 +0100 @@ -79,88 +79,88 @@ */ class Aggregator : public DataGenerator { -public: - #ifndef SMARTREST_AGGREGATOR_FIXED_SIZE - /** - * Creates a new Aggregator instance. - * @param capacity the initial capacity of the instance - * @param growing specifies the capability of this instance to grow - * @param managed specifies whether internal memory management shall be - * used. If true, all added records will be copied to - * the heap and freed accordingly. - */ - Aggregator(size_t = SMARTREST_AGGREGATOR_INITIAL_CAPACITY, bool = true, bool = false); - #else - /** - * Creates a new Aggregator instance. - * @param managed specifies whether internal memory management shall be - * used. If true, all added records will be copied to - * the heap and freed accordingly. - */ - Aggregator(bool = false); - #endif - ~Aggregator(); + public: +#ifndef SMARTREST_AGGREGATOR_FIXED_SIZE + /** + * Creates a new Aggregator instance. + * @param capacity the initial capacity of the instance + * @param growing specifies the capability of this instance to grow + * @param managed specifies whether internal memory management shall be + * used. If true, all added records will be copied to + * the heap and freed accordingly. + */ + Aggregator(size_t = SMARTREST_AGGREGATOR_INITIAL_CAPACITY, bool = true, bool = false); +#else + /** + * Creates a new Aggregator instance. + * @param managed specifies whether internal memory management shall be + * used. If true, all added records will be copied to + * the heap and freed accordingly. + */ + Aggregator(bool = false); +#endif + ~Aggregator(); - /** - * Adds a record to the aggregator. - * @param record the record to add - * @return true if added, false otherwise. - */ - bool add(const Record&); + /** + * Adds a record to the aggregator. + * @param record the record to add + * @return true if added, false otherwise. + */ + bool add(const Record&); - /** - * Retrieves the nth record from the aggregator. - * @param index the index of the nth element to retrieve - */ - const Record& get(size_t) const; + /** + * Retrieves the nth record from the aggregator. + * @param index the index of the nth element to retrieve + */ + const Record& get(size_t) const; - /** - * Clears the aggregator. The capacity will shrink to it's initial - * size. - */ - void clear(); + /** + * Clears the aggregator. The capacity will shrink to it's initial + * size. + */ + void clear(); - /** - * Returns the number of records aggregated by this instance. - * @return the number of records aggregated - */ - size_t length() const; + /** + * Returns the number of records aggregated by this instance. + * @return the number of records aggregated + */ + size_t length() const; - /** - * Returns whether the aggregator is full. If growing, this will - * always return false. - * @return whether the aggregator is full - */ - bool full() const; + /** + * Returns whether the aggregator is full. If growing, this will + * always return false. + * @return whether the aggregator is full + */ + bool full() const; - /** - * Returns the capacity of the aggregator. This will always return zero - * if the aggregator is growing. - */ - size_t capacity() const; + /** + * Returns the capacity of the aggregator. This will always return zero + * if the aggregator is growing. + */ + size_t capacity() const; - /** - * Returns whether this aggregator is using internal memory management. - * @return whether internal memory management is being used - */ - bool managed() const; + /** + * Returns whether this aggregator is using internal memory management. + * @return whether internal memory management is being used + */ + bool managed() const; - size_t writeTo(AbstractDataSink&) const; - size_t writtenLength() const; - Aggregator* copy() const; + size_t writeTo(AbstractDataSink&) const; + size_t writtenLength() const; + Aggregator* copy() const; -private: - #ifdef SMARTREST_AGGREGATOR_FIXED_SIZE - const Record *_list[SMARTREST_AGGREGATOR_FIXED_SIZE]; - #else - const Record **_list; - #endif - size_t _length; - #ifndef SMARTREST_AGGREGATOR_FIXED_SIZE - size_t _capacity, _initial; - bool _growing; - #endif - bool _managed; + private: +#ifdef SMARTREST_AGGREGATOR_FIXED_SIZE + const Record *_list[SMARTREST_AGGREGATOR_FIXED_SIZE]; +#else + const Record **_list; +#endif + size_t _length; +#ifndef SMARTREST_AGGREGATOR_FIXED_SIZE + size_t _capacity, _initial; + bool _growing; +#endif + bool _managed; }; #endif