# AuditFile Class Reference

AuditFile class is used to store information into a file for later usage. More...

`#include <AuditFile.hh>`

List of all members.

## Public Member Functions
| AuditFile (const std::string)
| AuditFile constructor to write to file.
| ~AuditFile ()
| delete an AuditFile instance.
void | startLine (Handle, FederateHandle, unsigned short EventType)
| start a new line and set with parameters.
void | setLevel (unsigned short EventLevel)
| setLevel change the event level.
void | endLine (unsigned short, std::string)
| Adds last information about current line and writes it to file.
void | putLine (unsigned short, unsigned short, unsigned short, std::string)
| addToLine add a comment to the current line.
AuditFile & | operator<< (const char *)
| operator<<
AuditFile & | operator<< (int)
AuditFile & | operator<< (unsigned int)
AuditFile & | operator<< (long)
AuditFile & | operator<< (unsigned long)
AuditFile & | operator<< (double)
## Protected Attributes
std::ofstream | auditFile
| Stream pointer to output file.
AuditLine | currentLine
| Line currently being processed.

## Detailed Description

AuditFile class is used to store information into a file for later usage.

First call the startLine method to give background information about the next current audit line. The line is then prepared internally, but not yet written to the audit file. You can then set the Level of the line separately. If the Level is below the fixed Audit level, nothing will be stored or written for this event (except in the case of an exception). The default level is the lowest one. Each call to addToLine or to addToLine adds the parameter string to the current line. Then a last call to EndLine will set the line's status (or Result) and flush the line into the Audit file.

Definition at line 57 of file AuditFile.hh.

## Constructor & Destructor Documentation

AuditFile | ( | const std::string | logfile | ) |

AuditFile constructor to write to file.

Audit file is used to store information about actions taken by the RTIG

Definition at line 44 of file AuditFile.cc.

References AUDIT_MAX_LEVEL, AUDITEVENT_START_AUDIT, AuditFile::auditFile, certi::e_NO_EXCEPTION, and AuditFile::putLine().

Here is the call graph for this function:

~AuditFile | ( |  | ) |

delete an AuditFile instance.

if a line is currently being processed, close it. Before closing the file, adds a specific end line.

Definition at line 62 of file AuditFile.cc.

References AUDIT_MAX_LEVEL, AUDITEVENT_STOP_AUDIT, AuditFile::auditFile, certi::e_NO_EXCEPTION, AuditFile::endLine(), and AuditFile::putLine().

Here is the call graph for this function:

## Member Function Documentation

void startLine | ( | Handle | federation,
|  | FederateHandle | federate,
|  | unsigned short | EventType |
| ) |  |  |

start a new line and set with parameters.

Definition at line 134 of file AuditFile.cc.

References AUDIT_MIN_LEVEL, AuditFile::currentLine, AuditLine::setFederate(), AuditLine::setFederation(), and AuditLine::started().

Referenced by RTIG::processIncomingMessage().

Here is the call graph for this function:

void setLevel | ( | unsigned short | eventLevel | ) |

setLevel change the event level.

event level is used to determine if information has to be inserted into file. Level is only used by endLine module.

Definition at line 155 of file AuditFile.cc.

References AuditFile::currentLine, and AuditLine::setLevel().

Referenced by RTIG::chooseProcessingMethod().

Here is the call graph for this function:

void endLine | ( | unsigned short | event_status,
|  | std::string | reason |
| ) |  |  |

Adds last information about current line and writes it to file.

Completes a line previously initialized by a newLine call. Appends the current status and a comment. Then write line to file.

Definition at line 75 of file AuditFile.cc.

References AUDIT_CURRENT_LEVEL, AuditFile::auditFile, AuditFile::currentLine, AuditLine::end(), AuditLine::getLevel(), AuditLine::getStatus(), AuditLine::started(), and AuditLine::write().

Referenced by RTIG::processIncomingMessage(), and AuditFile::~AuditFile().

Here is the call graph for this function:

void putLine | ( | unsigned short | event_type,
|  | unsigned short | event_level,
|  | unsigned short | event_status,
|  | std::string | reason |
| ) |  |  |

addToLine add a comment to the current line.

addToLinef adds a formatted comment to the current line. creates a new line with parameters and writes this line to file.

Sometimes, you may want to directly put a line in the audit without calling 3 methods : you can also use the following PutLine method in case of an emergency. The line is written immediatly, even before any currently builded audit line. The federation and federate numbers are set to(0, 0).

Definition at line 120 of file AuditFile.cc.

References AUDIT_CURRENT_LEVEL, AuditFile::auditFile, and AuditLine::write().

Referenced by AuditFile::AuditFile(), and AuditFile::~AuditFile().

Here is the call graph for this function:

AuditFile & operator<< | ( | const char * | s | ) |

operator<<

Definition at line 164 of file AuditFile.cc.

References AuditLine::addComment(), and AuditFile::currentLine.

Here is the call graph for this function:

AuditFile & operator<< | ( | int | n | ) |

Definition at line 172 of file AuditFile.cc.

References AuditLine::addComment(), and AuditFile::currentLine.

Here is the call graph for this function:

AuditFile & operator<< | ( | unsigned int | n | ) |

Definition at line 190 of file AuditFile.cc.

References AuditLine::addComment(), and AuditFile::currentLine.

Here is the call graph for this function:

AuditFile & operator<< | ( | long | n | ) |

Definition at line 181 of file AuditFile.cc.

References AuditLine::addComment(), and AuditFile::currentLine.

Here is the call graph for this function:

AuditFile & operator<< | ( | unsigned long | n | ) |

Definition at line 199 of file AuditFile.cc.

References AuditLine::addComment(), and AuditFile::currentLine.

Here is the call graph for this function:

AuditFile & operator<< | ( | double | n | ) |

Definition at line 208 of file AuditFile.cc.

References AuditLine::addComment(), and AuditFile::currentLine.

Here is the call graph for this function:

## Member Data Documentation

std::ofstream auditFile`[protected]`

Stream pointer to output file.

Definition at line 78 of file AuditFile.hh.

Referenced by AuditFile::AuditFile(), AuditFile::endLine(), AuditFile::putLine(), and AuditFile::~AuditFile().

AuditLine currentLine`[protected]`

Line currently being processed.

Definition at line 79 of file AuditFile.hh.

Referenced by AuditFile::endLine(), AuditFile::operator<<(), AuditFile::setLevel(), and AuditFile::startLine().

The documentation for this class was generated from the following files:

- AuditFile.hh
- AuditFile.cc