Generic SmartRest library
Dependents: SmartRestUnitTest MbedSmartRest MbedSmartRestStreaming
ComposedRecord.h
00001 /* 00002 * ComposedRecord.h 00003 * 00004 * Created on: Nov 1, 2013 00005 * * Authors: Vincent Wochnik <v.wochnik@gmail.com> 00006 * 00007 * Copyright (c) 2013 Cumulocity GmbH 00008 * 00009 * Permission is hereby granted, free of charge, to any person obtaining 00010 * a copy of this software and associated documentation files (the 00011 * "Software"), to deal in the Software without restriction, including 00012 * without limitation the rights to use, copy, modify, merge, publish, 00013 * distribute, sublicense, and/or sell copies of the Software, and to 00014 * permit persons to whom the Software is furnished to do so, subject to 00015 * the following conditions: 00016 * 00017 * The above copyright notice and this permission notice shall be 00018 * included in all copies or substantial portions of the Software. 00019 * 00020 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00021 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00022 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00023 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 00024 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 00025 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00026 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00027 */ 00028 00029 #ifndef COMPOSEDRECORD_H 00030 #define COMPOSEDRECORD_H 00031 00032 #ifdef HAVE_CONFIG_H 00033 #include <config.h> 00034 #endif 00035 00036 #include "DataGenerator.h" 00037 #include "Record.h" 00038 #include "Value.h" 00039 00040 #ifndef COMPOSED_INITIAL_CAPACITY 00041 #define COMPOSED_INITIAL_CAPACITY 10 00042 #endif 00043 #ifndef COMPOSED_MEMORY_INCREMENT 00044 #define COMPOSED_MEMORY_INCREMENT 5 00045 #endif 00046 //#define COMPOSED_FIXED_SIZE 25 00047 00048 /** 00049 * This value set collects values and serializes them. 00050 */ 00051 class ComposedRecord : public Record 00052 { 00053 public: 00054 ComposedRecord(bool=false); 00055 ~ComposedRecord(); 00056 00057 ComposedRecord& add(const Value&); 00058 void clear(); 00059 00060 size_t values() const; 00061 const Value& value(size_t index) const; 00062 00063 DataGenerator* copy() const; 00064 00065 private: 00066 #ifndef COMPOSED_FIXED_SIZE 00067 const Value **_values; 00068 size_t _capacity; 00069 #else 00070 Value *_values[COMPOSED_FIXED_SIZE]; 00071 #endif 00072 size_t _count; 00073 bool _alloc; 00074 }; 00075 00076 #endif
Generated on Wed Jul 13 2022 09:53:06 by 1.7.2