Hauptseite | Klassenhierarchie | Alphabetische Liste | Auflistung der Klassen | Auflistung der Dateien | Klassen-Elemente

# TraceObject.h

    00001 /* ****************************************************************************
    00002 **
    00003 ** Projekt       : FPS
    00004 ** File          : TraceObject.h
    00005 ** Version       : $Revision: 1.2 $
    00006 ** Author        : Axel Schmidt
    00007 ** Copyright     : (C) 2001 by Analytica GmbH
    00008 **-----------------------------------------------------------------------------
    00009 **
    00010 ** $Id: TraceObject.h,v 1.2 2001/07/13 06:52:09 AxelSchmidt Exp $
    00011 **
    00012 ** $Log: TraceObject.h,v $
    00013 ** Revision 1.2  2001/07/13 06:52:09  AxelSchmidt
    00014 ** Macros geändert
    00015 **
    00016 ** Revision 1.1  2001/07/12 14:34:51  AxelSchmidt
    00017 ** first version
    00018 **
    00019 ******************************************************************************/
    00020
    00021 #if !defined(AFX_TRACEOBJECT_H__CD0CA6D3_76A3_11D5_8842_0080C89592D9__INCLUDED_)
    00022 #define AFX_TRACEOBJECT_H__CD0CA6D3_76A3_11D5_8842_0080C89592D9__INCLUDED_
    00023
    00024 #if _MSC_VER > 1000
    00025 #pragma once
    00026 #endif // _MSC_VER > 1000
    00027
    00028 #include <strstream>
    00029
    00030 // Macros ---------------------------------------------------------------------
    00031
    00032 #define TRC_DEBUG( _s )  { std::ostrstream s; s << _s << "\tFile " << __FILE__ << " Line " << __LINE__; CTraceObject::AddTrace( s, CTraceObject::MT_DEBUG ); }
    00033 #define TRC_ERROR( _s)   { std::ostrstream s; s << _s; CTraceObject::AddTrace( s, CTraceObject::MT_ERROR ); }
    00034 #define TRC_WARNING(_s)  { std::ostrstream s; s << _s; CTraceObject::AddTrace( s, CTraceObject::MT_WARNING ); }
    00035 #define TRC_INFO(_s)     { std::ostrstream s; s << _s; CTraceObject::AddTrace( s, CTraceObject::MT_INFO); }
    00036
    00037 // Class ---------------------------------------------------------------------
    00038
    00043 class CTraceObject
    00044 {
    00045 public:
    00050    enum eTraceLevel
    00051    {
    00052       MT_ERROR   = 1,       // Fehlerfall
    00053       MT_WARNING = 2,       // Warnung
    00054       MT_INFO    = 4,       // Info-Meldung
    00055       MT_DEBUG   = 8,       // Dokumentierter Funktionseingang
    00056   };
    00057
    00059    CTraceObject();
    00060
    00062    virtual ~CTraceObject();
    00063
    00069    virtual void AddTrace( const char * lpszMsg,
    00070                           CTraceObject::eTraceLevel eLevel = CTraceObject::MT_ERROR );
    00071
    00077    void AddTrace( std::ostrstream & oStream,
    00078                   CTraceObject::eTraceLevel eLevel = CTraceObject::MT_ERROR );
    00079
    00083    void SetTraceLevel( int nTraceLevelMask );
    00084
    00085    static std::string GetLastErrorText( DWORD dwError );
    00086
    00087 protected:
    00088
    00093    bool GetIsTraceLevelAktivated( CTraceObject::eTraceLevel eLevel ) const;
    00094
    00095 private:
    00097    int m_nTraceLevelsActive;
    00098 };
    00099
    00100 #endif // !defined(AFX_TRACEOBJECT_H__CD0CA6D3_76A3_11D5_8842_0080C89592D9__INCLUDED_)