Recording now uses new write
This commit is contained in:
@@ -2,9 +2,10 @@
|
||||
#define GERMANAIRLINESVA_FILE_RECORDING_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#include "constants.h"
|
||||
#include "recordingEntry.h"
|
||||
|
||||
namespace germanairlinesva
|
||||
@@ -28,14 +29,14 @@ namespace file
|
||||
class Recording
|
||||
{
|
||||
private:
|
||||
std::uint64_t count = 0;
|
||||
std::vector<std::uint8_t> file{'V', 'G', 'A', 'R', '\0', 1};
|
||||
std::vector<RecordingEntry> entries;
|
||||
|
||||
public:
|
||||
void addSegment(const RecordingEntry &segment);
|
||||
|
||||
inline const std::uint8_t *getBinaryData() const { return file.data(); }
|
||||
inline std::size_t getBinaryLength() const { return file.size(); }
|
||||
template <class... Args> inline void addEntry(Args &&...args)
|
||||
{
|
||||
this->entries.emplace_back(std::forward<Args>(args)...);
|
||||
}
|
||||
void toFile(std::string fileName) const;
|
||||
};
|
||||
} // namespace recording
|
||||
} // namespace file
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
#define GERMANAIRLINESVA_FILE_RECORDINGENTRY_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#include "geodata.hpp"
|
||||
#include "helpers.hpp"
|
||||
|
||||
namespace germanairlinesva
|
||||
{
|
||||
@@ -22,11 +23,10 @@ namespace file
|
||||
class RecordingEntry
|
||||
{
|
||||
private:
|
||||
std::uint32_t time = 0;
|
||||
std::uint16_t altitude = 0;
|
||||
std::uint16_t groundSpeed = 0;
|
||||
std::uint32_t time;
|
||||
std::uint16_t altitude;
|
||||
std::uint16_t groundSpeed;
|
||||
struct germanairlinesva::geodata::point coordinates;
|
||||
std::vector<std::uint8_t> file;
|
||||
|
||||
public:
|
||||
RecordingEntry() = default;
|
||||
@@ -35,8 +35,7 @@ namespace file
|
||||
std::uint16_t groundSpeed,
|
||||
struct germanairlinesva::geodata::point coordinates);
|
||||
|
||||
inline const std::uint8_t *getBinaryData() const { return file.data(); }
|
||||
inline std::size_t getBinaryLength() const { return file.size(); }
|
||||
void toFile(std::ofstream &out) const;
|
||||
|
||||
friend inline bool operator==(const RecordingEntry &lhs,
|
||||
const RecordingEntry &rhs)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define GERMANAIRLINESVA_FILE_GATE_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
Reference in New Issue
Block a user