A client for the SmartREST protocol from Cumulocity.

Dependencies:   SmartRest

Fork of MbedSmartRest by Vincent Wochnik

Committer:
vwochnik
Date:
Thu Jan 23 14:36:46 2014 +0000
Revision:
0:f76673e7f275
initial commit, only abstraction

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vwochnik 0:f76673e7f275 1 /*
vwochnik 0:f76673e7f275 2 * DataGenerator.h
vwochnik 0:f76673e7f275 3 *
vwochnik 0:f76673e7f275 4 * Created on: Nov 1, 2013
vwochnik 0:f76673e7f275 5 * * Authors: Vincent Wochnik <v.wochnik@gmail.com>
vwochnik 0:f76673e7f275 6 *
vwochnik 0:f76673e7f275 7 * Copyright (c) 2013 Cumulocity GmbH
vwochnik 0:f76673e7f275 8 *
vwochnik 0:f76673e7f275 9 * Permission is hereby granted, free of charge, to any person obtaining
vwochnik 0:f76673e7f275 10 * a copy of this software and associated documentation files (the
vwochnik 0:f76673e7f275 11 * "Software"), to deal in the Software without restriction, including
vwochnik 0:f76673e7f275 12 * without limitation the rights to use, copy, modify, merge, publish,
vwochnik 0:f76673e7f275 13 * distribute, sublicense, and/or sell copies of the Software, and to
vwochnik 0:f76673e7f275 14 * permit persons to whom the Software is furnished to do so, subject to
vwochnik 0:f76673e7f275 15 * the following conditions:
vwochnik 0:f76673e7f275 16 *
vwochnik 0:f76673e7f275 17 * The above copyright notice and this permission notice shall be
vwochnik 0:f76673e7f275 18 * included in all copies or substantial portions of the Software.
vwochnik 0:f76673e7f275 19 *
vwochnik 0:f76673e7f275 20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
vwochnik 0:f76673e7f275 21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
vwochnik 0:f76673e7f275 22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
vwochnik 0:f76673e7f275 23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
vwochnik 0:f76673e7f275 24 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
vwochnik 0:f76673e7f275 25 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
vwochnik 0:f76673e7f275 26 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vwochnik 0:f76673e7f275 27 */
vwochnik 0:f76673e7f275 28
vwochnik 0:f76673e7f275 29 #ifndef DATAGENERATOR_H
vwochnik 0:f76673e7f275 30 #define DATAGENERATOR_H
vwochnik 0:f76673e7f275 31
vwochnik 0:f76673e7f275 32 #include <stddef.h>
vwochnik 0:f76673e7f275 33 #include "AbstractDataSink.h"
vwochnik 0:f76673e7f275 34
vwochnik 0:f76673e7f275 35 /*
vwochnik 0:f76673e7f275 36 * The DataGenerator class provides a way to stream data to a
vwochnik 0:f76673e7f275 37 * connection..
vwochnik 0:f76673e7f275 38 */
vwochnik 0:f76673e7f275 39 class DataGenerator
vwochnik 0:f76673e7f275 40 {
vwochnik 0:f76673e7f275 41 public:
vwochnik 0:f76673e7f275 42 virtual ~DataGenerator()
vwochnik 0:f76673e7f275 43 {
vwochnik 0:f76673e7f275 44 }
vwochnik 0:f76673e7f275 45
vwochnik 0:f76673e7f275 46 /**
vwochnik 0:f76673e7f275 47 * Writes the object to the specified destination.
vwochnik 0:f76673e7f275 48 * @param s the destination
vwochnik 0:f76673e7f275 49 * @return the number of bytes written
vwochnik 0:f76673e7f275 50 */
vwochnik 0:f76673e7f275 51 virtual size_t writeTo(AbstractDataSink&) const = 0;
vwochnik 0:f76673e7f275 52
vwochnik 0:f76673e7f275 53 /**
vwochnik 0:f76673e7f275 54 * Returns the estimated number of bytes which will be written.
vwochnik 0:f76673e7f275 55 * @return the estimated number of bytes printed
vwochnik 0:f76673e7f275 56 */
vwochnik 0:f76673e7f275 57 virtual size_t writtenLength() const = 0;
vwochnik 0:f76673e7f275 58
vwochnik 0:f76673e7f275 59 /**
vwochnik 0:f76673e7f275 60 * Creates a clone on the heap with no dependent stack variables.
vwochnik 0:f76673e7f275 61 * All external data has to be copied aswell.
vwochnik 0:f76673e7f275 62 * @return cloned object with no memory dependencies
vwochnik 0:f76673e7f275 63 */
vwochnik 0:f76673e7f275 64 virtual DataGenerator* copy() const = 0;
vwochnik 0:f76673e7f275 65 };
vwochnik 0:f76673e7f275 66
vwochnik 0:f76673e7f275 67 #endif