natfw/natfwunsaf_protocols/unsaf_codec/inc/natfwunsafmessagelookuptable.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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 
       
    20 
       
    21 #ifndef CMESSAGELOOKUPTABLE_H
       
    22 #define CMESSAGELOOKUPTABLE_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32base.h>
       
    26 #include "natfwunsafmessagelookuptableitem.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 
       
    30 // CLASS DECLARATION
       
    31 /**
       
    32 * Lookup table for mapping UNSAF message types to factory functions.
       
    33 *
       
    34 *  @lib natfwunsafprotocols.lib
       
    35 */
       
    36 NONSHARABLE_CLASS(CMessageLookupTable) : public CBase
       
    37     {
       
    38     public: // Constructors and destructor
       
    39 
       
    40         static CMessageLookupTable* NewL();
       
    41 
       
    42         /**
       
    43         * Destructor, deletes the resources of CMessageLookupTable.
       
    44         */
       
    45         virtual ~CMessageLookupTable();
       
    46 
       
    47     public: // New functions
       
    48 
       
    49         /**
       
    50         * Searches for a factory function to instantiate an UNSAF message of
       
    51         * the indicated type.
       
    52         * @param aMessageType UNSAF message type
       
    53         * @return TFactoryFnPtr Function to instantiate a UNSAF message,
       
    54         *    or NULL if match was not found.
       
    55         */
       
    56         TFactoryFnPtr Find(TUint16 aMessageType);
       
    57 
       
    58     private:
       
    59 
       
    60         CMessageLookupTable();
       
    61 
       
    62         void ConstructL();
       
    63 
       
    64         /**
       
    65         * Adds a new item into the table.
       
    66         * @param aMessageType UNSAF message type
       
    67         * @param aFactoryFn Function to instantiate a UNSAF message
       
    68         */
       
    69         void AddItemL(CNATFWUNSAFMessage::TType aMessageType,
       
    70                          TFactoryFnPtr aFactoryFn);
       
    71 
       
    72     private: // Data
       
    73 
       
    74         RArray<TMessageLookupTableItem> iTable;
       
    75     };
       
    76 
       
    77 #endif // CMESSAGELOOKUPTABLE_H
       
    78 
       
    79