tracefw/tracecompiler/test/TracesInHeadersApps/singlemmp_diffnames/dll/src/HelloTraceFn.cpp
changeset 56 aa2539c91954
parent 54 a151135b0cf9
child 60 e54443a6878c
child 62 1c2bb2fc7c87
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18  
       
    19 #include "HelloTraceFn.h"
       
    20 #include "HelloTraceFnDup.inl"
       
    21 #include "HelloTraceFnDup2.inl"
       
    22 #include "HelloTracePanic.h"
       
    23 
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "HelloTraceFnTraces.h"
       
    27 #endif
       
    28 
       
    29 
       
    30 CHelloTraceFn* CHelloTraceFn::NewLC()
       
    31     {
       
    32     CHelloTraceFn* self = new (ELeave) CHelloTraceFn;
       
    33     CleanupStack::PushL(self);
       
    34     return self;
       
    35     }
       
    36 
       
    37 CHelloTraceFn* CHelloTraceFn::NewL()
       
    38     {
       
    39     CHelloTraceFn* self = CHelloTraceFn::NewLC();
       
    40     CleanupStack::Pop(self);
       
    41     return self;
       
    42     }
       
    43 
       
    44 CHelloTraceFn::CHelloTraceFn()
       
    45     {
       
    46     OstTrace1( TRACE_NORMAL, CHELLOTRACEFN_CHELLOTRACEFN_CTOR, "[0x%08x] Constructor", this );  
       
    47     OstTrace1( TRACE_NORMAL, CHELLOTRACEFN_CHELLOTRACEFN_CTOR_TEXTWITHTAB, "[0x%08x] Constructor -   Trace text with tabs", this );
       
    48     }
       
    49 
       
    50 CHelloTraceFn::~CHelloTraceFn()
       
    51     {
       
    52     OstTrace1( TRACE_NORMAL, CHELLOTRACEFN_CHELLOTRACEFN_DTOR, "[0x%08x] Destructor", this );    
       
    53     }
       
    54 
       
    55 void CHelloTraceFn::Simple()
       
    56     {
       
    57     OstTraceFunctionEntry1( CHELLOTRACEFN_SIMPLE_ENTRY, this );
       
    58     OstTraceFunctionEntryExt( CHELLOTRACEFN_SIMPLE_ENTRY_EXT_NO_PARAM, this );
       
    59     // ...
       
    60     OstTraceFunctionExit1( CHELLOTRACEFN_SIMPLE_EXIT, this );
       
    61     }
       
    62 
       
    63 void CHelloTraceFn::OutputsParams(TInt aParam, TFnEnum aEnumParam)
       
    64     {
       
    65     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTSPARAMS_ENTRY, this );
       
    66     Simple();
       
    67     OstTraceFunctionExit1( CHELLOTRACEFN_OUTPUTSPARAMS_EXIT, this );
       
    68     }
       
    69 void CHelloTraceFn::OutputsParams2(TInt /*aParam*/, TFnEnum aEnumParam)
       
    70     {
       
    71     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTSPARAMS2_PRAMCOMMENTED_ENTRY, this );
       
    72     Simple();
       
    73     OstTraceFunctionExit1( CHELLOTRACEFN_OUTPUTSPARAMS2_EXIT, this );
       
    74     }
       
    75     
       
    76 void CHelloTraceFn::OutputsParams3(TInt /*aParam*/, TFnEnum /*aEnumParam*/)
       
    77     {
       
    78     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTSPARAMS3_ALLPARAMCOMMENTED_ENTRY, this );
       
    79     Simple();
       
    80     OstTraceFunctionExit1( CHELLOTRACEFN_OUTPUTSPARAMS3_EXIT, this );
       
    81     }    
       
    82 
       
    83 void CHelloTraceFn::StaticOutputsParamsL(TInt aParam)
       
    84     {
       
    85     OstTraceFunctionEntryExt( CHELLOTRACEFN_STATICOUTPUTSPARAMS_ENTRY, NULL );
       
    86     CHelloTraceFn* example = CHelloTraceFn::NewLC();
       
    87     example->Simple();    
       
    88     CleanupStack::PopAndDestroy(example);
       
    89     OstTraceFunctionExit0( CHELLOTRACEFN_STATICOUTPUTSPARAMS_EXIT );    
       
    90     }
       
    91 
       
    92 void CHelloTraceFn::OutputsSignedIntegers(TInt8 aParam8,   TInt16 aParam16, 
       
    93                                           TInt32 aParam32, TInt64 aParam64)
       
    94     {
       
    95     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTSSIGNEDINTEGERS_ENTRY, this );
       
    96     // ...
       
    97     OstTraceFunctionExit1( CHELLOTRACEFN_OUTPUTSSIGNEDINTEGERS_EXIT, this );
       
    98     }
       
    99 
       
   100 void CHelloTraceFn::OutputsUnsignedIntegers(TUint8 aParam8,   TUint16 aParam16, 
       
   101                                             TUint32 aParam32, TUint64 aParam64)
       
   102     {
       
   103     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTSUNSIGNEDINTEGERS_ENTRY, this );
       
   104     // ...
       
   105     OstTraceFunctionExit1( CHELLOTRACEFN_OUTPUTSUNSIGNEDINTEGERS_EXIT, this );
       
   106     }
       
   107 
       
   108 
       
   109 TInt CHelloTraceFn::OutputsTIntReturnValue()
       
   110     {
       
   111     OstTraceFunctionEntry1( CHELLOTRACEFN_OUTPUTSTINTRETURNVALUE_ENTRY, this );
       
   112     TInt ret = KErrNone;
       
   113     // ...
       
   114     OstTraceFunctionExitExt( CHELLOTRACEFN_OUTPUTSTINTRETURNVALUE_EXIT, this, ret );
       
   115     return ret;
       
   116     }
       
   117 
       
   118 TInt64 CHelloTraceFn::OutputsTInt64ReturnValue()
       
   119     {
       
   120     OstTraceFunctionEntry1( CHELLOTRACEFN_OUTPUTSTINT64RETURNVALUE_ENTRY, this );
       
   121     TInt64 ret = (TInt64) 2 << 40;
       
   122     // ...
       
   123     OstTraceFunctionExitExt( CHELLOTRACEFN_OUTPUTSTINT64RETURNVALUE_EXIT, this, ret );
       
   124     return ret;
       
   125     }
       
   126 
       
   127 CHelloTraceFn::TFnEnum CHelloTraceFn::OutputsTFnEnumReturnValue()
       
   128     {
       
   129     OstTraceFunctionEntry1( CHELLOTRACEFN_OUTPUTSTFNENUMRETURNVALUE_ENTRY, this );
       
   130     TFnEnum ret = EExample1;
       
   131     // ...
       
   132     OstTraceFunctionExitExt( CHELLOTRACEFN_OUTPUTSTFNENUMRETURNVALUE_EXIT, this, ret );
       
   133     return ret;    
       
   134     }
       
   135 
       
   136 CActive* CHelloTraceFn::OutputsUnknownPtrType(CActive* aActive)
       
   137     {
       
   138     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTSUNKNOWNPTRTYPE_ENTRY, this );    
       
   139     // ...
       
   140     OstTraceFunctionExitExt( CHELLOTRACEFN_OUTPUTSUNKNOWNPTRTYPE_EXIT, this, (TUint) aActive );
       
   141     return aActive;
       
   142     }
       
   143 
       
   144 CActive& CHelloTraceFn::OutputsUnknownRefType(CActive& aActive)
       
   145     {
       
   146     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTSUNKNOWNREFTYPE_ENTRY, this );
       
   147     // ...
       
   148     OstTraceFunctionExitExt( CHELLOTRACEFN_OUTPUTSUNKNOWNREFTYPE_EXIT, this, (TUint) &aActive );    
       
   149     return aActive;
       
   150     }
       
   151 
       
   152 // The following doesn't compile as the Trace Compiler doesn't generate
       
   153 // the correct OstTraceGenExt(...) function for it
       
   154 //void CHelloTraceFn::OutputMissingParamsBug(TInt /*aCommentParam*/, TInt)
       
   155 //    {
       
   156 //    OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTMISSINGPARAMSBUG_ENTRY, this );
       
   157 //    // ...
       
   158 //    OstTraceFunctionExit1( CHELLOTRACEFN_OUTPUTMISSINGPARAMSBUG_EXIT, this );    
       
   159 //    }
       
   160 
       
   161 // The following compiles and works but outputs the following warning
       
   162 // warning: HelloTraceFn.cpp, line xxx: Parameter did not have a name and was not added to trace
       
   163 // The fact that this cannot be suppressed is a known problem we're working on.
       
   164 void CHelloTraceFn::OutputMissingParams(TInt aUsedParam, TInt /*aCommentParam*/, TInt)
       
   165     {
       
   166     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTMISSINGPARAMS_ENTRY, this );
       
   167     // ...
       
   168     OstTraceFunctionExit1( CHELLOTRACEFN_OUTPUTMISSINGPARAMS_EXIT, this );
       
   169     }
       
   170 
       
   171 // The following doesn't work as the Trace Compiler outputs:
       
   172 // error: HelloTraceFn.cpp, line xxx: Class / function name for trace could not be determined x3
       
   173 //#ifdef _DEBUG
       
   174 //void CHelloTraceFn::PreProcessedFn(TInt aDbgParam)
       
   175 //    {
       
   176 //    OstTraceFunctionEntryExt( PRE_PROCESSED_ENTRTY_1, this );
       
   177 //#else
       
   178 //void CHelloTraceFn::PreProcessedFn()
       
   179 //    {
       
   180 //    OstTraceFunctionEntry1( PRE_PROCESSED_ENTRTY_2, this );
       
   181 //#endif
       
   182 //    Simple();
       
   183 //    OstTraceFunctionExit1( CHELLOTRACEFN_PREPROCESSEDFN_EXIT, this );
       
   184 //    }
       
   185 
       
   186 // Workaround example code until a proper fix is provided
       
   187 #ifdef _DEBUG
       
   188 void CHelloTraceFn::PreProcessedFn(TInt aDbgParam)
       
   189     {
       
   190     OstTraceExt2( TRACE_FLOW, CHELLOTRACEFN_PREPROCESSEDFN_ENTRY_1, "CHelloTraceFn::PreProcessedFn: > CHelloTraceFn::PreProcessedFn;aDbgParam=%d;this=%x", (TInt) aDbgParam, (TUint) this);
       
   191 #else
       
   192 void CHelloTraceFn::PreProcessedFn()
       
   193     {
       
   194     OstTrace1( TRACE_FLOW, CHELLOTRACEFN_PREPROCESSEDFN_ENTRY_2, "CHelloTraceFn::PreProcessedFn: > CHelloTraceFn::PreProcessedFn;this=%x", (TUint) this);
       
   195 #endif
       
   196     Simple();
       
   197     OstTrace1( TRACE_FLOW, CHELLOTRACEFN_PREPROCESSEDFN_EXIT, "CHelloTraceFn::PreProcessedFn: < CHelloTraceFn::PreProcessedFn;this=%x", (TUint) this);
       
   198     }
       
   199 
       
   200