MCPcopy Create free account
hub / github.com/COVESA/vsomeip / deserialize

Method deserialize

implementation/protocol/src/send_command.cpp:91–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void send_command::deserialize(const std::vector<byte_t>& _buffer, error_e& _error) {
92
93 size_t its_size(COMMAND_HEADER_SIZE + sizeof(instance_) + sizeof(is_reliable_) + sizeof(status_) + sizeof(target_));
94
95 if (its_size > _buffer.size()) {
96
97 _error = error_e::ERROR_NOT_ENOUGH_BYTES;
98 return;
99 }
100
101 // deserialize header
102 command::deserialize(_buffer, _error);
103 if (_error != error_e::ERROR_OK)
104 return;
105
106 // deserialize payload
107 size_t its_offset(COMMAND_POSITION_PAYLOAD);
108 std::memcpy(&instance_, &_buffer[its_offset], sizeof(instance_));
109 its_offset += sizeof(instance_);
110 is_reliable_ = static_cast<bool>(_buffer[its_offset]);
111 its_offset += sizeof(is_reliable_);
112 status_ = static_cast<uint8_t>(_buffer[its_offset]);
113 its_offset += sizeof(status_);
114 std::memcpy(&target_, &_buffer[its_offset], sizeof(target_));
115 its_offset += sizeof(target_);
116 message_.resize(_buffer.size() - its_offset);
117 std::memcpy(&message_[0], &_buffer[its_offset], message_.size());
118}
119
120} // namespace protocol
121} // namespace vsomeip

Callers

nothing calls this directly

Calls 3

deserializeFunction · 0.85
resizeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected