A client for the SmartREST protocol from Cumulocity.

Dependencies:   SmartRest

Fork of MbedSmartRest by Vincent Wochnik

Committer:
vwochnik
Date:
Sun Feb 02 14:55:57 2014 +0000
Revision:
8:762dc52db813
fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vwochnik 8:762dc52db813 1 /*
vwochnik 8:762dc52db813 2 * ParsedRecord.h
vwochnik 8:762dc52db813 3 *
vwochnik 8:762dc52db813 4 * Created on: Nov 1, 2013
vwochnik 8:762dc52db813 5 * * Authors: Vincent Wochnik <v.wochnik@gmail.com>
vwochnik 8:762dc52db813 6 *
vwochnik 8:762dc52db813 7 * Copyright (c) 2013 Cumulocity GmbH
vwochnik 8:762dc52db813 8 *
vwochnik 8:762dc52db813 9 * Permission is hereby granted, free of charge, to any person obtaining
vwochnik 8:762dc52db813 10 * a copy of this software and associated documentation files (the
vwochnik 8:762dc52db813 11 * "Software"), to deal in the Software without restriction, including
vwochnik 8:762dc52db813 12 * without limitation the rights to use, copy, modify, merge, publish,
vwochnik 8:762dc52db813 13 * distribute, sublicense, and/or sell copies of the Software, and to
vwochnik 8:762dc52db813 14 * permit persons to whom the Software is furnished to do so, subject to
vwochnik 8:762dc52db813 15 * the following conditions:
vwochnik 8:762dc52db813 16 *
vwochnik 8:762dc52db813 17 * The above copyright notice and this permission notice shall be
vwochnik 8:762dc52db813 18 * included in all copies or substantial portions of the Software.
vwochnik 8:762dc52db813 19 *
vwochnik 8:762dc52db813 20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
vwochnik 8:762dc52db813 21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
vwochnik 8:762dc52db813 22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
vwochnik 8:762dc52db813 23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
vwochnik 8:762dc52db813 24 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
vwochnik 8:762dc52db813 25 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
vwochnik 8:762dc52db813 26 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vwochnik 8:762dc52db813 27 */
vwochnik 8:762dc52db813 28
vwochnik 8:762dc52db813 29 #ifndef PARSEDRECORD_H
vwochnik 8:762dc52db813 30 #define PARSEDRECORD_H
vwochnik 8:762dc52db813 31
vwochnik 8:762dc52db813 32 #ifdef HAVE_CONFIG_H
vwochnik 8:762dc52db813 33 #include <config.h>
vwochnik 8:762dc52db813 34 #endif
vwochnik 8:762dc52db813 35
vwochnik 8:762dc52db813 36 #include "DataGenerator.h"
vwochnik 8:762dc52db813 37 #include "Record.h"
vwochnik 8:762dc52db813 38 #include "Value.h"
vwochnik 8:762dc52db813 39
vwochnik 8:762dc52db813 40 #ifndef PARSED_FIXED_SIZE
vwochnik 8:762dc52db813 41 #define PARSED_FIXED_SIZE 24
vwochnik 8:762dc52db813 42 #endif
vwochnik 8:762dc52db813 43
vwochnik 8:762dc52db813 44 class Parser;
vwochnik 8:762dc52db813 45
vwochnik 8:762dc52db813 46 /**
vwochnik 8:762dc52db813 47 * This value set collects values and serializes them.
vwochnik 8:762dc52db813 48 */
vwochnik 8:762dc52db813 49 class ParsedRecord : public Record
vwochnik 8:762dc52db813 50 {
vwochnik 8:762dc52db813 51 public:
vwochnik 8:762dc52db813 52 ParsedRecord();
vwochnik 8:762dc52db813 53 ~ParsedRecord();
vwochnik 8:762dc52db813 54
vwochnik 8:762dc52db813 55 size_t values() const;
vwochnik 8:762dc52db813 56 const Value& value(size_t index) const;
vwochnik 8:762dc52db813 57
vwochnik 8:762dc52db813 58 DataGenerator* copy() const;
vwochnik 8:762dc52db813 59
vwochnik 8:762dc52db813 60 private:
vwochnik 8:762dc52db813 61 void set(const char*, size_t);
vwochnik 8:762dc52db813 62
vwochnik 8:762dc52db813 63 private:
vwochnik 8:762dc52db813 64 const Value *_values[PARSED_FIXED_SIZE];
vwochnik 8:762dc52db813 65 size_t _count;
vwochnik 8:762dc52db813 66
vwochnik 8:762dc52db813 67 friend class Parser;
vwochnik 8:762dc52db813 68 };
vwochnik 8:762dc52db813 69
vwochnik 8:762dc52db813 70
vwochnik 8:762dc52db813 71 #endif