tracesrv/tracecore/btrace_handler/inc/TraceCoreActivationBase.h
changeset 56 aa2539c91954
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
       
     1 // Copyright (c) 2007-2010 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 "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 // Base class for activation classes
       
    15 //
       
    16 
       
    17 #ifndef __TRACECOREACTIVATIONBASE_H__
       
    18 #define __TRACECOREACTIVATIONBASE_H__
       
    19 
       
    20 
       
    21 // Include files
       
    22 #include "TraceCoreSubscriber.h"
       
    23 #include "TraceCoreActivation.h"
       
    24 
       
    25 //forward declarations
       
    26 class DMutex;
       
    27 
       
    28 /**
       
    29  * Base class for activation objects. This extends the subscriber base class to receive activation updates
       
    30  */
       
    31 NONSHARABLE_CLASS( DTraceCoreActivationBase ) : public DTraceCoreSubscriber, public MTraceCoreActivation
       
    32     {
       
    33 public:
       
    34 
       
    35     /**
       
    36      * Constructor
       
    37      */
       
    38     DTraceCoreActivationBase();
       
    39     
       
    40     /**
       
    41      * Destructor
       
    42      */
       
    43     virtual ~DTraceCoreActivationBase();
       
    44     
       
    45     /**
       
    46      * Registers an activation notification interface
       
    47      * 
       
    48      * @param aNotification the notification interface
       
    49      */
       
    50     TInt RegisterActivationNotification( MTraceCoreActivationNotification& aNotification );
       
    51     
       
    52 protected:
       
    53 
       
    54     /**
       
    55      * Subscribes to message ID and registers to activation interface list
       
    56      * 
       
    57      * @param aMessageID the message id to be subscribed
       
    58      */         
       
    59     TInt Init( TUint32 aMessageId );
       
    60 
       
    61     /**
       
    62      * Subscribes to message ID and registers to activation interface list
       
    63      * 
       
    64      * @param aMessageID the message id to be subscribed
       
    65      */
       
    66     TInt SubscribeMessage( TUint32 aMessageId, TMessageHeaderFormat aMsgFormat );
       
    67 
       
    68     /**
       
    69      * Sends notification to TraceCore internal activation notification interfaces
       
    70      * 
       
    71      * @param aFromSettings ETrue if activation was due to settings read, EFalse if from some other source
       
    72      * @param aComponentId Component ID of the activation
       
    73      */
       
    74     void NotifyInternalActivation( TBool aFromSettings, TUint32 aComponentId );
       
    75     
       
    76     /**
       
    77      * Send response
       
    78      * 
       
    79      * @param aMessage Response message
       
    80      */
       
    81     void SendResponse( TTraceMessage &aMessage );
       
    82     
       
    83     /**
       
    84      * Prevent read-check to internal structures (fast lock).
       
    85      */
       
    86     inline TInt ReadLock();
       
    87     
       
    88     /**
       
    89      * Restore read-access to internal structures.
       
    90      */
       
    91     inline void ReadUnlock(TInt aIrqLevel);
       
    92     
       
    93     
       
    94 protected: //data
       
    95     
       
    96     /**
       
    97      * Lock used in 'critical path' where performance is very important.
       
    98      * It is used in those routines where structures are checked and not modified.
       
    99      */
       
   100 #if defined(__SMP__)
       
   101     TSpinLock   iActivationReadLock;
       
   102 #endif
       
   103     
       
   104     /**
       
   105      * Used to store Irq level between spin lock/unlock operation.
       
   106      */
       
   107     TInt iIrqLevel;
       
   108     
       
   109 private:
       
   110 
       
   111     /**
       
   112      * Array of activation notification interfaces
       
   113      */
       
   114     RPointerArray< MTraceCoreActivationNotification > iActivationNotification;
       
   115     };
       
   116 
       
   117 
       
   118 #include "TraceCoreActivationBase.inl"
       
   119 
       
   120 
       
   121 #endif /* __TRACECOREACTIVATIONBASE_H__ */