logger Class Reference
[Log recording module]

#include <recorder_functions.h>

Collaboration diagram for logger:
Collaboration graph
[legend]

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_typesmessage_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_sensorsensors
 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.

Member Enumeration Documentation

enum logger::enum_write_mode [private]
Enumerator:
SEQUENCIAL 

Sequencial write mode, in this mode there's no memory buffer of the tree so the file is always up to date.

TREE 

Tree write mode, in this mode a tree of the log is stored in memory so we must write the file to memory manualy.


Member Function Documentation

void logger::InitMessageTypes (  ) 

Field Documentation

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().

Start timestamp of the log.

Referenced by UpdateStatistics().

double logger::log_version [private]

Recorder program version.

Referenced by logger(), and ReadFormatsFromFile().

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]
bool logger::save_on_add [private]

This variable indicates if we save the log on each message add.

Referenced by AddMessage(), and logger().

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]
xmlChar* logger::tmp [private]

Auxiliar variable.

Referenced by SetLogFiles().

Total number of messages of the log.

Referenced by AddMessage(), logger(), UpdateStatistics(), and WriteMessageTypes().


The documentation for this class was generated from the following files:
Generated on Wed Jun 2 12:43:29 2010 for LAR Atlas by  doxygen 1.6.3