# AuditFile.hh

Go to the documentation of this file.

    00001 // ----------------------------------------------------------------------------
    00002 // CERTI - HLA RunTime Infrastructure
    00003 // Copyright (C) 2002, 2003, 2004  ONERA
    00004 //
    00005 // This file is part of CERTI-libCERTI
    00006 //
    00007 // CERTI-libCERTI is free software ; you can redistribute it and/or
    00008 // modify it under the terms of the GNU Lesser General Public License
    00009 // as published by the Free Software Foundation ; either version 2 of
    00010 // the License, or (at your option) any later version.
    00011 //
    00012 // CERTI-libCERTI is distributed in the hope that it will be useful, but
    00013 // WITHOUT ANY WARRANTY ; without even the implied warranty of
    00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    00015 // Lesser General Public License for more details.
    00016 //
    00017 // You should have received a copy of the GNU Lesser General Public
    00018 // License along with this program ; if not, write to the Free Software
    00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
    00020 // USA
    00021 //
    00022 // $Id: AuditFile.hh,v 3.10 2007/06/22 08:51:36 erk Exp $
    00023 // ----------------------------------------------------------------------------
    00024
    00025 #ifndef _CERTI_AUDIT_FILE_HH
    00026 #define _CERTI_AUDIT_FILE_HH
    00027
    00028 #include "AuditLine.hh"
    00029 #include "certi.hh"
    00030 #include "Exception.hh"
    00031
    00032 #include <fstream>
    00033 #include <string>
    00034
    00035 #define AUDIT_MIN_LEVEL 0
    00036 #define AUDIT_MAX_LEVEL 10
    00037
    00038 #define AUDITEVENT_START_AUDIT 128
    00039 #define AUDITEVENT_STOP_AUDIT 129
    00040 #define AUDITEVENT_START_RTIG 130
    00041 #define AUDITEVENT_STOP_RTIG 131
    00042
    00043 namespace certi {
    00044
    00045 // ----------------------------------------------------------------------------
    00047
    00057 class CERTI_EXPORT AuditFile
    00058 {
    00059 public:
    00060     AuditFile(const std::string); // Open LogFileName for writing.
    00061     ~AuditFile();
    00062
    00063     void startLine(Handle, FederateHandle, unsigned short EventType);
    00064     void setLevel(unsigned short EventLevel);
    00065     //    void addToLine(const std::string);
    00066     //    void addToLinef(const char *Format, ...);
    00067     void endLine(unsigned short, std::string);
    00068     void putLine(unsigned short, unsigned short, unsigned short, std::string);
    00069
    00070     AuditFile &operator<<(const char *);
    00071     AuditFile &operator<<(int);
    00072     AuditFile &operator<<(unsigned int);
    00073     AuditFile &operator<<(long);
    00074     AuditFile &operator<<(unsigned long);
    00075     AuditFile &operator<<(double);
    00076
    00077 protected:
    00078     std::ofstream auditFile ;
    00079     AuditLine currentLine ;
    00080     //char va_Buffer[1024] ; //!< Static buffer for va_printf operations.
    00081 };
    00082
    00083 } // namespace certi
    00084
    00085 #endif // _CERTI_AUDIT_FILE_HH
    00086
    00087 // $Id: AuditFile.hh,v 3.10 2007/06/22 08:51:36 erk Exp $