eRPC API Reference  Rev. 1.12.0
NXP Semiconductors
erpc_basic_codec.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, Freescale Semiconductor, Inc.
3  * Copyright 2016-2021 NXP
4  * Copyright 2021 ACRIOS Systems s.r.o.
5  * All rights reserved.
6  *
7  *
8  * SPDX-License-Identifier: BSD-3-Clause
9  */
10 
11 #ifndef _EMBEDDED_RPC__BASIC_SERIALIZATION_H_
12 #define _EMBEDDED_RPC__BASIC_SERIALIZATION_H_
13 
14 #include "erpc_codec.hpp"
15 
22 // Classes
25 
26 namespace erpc {
30 enum class null_flag_t
31 {
32  kNotNull = 0,
33  kIsNull
34 };
35 
41 class BasicCodec : public Codec
42 {
43 public:
44  static const uint32_t kBasicCodecVersion;
49  BasicCodec(void);
50 
54  virtual ~BasicCodec(void);
55 
57 
58 
67  virtual void startWriteMessage(message_type_t type, uint32_t service, uint32_t request, uint32_t sequence) override;
68 
75  virtual void writeData(uint32_t length, const void *value);
76 
82  virtual void write(bool value) override;
83 
89  virtual void write(int8_t value) override;
90 
96  virtual void write(int16_t value) override;
97 
103  virtual void write(int32_t value) override;
104 
110  virtual void write(int64_t value) override;
111 
117  virtual void write(uint8_t value) override;
118 
124  virtual void write(uint16_t value) override;
125 
131  virtual void write(uint32_t value) override;
132 
138  virtual void write(uint64_t value) override;
139 
145  virtual void write(float value) override;
146 
152  virtual void write(double value) override;
153 
159  virtual void writePtr(uintptr_t value) override;
160 
167  virtual void writeString(uint32_t length, const char *value) override;
168 
175  virtual void writeBinary(uint32_t length, const uint8_t *value) override;
176 
182  virtual void startWriteList(uint32_t length) override;
183 
189  virtual void startWriteUnion(int32_t discriminator) override;
190 
196  virtual void writeNullFlag(bool isNull) override;
198 
200 
201 
210  virtual void startReadMessage(message_type_t &type, uint32_t &service, uint32_t &request,
211  uint32_t &sequence) override;
212 
219  virtual void readData(uint32_t length, void *value);
220 
226  virtual void read(bool &value) override;
227 
233  virtual void read(int8_t &value) override;
234 
240  virtual void read(int16_t &value) override;
241 
247  virtual void read(int32_t &value) override;
248 
254  virtual void read(int64_t &value) override;
255 
261  virtual void read(uint8_t &value) override;
262 
268  virtual void read(uint16_t &value) override;
269 
275  virtual void read(uint32_t &value) override;
276 
282  virtual void read(uint64_t &value) override;
283 
289  virtual void read(float &value) override;
290 
296  virtual void read(double &value) override;
297 
303  virtual void readPtr(uintptr_t &value) override;
304 
311  virtual void readString(uint32_t &length, char **value) override;
312 
319  virtual void readBinary(uint32_t &length, uint8_t **value) override;
320 
326  virtual void startReadList(uint32_t &length) override;
327 
333  virtual void startReadUnion(int32_t &discriminator) override;
334 
340  virtual void readNullFlag(bool &isNull) override;
342 };
343 
350 {
351 public:
355  BasicCodecFactory(void);
356 
360  virtual ~BasicCodecFactory(void);
361 
367  virtual Codec *create(void) override;
368 
374  virtual void dispose(Codec *codec) override;
375 };
376 
377 } // namespace erpc
378 
381 #endif // _EMBEDDED_RPC__BASIC_SERIALIZATION_H_
message_type_t
Types of messages that can be encoded.
Definition: erpc_codec.hpp:35
Abstract serialization encoder/decoder interface.
Definition: erpc_codec.hpp:53
Abstract interface for codec factory.
Definition: erpc_codec.hpp:408
Simple binary serialization format.
Definition: erpc_basic_codec.hpp:41
static const uint32_t kBasicCodecVersion
Definition: erpc_basic_codec.hpp:44
Definition: erpc_arbitrated_client_manager.hpp:25
Basic codec factory implements functions from codec factory.
Definition: erpc_basic_codec.hpp:349
null_flag_t
Values of the uint8 flag prefixing nullable values.
Definition: erpc_basic_codec.hpp:30