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

Method deserialize

implementation/protocol/src/command.cpp:24–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24void command::deserialize(const std::vector<byte_t>& _buffer, error_e& _error) {
25
26 // buffer size check (size >= header size) is
27 // done within the code of the derived classes
28 // that call this method
29
30 // If the id_ is set to "UNKNOWN", read it.
31 // Otherwise check it.
32 if (id_ == id_e::UNKNOWN_ID) {
33
34 id_ = static_cast<id_e>(_buffer[0]);
35 } else if (_buffer[0] != static_cast<byte_t>(id_)) {
36
37 _error = error_e::ERROR_MISMATCH;
38 return;
39 }
40
41 std::memcpy(&version_, &_buffer[COMMAND_POSITION_VERSION], sizeof(version_));
42 std::memcpy(&client_, &_buffer[COMMAND_POSITION_CLIENT], sizeof(client_));
43 std::memcpy(&size_, &_buffer[COMMAND_POSITION_SIZE], sizeof(size_));
44
45 _error = error_e::ERROR_OK;
46}
47
48} // namespace protocol
49} // namespace vsomeip

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected