#include "pathSegment.h"

namespace germanairlinesva_recording
{
  PathSegment::PathSegment(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();
    memcpy(bufPtr, &this->time, sizeof(this->time));
    bufPtr += sizeof(this->time);
    memcpy(bufPtr, &this->altitude, sizeof(this->altitude));
    bufPtr += sizeof(this->altitude);
    memcpy(bufPtr, &this->groundSpeed, sizeof(this->groundSpeed));
    bufPtr += sizeof(this->groundSpeed);
    memcpy(bufPtr, &this->coordinates, sizeof(this->coordinates));
  };
} // namespace germanairlinesva_recording