OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
GenericDataStructVector.h
Go to the documentation of this file.
1#pragma once
2#include <stdint.h>
3
4#include "GenericDataStruct.h"
5#include "Variable.h"
6
7namespace ot
8{
9 class __declspec(dllexport) GenericDataStructVector : public GenericDataStruct
10 {
11
12 public:
13 GenericDataStructVector();
14 GenericDataStructVector(const GenericDataStructVector& _other);
15 GenericDataStructVector(GenericDataStructVector&& _other) noexcept;
16
17 GenericDataStructVector(const std::vector<ot::Variable>& _values);
18 GenericDataStructVector(std::vector<ot::Variable>&& _values) noexcept;
19 GenericDataStructVector(uint32_t _numberOfEntries);
20
21 GenericDataStructVector& operator=(const GenericDataStructVector& _other) = default;
22 GenericDataStructVector& operator=(GenericDataStructVector&& _other) noexcept = default;
23
24 ot::Variable getValue(uint32_t _index) { assert(_index < m_numberOfEntries); return m_values[_index]; };
25 const std::vector<ot::Variable>& getValues() const { return m_values; }
26
27 void setValue(uint32_t _index, const ot::Variable& _value);
28 void setValue(uint32_t _index, ot::Variable&& _value);
29 void setValues(const std::vector<ot::Variable>& _values);
30 void setValues(std::vector<ot::Variable>&& _values);
31
32 virtual void addToJsonObject(ot::JsonValue& _object, ot::JsonAllocator& _allocator) const override;
33 virtual void setFromJsonObject(const ot::ConstJsonObject& _object) override;
34
35 static std::string getClassName() { return "GenericDataStructVector"; }
36 private:
37 std::vector<ot::Variable> m_values;
38
39 void allocateValueMemory();
40 };
41}
Definition Variable.h:107
Definition Connector.h:8
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::GenericObject< true, rapidjson::GenericValue< rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > > > ConstJsonObject
Read only JSON Object.
Definition JSON.h:35
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30