Serialization helper.
More...
#include "serializeHelper.h"
|
static void | writeSize (std::size_t s, ByteBuffer *buffer, SerializableControl *flusher) |
|
static std::size_t | readSize (ByteBuffer *buffer, DeserializableControl *control) |
|
static void | serializeString (const std::string &value, ByteBuffer *buffer, SerializableControl *flusher) |
|
static void | serializeSubstring (const std::string &value, std::size_t offset, std::size_t count, ByteBuffer *buffer, SerializableControl *flusher) |
|
static std::string | deserializeString (ByteBuffer *buffer, DeserializableControl *control) |
|
Serialization helper.
Definition at line 29 of file serializeHelper.h.
std::string deserialization helper method. TODO This method cannot return "null", but Java implementation could have serialized "null" value as well. We need to decide how to deserialize "null".
- Parameters
-
[in] | buffer | deserialization buffer |
[in] | control | control |
- Returns
- deserialized string
- Todo:
- This method cannot return "null", but Java implementation could have serialized "null" value as well. We need to decide how to deserialize "null".
Definition at line 102 of file serializeHelper.cpp.
125 str.append(buffer->
getBuffer()+pos, toRead);
140 return std::string();
const char * getBuffer() const
static std::size_t readSize(ByteBuffer *buffer, DeserializableControl *control)
std::size_t getPosition() const
void setPosition(std::size_t pos)
std::size_t getRemaining() const
virtual void ensureData(std::size_t size)=0
Deserialize array size. The specified DeserializableControl ensures sufficient bytes are available.
- Parameters
-
- Returns
- array size.
Definition at line 46 of file serializeHelper.cpp.
59 return (std::size_t)(b<0 ? b+256 : b);
EPICS_ALWAYS_INLINE int8 getByte()
EPICS_ALWAYS_INLINE int32 getInt()
#define THROW_BASE_EXCEPTION(msg)
virtual void ensureData(std::size_t size)=0
std::string serialization helper method.
- Parameters
-
[in] | value | std::string to serialize |
[in] | buffer | serialization buffer |
[in] | flusher | flusher |
Definition at line 62 of file serializeHelper.cpp.
64 std::size_t len =
value.length();
static void writeSize(std::size_t s, ByteBuffer *buffer, SerializableControl *flusher)
virtual void flushSerializeBuffer()=0
std::size_t getRemaining() const
void epics::pvData::SerializeHelper::serializeSubstring |
( |
const std::string & |
value, |
|
|
std::size_t |
offset, |
|
|
std::size_t |
count, |
|
|
ByteBuffer * |
buffer, |
|
|
SerializableControl * |
flusher |
|
) |
| |
|
static |
std::string serialization helper method.
- Parameters
-
[in] | value | std::string to serialize |
[in] | offset | start of the substring in value |
[in] | count | the number of characters to write |
[in] | buffer | serialization buffer |
[in] | flusher | flusher |
Definition at line 79 of file serializeHelper.cpp.
84 if(offset>
value.length()) offset =
value.length();
86 if(offset+count>
value.length()) count =
value.length()-offset;
93 buffer->
put(
value.data(), offset+
i, maxToWrite);
static void writeSize(std::size_t s, ByteBuffer *buffer, SerializableControl *flusher)
virtual void flushSerializeBuffer()=0
std::size_t getRemaining() const
Serialize the specified array size into the specified buffer, flushing when necessary. The specified SerializableControl manages any flushing required.
- Parameters
-
[in] | s | size to encode |
[in] | buffer | serialization buffer |
[in] | flusher | SerializableControl to manage the flushing |
Definition at line 28 of file serializeHelper.cpp.
static void writeSize(std::size_t s, ByteBuffer *buffer, SerializableControl *flusher)
virtual void ensureBuffer(std::size_t size)=0
The documentation for this class was generated from the following files: