103 const std::vector<cavapa::Sightings> &sightings);
114 bool empty()
const {
return results.empty(); }
130 unsigned int getCount()
const {
return results.size(); }
138 {
return results.size() == 0 ? 0 : getStats(results.at(0)).time; }
179 bool load(
const std::string& path);
186 bool save(
const std::string& path)
const;
204 SightingFixed(
const cavapa::Sighting& s) : id(s.id), world_x(s.world.x),
205 world_y(s.world.y), certainty(s.certainty), topleft_x(s.topleft.x),
206 topleft_y(s.topleft.y), bottomright_x(s.bottomright.x),
207 bottomright_y(s.bottomright.y) {}
213 std::int16_t topleft_x;
214 std::int16_t topleft_y;
215 std::int16_t bottomright_x;
216 std::int16_t bottomright_y;
220 static_assert(
sizeof(SightingFixed::id) == 4
221 &&
sizeof(SightingFixed::world_x) == 4
222 &&
sizeof(SightingFixed::world_y) == 4
223 &&
sizeof(SightingFixed::certainty) == 4
224 &&
sizeof(SightingFixed::topleft_x) == 2
225 &&
sizeof(SightingFixed::topleft_y) == 2
226 &&
sizeof(SightingFixed::bottomright_x) == 2
227 &&
sizeof(SightingFixed::bottomright_y) == 2,
228 "The size of the structure members is not correct.");
236 static float calculateActivity(
const std::vector<cavapa::Sightings>& s);
243 static int calculateTotalSightings(
const std::vector<cavapa::Sightings>& s);
248 using FrameResults = std::tuple<FrameStats,
249 std::vector<std::uint32_t>, std::vector<SightingFixed>>;
254 using MarkerSet = std::set<Marker, std::function<bool (Marker, Marker)>>;
265 static inline FrameStats getAverage(
266 std::vector<FrameResults>::const_iterator a,
267 std::vector<FrameResults>::const_iterator b);
280 static std::string getMarkerTexts(
FrameTime stop, MarkerSet& markers);
290 static std::vector<SightingFixed>
getSightings(
const FrameResults& r)
291 {
return std::get<2>(r); }
302 const std::vector<FrameResults>::const_iterator& it)
313 static std::vector<std::uint32_t> getSightingCounts(
const FrameResults& r)
314 {
return std::get<1>(r); }
322 inline std::vector<FrameResults>::const_iterator
333 static FrameStats getStats(
const FrameResults& r)
334 {
return std::get<0>(r); }
344 static FrameStats getStats(
345 const std::vector<FrameResults>::const_iterator& it)
346 {
return getStats(*it); }
354 inline std::vector<FrameResults>::const_iterator
366 const std::vector<Marker>& markers);
368 std::vector<FrameResults> results;
FrameTime getFirstFrameTime() const
Retrieves the time of the first frame in Results.
Definition: results.h:137
int getFrameNumber(FrameTime time) const
Returns the frame number for the given FrameTime.
Definition: results.cpp:260
std::vector< FrameStats > getStatistics(FrameTime start, FrameTime stop, int points) const
Returns the calculation statistics from the given period.
Definition: results.cpp:334
bool exportToCSV(const ExportOptions &options) const
Exports the results to the CSV file.
Definition: results.cpp:124
std::vector< cavapa::Sightings > getSightings(FrameTime time) const
Retrieves the sighting information from the frame.
Definition: results.cpp:299
Structure for holding frame statistics on activity.
Definition: common.h:285
bool empty() const
Checks if the are no results.
Definition: results.h:114
std::uint64_t FrameTime
Used to store milliseconds interval in frame times.
Definition: common.h:138
FrameStats addFrame(FrameTime time, const std::vector< cavapa::Sightings > &sightings)
Adds the new frame to the results.
Definition: results.cpp:52
bool load(const std::string &path)
Loads the calculation results from the file.
Definition: results.cpp:384
The structure holds CSV export options.
Definition: common.h:183
unsigned int getCount() const
Returns the number of the frames saved.
Definition: results.h:130
void clear()
Deletes all the stored calculation results.
Definition: results.h:108
The class holds the calculation results for each frame.
Definition: results.h:88
bool save(const std::string &path) const
Saves the calculation results to the file.
Definition: results.cpp:450