The class holds the calculation results for each frame. More...
#include <results.h>
Public Member Functions | |
FrameStats | addFrame (FrameTime time, const std::vector< cavapa::Sightings > &sightings) |
Adds the new frame to the results. More... | |
void | clear () |
Deletes all the stored calculation results. | |
bool | empty () const |
Checks if the are no results. More... | |
bool | exportToCSV (const ExportOptions &options) const |
Exports the results to the CSV file. More... | |
unsigned int | getCount () const |
Returns the number of the frames saved. More... | |
FrameTime | getFirstFrameTime () const |
Retrieves the time of the first frame in Results. More... | |
int | getFrameNumber (FrameTime time) const |
Returns the frame number for the given FrameTime. More... | |
std::vector< cavapa::Sightings > | getSightings (FrameTime time) const |
Retrieves the sighting information from the frame. More... | |
std::vector< FrameStats > | getStatistics (FrameTime start, FrameTime stop, int points) const |
Returns the calculation statistics from the given period. More... | |
bool | load (const std::string &path) |
Loads the calculation results from the file. More... | |
bool | save (const std::string &path) const |
Saves the calculation results to the file. More... | |
The class holds the calculation results for each frame.
It keeps the results in order and provides export, save, load and averaging functions for the other parts of the program.
The current results can be removed with clear(). New frames can be inserted with addFrame() which calculates the total activity and the sighting count for the frame.
The frame specific results can be retrieved with getStatistics() or they can be exported to the CSV file with exportToCSV(). The Results and sightings can also be saved to the file and loaded later.
frame_count (i) : uint32_t [FRAME 1] frame_stats : FrameStats cameras (n) : uint32_t sightings (m) : uint32_t [CAMERA 1] sighting_count (j) : uint32_t [CAMERA 2] sighting_count : uint32_t [CAMERA 3] ... [CAMERA n] [CAMERA 1 SIGHTINGS] [SIGHTING 1] sighting : SightingFixed [SIGHTING 2] sighting : SightingFixed [SIGHTING 3] ... [SIGHTING j] [CAMERA 2 SIGHTINGS] ... [SIGHTINGS m] [FRAME 2] ... [FRAME i]
FrameStats cavapa_gui::Results::addFrame | ( | FrameTime | time, |
const std::vector< cavapa::Sightings > & | sightings | ||
) |
Adds the new frame to the results.
This also calculates the frame's statistics and returns them.
time | A time of the frame. |
sightings | The sightings on the frame. |
|
inline |
Checks if the are no results.
bool cavapa_gui::Results::exportToCSV | ( | const ExportOptions & | options | ) | const |
Exports the results to the CSV file.
It exports the basic frame information to the file in a CSV format. Any old data will be overwritten, unless APPEND flag is set.
options | The options for the export. |
|
inline |
Returns the number of the frames saved.
|
inline |
Retrieves the time of the first frame in Results.
int cavapa_gui::Results::getFrameNumber | ( | FrameTime | time | ) | const |
Returns the frame number for the given FrameTime.
time | FrameTime to look for. |
std::vector< Sightings > cavapa_gui::Results::getSightings | ( | FrameTime | time | ) | const |
Retrieves the sighting information from the frame.
time | The frame time. |
TODO: Actually return something.
vector< FrameStats > cavapa_gui::Results::getStatistics | ( | FrameTime | start, |
FrameTime | stop, | ||
int | points | ||
) | const |
Returns the calculation statistics from the given period.
It can be used to return the frame statistics from a given period. The average values are calculated automatically from between the returned period points.
start | The period start time. If 0, the period will start from the first possible frame. |
stop | The period end time. If 0, the period will end at the last possible frame. |
points | The number of points to be returned from the specified period. |
bool cavapa_gui::Results::load | ( | const std::string & | path | ) |
Loads the calculation results from the file.
path | The full file path. |
bool cavapa_gui::Results::save | ( | const std::string & | path | ) | const |
Saves the calculation results to the file.
path | The full file path. |