os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/msproxy/debug.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // 
    15 //
    16 
    17 /**
    18  @file
    19  @internalTechnology
    20 */
    21 
    22 #ifndef PXY_DEBUG_H
    23 #define PXY_DEBUG_H
    24 
    25 // #define _HOST_DEBUG_TRACE_
    26 // #define _PROXY_DEBUG_PRINT_
    27 // #define _PROXY_FN_TRACE_
    28 
    29 #if defined(_PROXY_FN_TRACE_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE))
    30 #define FUNCTION_TRACE_ENABLED
    31 #endif
    32 
    33 #if (defined(_DEBUG) || defined(_DEBUG_RELEASE))
    34 #include <e32debug.h>
    35 #endif
    36 
    37 #ifdef FUNCTION_TRACE_ENABLED
    38 /**
    39 Logging function to be used with static functions. Prints the function string on
    40 function entry and exit.
    41 */
    42 class TLogStaticFn
    43     {
    44 public:
    45     static const TInt KLogBufferSize = 0xFF;
    46 
    47     TLogStaticFn(const TDesC8& aFunctionName);
    48 
    49 	~TLogStaticFn();
    50 
    51 protected:
    52     TBuf8<KLogBufferSize> buf;
    53 	TPtrC8 iFunctionName;
    54     };
    55 
    56 
    57 /**
    58 Logging function which prints the function string on function entry and exit.
    59 */
    60 class TLogFn
    61     {
    62 public:
    63     static const TInt KLogBufferSize = 0xFF;
    64 	TLogFn(const TDesC8& aFunctionName, void* aThisPointer);
    65 
    66 	~TLogFn();
    67 
    68 private:
    69     TBuf8<KLogBufferSize> buf;
    70 	TPtrC8 iFunctionName;
    71 	void* iThisPointer;
    72     };
    73 
    74 #define __MSFNLOG TLogFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__), this);
    75 #define __MSFNSLOG TLogStaticFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__));
    76 #else	// FUNCTION_TRACE_ENABLED
    77 #define __MSFNSLOG
    78 #define __MSFNLOG
    79 #endif		// FUNCTION_TRACE_ENABLED
    80 
    81 
    82 #if defined (_PROXY_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE))
    83 #define __PXYPRINT(t) {RDebug::Print(t);}
    84 #define __PXYPRINT1(t,a) {RDebug::Print(t,a);}
    85 #define __PXYPRINT2(t,a,b) {RDebug::Print(t,a,b);}
    86 #define __PXYPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);}
    87 #define __PXYPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
    88 #define __PXYPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);}
    89 #define __PXYPRINT8BIT1(t,a) {TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);}
    90 #define __PXYPRINT1TEMP(t,a) {TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}
    91 #else
    92 #define __PXYPRINT(t)
    93 #define __PXYPRINT1(t,a)
    94 #define __PXYPRINT2(t,a,b)
    95 #define __PXYPRINT3(t,a,b,c)
    96 #define __PXYPRINT4(t,a,b,c,d)
    97 #define __PXYPRINT5(t,a,b,c,d,e)
    98 #define __PXYPRINT8BIT1(t,a)
    99 #define __PXYPRINT1TEMP(t,a)
   100 #endif // _PROXY_DEBUG_PRINT_
   101 
   102 #if defined(_HOST_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE))
   103 #define __HOSTPRINT(t) {RDebug::Print(t);}
   104 #define __HOSTPRINT1(t,a) {RDebug::Print(t,a);}
   105 #define __HOSTPRINT2(t,a,b) {RDebug::Print(t,a,b);}
   106 #define __HOSTPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);}
   107 #define __HOSTPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
   108 #define __HOSTPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);}
   109 #define __HOSTPRINT8BIT1(t,a) {TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);}
   110 #define __HOSTPRINT1TEMP(t,a) {TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}
   111 static const TUint KBlockSize = 0x200;
   112 #else
   113 #define __HOSTPRINT(t)
   114 #define __HOSTPRINT1(t,a)
   115 #define __HOSTPRINT2(t,a,b)
   116 #define __HOSTPRINT3(t,a,b,c)
   117 #define __HOSTPRINT4(t,a,b,c,d)
   118 #define __HOSTPRINT5(t,a,b,c,d,e)
   119 #define __HOSTPRINT8BIT1(t,a)
   120 #define __HOSTPRINT1TEMP(t,a)
   121 #endif // _HOST_DEBUG_PRINT_
   122 
   123 #endif // PXY_DEBUG_H
   124 
   125