GermanAirlinesVA-GAConnector/file/recordingEntry.cpp

36 lines
1.1 KiB
C++

#include "recording/recordingEntry.h"
namespace germanairlinesva
{
namespace file
{
namespace recording
{
RecordingEntry::RecordingEntry(
std::uint32_t time,
std::uint16_t altitude,
std::uint16_t groundSpeed,
struct germanairlinesva::geodata::point coordinates)
{
this->time = time;
this->altitude = altitude;
this->groundSpeed = groundSpeed;
this->coordinates = coordinates;
file = std::vector<std::uint8_t>(
sizeof(this->time) + sizeof(this->altitude) +
sizeof(this->groundSpeed) + sizeof(this->coordinates),
0);
std::uint8_t *bufPtr = file.data();
std::memcpy(bufPtr, &this->time, sizeof(this->time));
bufPtr += sizeof(this->time);
std::memcpy(bufPtr, &this->altitude, sizeof(this->altitude));
bufPtr += sizeof(this->altitude);
std::memcpy(bufPtr, &this->groundSpeed, sizeof(this->groundSpeed));
bufPtr += sizeof(this->groundSpeed);
std::memcpy(bufPtr, &this->coordinates, sizeof(this->coordinates));
};
} // namespace recording
} // namespace file
} // namespace germanairlinesva