#include <recorder_functions.h>
Data Structures | |
struct | struct_file_handle |
struct | struct_message |
struct | struct_message_types |
struct | struct_sensor |
Public Member Functions | |
logger () | |
Constructor for the logger class. | |
~logger () | |
Deconstructur for the logger class. | |
int | ReadFormatsFromFile (void) |
Read messages formats from a XML file. | |
int | SetLogFiles (const char *filename) |
This function sets the log file that will be used This function checks if the filename passed by already exists and if so, the filename will be append with _A, if that file also exist we test the next char, and so on. | |
int | StartLog (void) |
This function start the log parser This function creates a new log parser and sets the begin of the XML log header. | |
void | InstallParameters (int argc, char **argv) |
This function install all recorder parameters This function mallocs the number of parameters corresponding to the message types in the MESSAGE_TYPES_FILE and install them. This function also sets the param deamon to allow unfound variables. | |
int | WriteHeader (void) |
Write log header This function writes the log header, the header constains, list of sessions, list of sensors and list of messages. | |
int | CloseLog (void) |
Close Log file This function cleans the XML parser and dumps memory, it also closes all data files. | |
int | GetSensors (void) |
This function obtains the list of sensors This function obtains the list of sensors to be used in this log, for now this is just a dummy function. | |
int | InitMessageLoging (void) |
Writes the begin of the messages element This function writes the begin of the messages element of the log. | |
void | InitMessageTypes () |
int | AddMessage () |
Addes a single message to the log header This function addes a new entry to the log header. Message format is m=message, t=message_type sp=start_position, l=length, c=comment. | |
void | SubscribeMessages () |
Subscribe IPC Messages This function subscribes all the predefined message types. | |
int | UpdateStatistics (void) |
Updade a posteriory statistics This function updates the log header with a posteriory statistics, it opens the file again parses it and updates the correct fields using Xpath. | |
Data Fields | |
struct_message | current_message |
Most recent message recived. | |
double | log_start_time |
Start timestamp of the log. | |
unsigned int | total_message_types |
Total message types being logged. | |
struct_message_types * | message_types |
Message types being logged. | |
long int | total_number_messages |
Total number of messages of the log. | |
Private Types | |
enum | enum_write_mode { SEQUENCIAL, TREE } |
Private Member Functions | |
int | WriteMessageTypes (void) |
Write a list of all message types This function writes a list of all message types to be logged. | |
int | WriteSession (void) |
Write session This function writes a log session onto a file. The log session contains the time and data of the log, the computer name, the session id, the start and end location, the driver of the car, car odometer information and weather conditions. | |
int | WriteSensorList (void) |
Write sensor list This function writes a sensor list onto the log. | |
int | WriteSensor (unsigned int number) |
Write a single sensor This function writes a single sensor into the log. Sensor are obtained using logger::GetSensors, sensor information contain: id, type, vendor, data interface, placement and if it a camera it also contains focal distance and resolution. | |
Private Attributes | |
struct_file_handle | file_handle |
Handler to control file acess. | |
unsigned int | number_sensors |
Total number of sensors. | |
struct_sensor * | sensors |
Sensor list. | |
unsigned int | session_id |
Id of this session. | |
char | encoding [512] |
Encoding used in the XML file. | |
bool | save_on_add |
This variable indicates if we save the log on each message add. | |
bool | compression |
Use compression in FILE write mode. | |
xmlNodePtr | node |
Auxiliar variable. | |
xmlChar * | tmp |
Auxiliar variable. | |
enum_write_mode | write_mode |
Writing method associated with XmlWriter. | |
char | text [512] |
Auxiliar variable. | |
int | rc |
return code used in libxml2 functions | |
double | mtf_version |
Message types file version. | |
double | log_version |
Recorder program version. |
enum logger::enum_write_mode [private] |
void logger::InitMessageTypes | ( | ) |
bool logger::compression [private] |
Use compression in FILE write mode.
Referenced by StartLog().
Most recent message recived.
Referenced by AddMessage().
char logger::encoding[512] [private] |
Encoding used in the XML file.
Referenced by AddMessage(), CloseLog(), logger(), ReadFormatsFromFile(), StartLog(), and UpdateStatistics().
struct_file_handle logger::file_handle [private] |
Handler to control file acess.
Referenced by AddMessage(), CloseLog(), InitMessageLoging(), ReadFormatsFromFile(), SetLogFiles(), StartLog(), UpdateStatistics(), WriteHeader(), WriteMessageTypes(), WriteSensor(), WriteSensorList(), and WriteSession().
double logger::log_start_time |
Start timestamp of the log.
Referenced by UpdateStatistics().
double logger::log_version [private] |
Recorder program version.
Referenced by logger(), and ReadFormatsFromFile().
Message types being logged.
Referenced by AddMessage(), CloseLog(), InstallParameters(), ReadFormatsFromFile(), SubscribeMessages(), UpdateStatistics(), and WriteMessageTypes().
double logger::mtf_version [private] |
Message types file version.
Referenced by ReadFormatsFromFile().
xmlNodePtr logger::node [private] |
Auxiliar variable.
Referenced by AddMessage(), and WriteMessageTypes().
unsigned int logger::number_sensors [private] |
Total number of sensors.
Referenced by GetSensors(), logger(), and WriteSensorList().
int logger::rc [private] |
return code used in libxml2 functions
Referenced by AddMessage(), CloseLog(), InitMessageLoging(), StartLog(), WriteHeader(), WriteMessageTypes(), WriteSensor(), WriteSensorList(), and WriteSession().
bool logger::save_on_add [private] |
This variable indicates if we save the log on each message add.
Referenced by AddMessage(), and logger().
struct_sensor* logger::sensors [private] |
Sensor list.
Referenced by GetSensors(), and WriteSensor().
unsigned int logger::session_id [private] |
Id of this session.
Referenced by InitMessageLoging(), logger(), and WriteSession().
char logger::text[512] [private] |
Auxiliar variable.
Referenced by AddMessage(), CloseLog(), InitMessageLoging(), InstallParameters(), logger(), ReadFormatsFromFile(), UpdateStatistics(), WriteMessageTypes(), and WriteSession().
xmlChar* logger::tmp [private] |
Auxiliar variable.
Referenced by SetLogFiles().
unsigned int logger::total_message_types |
Total message types being logged.
Referenced by CloseLog(), InstallParameters(), ReadFormatsFromFile(), SubscribeMessages(), UpdateStatistics(), and WriteMessageTypes().
long int logger::total_number_messages |
Total number of messages of the log.
Referenced by AddMessage(), logger(), UpdateStatistics(), and WriteMessageTypes().
enum_write_mode logger::write_mode [private] |
Writing method associated with XmlWriter.
Referenced by AddMessage(), CloseLog(), InitMessageLoging(), logger(), StartLog(), WriteHeader(), WriteMessageTypes(), WriteSensor(), WriteSensorList(), and WriteSession().