Zserio C++17 runtime library  0.5.0
Built for Zserio 2.17.0
IIntrospectableData.h
Go to the documentation of this file.
1 #ifndef ZSERIO_I_INTROSPECTABLE_DATA_INC
2 #define ZSERIO_I_INTROSPECTABLE_DATA_INC
3 
4 #include <memory>
5 #include <string_view>
6 
7 #include "zserio/Any.h"
8 #include "zserio/BitBuffer.h"
10 #include "zserio/Bytes.h"
11 #include "zserio/RebindAlloc.h"
12 
13 namespace zserio
14 {
15 
16 // Necessary to break cyclic dependency, ITypeInfo header must include IReflectableData header as well!
17 template <typename ALLOC>
18 class IBasicTypeInfo;
19 
26 template <typename I, typename ALLOC = std::allocator<uint8_t>>
28 {
29 public:
31  using ConstPtr = std::shared_ptr<const I>;
32 
36  virtual ~IIntrospectableData() = default;
37 
43  virtual const IBasicTypeInfo<ALLOC>& getTypeInfo() const = 0;
44 
50  virtual bool isArray() const = 0;
51 
64  virtual ConstPtr getField(std::string_view name) const = 0;
65 
75  virtual std::string_view getChoice() const = 0;
76 
86  virtual size_t size() const = 0;
87 
98  virtual ConstPtr at(size_t index) const = 0;
99 
105  virtual ConstPtr operator[](size_t index) const = 0;
106 
124  virtual BasicAny<ALLOC> getAnyValue(const ALLOC& allocator) const = 0;
125  virtual BasicAny<ALLOC> getAnyValue() const = 0;
134  virtual bool getBool() const = 0;
135 
142  virtual int8_t getInt8() const = 0;
143 
150  virtual int16_t getInt16() const = 0;
151 
158  virtual int32_t getInt32() const = 0;
159 
166  virtual int64_t getInt64() const = 0;
167 
174  virtual uint8_t getUInt8() const = 0;
175 
182  virtual uint16_t getUInt16() const = 0;
183 
190  virtual uint32_t getUInt32() const = 0;
191 
198  virtual uint64_t getUInt64() const = 0;
199 
206  virtual float getFloat() const = 0;
207 
214  virtual double getDouble() const = 0;
215 
222  virtual BytesView getBytes() const = 0;
223 
230  virtual std::string_view getStringView() const = 0;
231 
238  virtual const BasicBitBuffer<ALLOC>& getBitBuffer() const = 0; // TODO[Mi-L@]: return BitBufferView?
239 
248  virtual int64_t toInt() const = 0;
249 
259  virtual uint64_t toUInt() const = 0;
260 
269  virtual double toDouble() const = 0;
270 
285  virtual BasicString<RebindAlloc<ALLOC, char>> toString(const ALLOC& allocator) const = 0;
306  virtual ConstPtr find(std::string_view path) const = 0;
307 
313  virtual ConstPtr operator[](std::string_view path) const = 0;
314 };
315 
316 } // namespace zserio
317 
318 #endif // ZSERIO_I_INTROSPECTABLE_DATA_INC
virtual std::string_view getStringView() const =0
virtual int32_t getInt32() const =0
virtual uint8_t getUInt8() const =0
std::shared_ptr< const I > ConstPtr
virtual float getFloat() const =0
virtual int8_t getInt8() const =0
virtual bool isArray() const =0
virtual double getDouble() const =0
virtual size_t size() const =0
virtual const IBasicTypeInfo< ALLOC > & getTypeInfo() const =0
virtual BytesView getBytes() const =0
virtual int64_t toInt() const =0
virtual BasicString< RebindAlloc< ALLOC, char > > toString(const ALLOC &allocator) const =0
virtual uint64_t toUInt() const =0
virtual BasicString< RebindAlloc< ALLOC, char > > toString() const =0
virtual uint32_t getUInt32() const =0
virtual ConstPtr find(std::string_view path) const =0
virtual int64_t getInt64() const =0
virtual ConstPtr operator[](size_t index) const =0
virtual BasicAny< ALLOC > getAnyValue() const =0
virtual uint64_t getUInt64() const =0
virtual int16_t getInt16() const =0
virtual ConstPtr at(size_t index) const =0
virtual uint16_t getUInt16() const =0
virtual ~IIntrospectableData()=default
virtual bool getBool() const =0
virtual ConstPtr operator[](std::string_view path) const =0
virtual BasicAny< ALLOC > getAnyValue(const ALLOC &allocator) const =0
virtual const BasicBitBuffer< ALLOC > & getBitBuffer() const =0
virtual std::string_view getChoice() const =0
virtual ConstPtr getField(std::string_view name) const =0
virtual double toDouble() const =0
std::basic_string< char, std::char_traits< char >, ALLOC > BasicString
Definition: String.h:17