locationtriggering/ltcontainer/inc/lbtramtriggerclientsidtree.h
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 2006 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:  This header file describes the class that handles the storage
       
    15 *                of triggers in RAM Structures.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef C_LBTCONTAINER_RAMTRIGGERSCLIENTSID_TREE_H
       
    21 #define C_LBTCONTAINER_RAMTRIGGERSCLIENTSID_TREE_H
       
    22 
       
    23 // system includes
       
    24 #include <e32base.h>
       
    25 #include <e32cmn.h>
       
    26 #include "lbtcontainertriggerentry.h"
       
    27 #include "lbttriggerclientsidkey.h"
       
    28 
       
    29 /**
       
    30  *  This class consists of the RAM structures that store the triggers.
       
    31  *
       
    32  *  It internally utilizes RAM memory and stores the trigger information
       
    33  *  in a efficient data structure.
       
    34  */
       
    35 NONSHARABLE_CLASS( CLbtRamTriggersClientSIDTree ) : public CBase
       
    36                                         
       
    37     {
       
    38 public:
       
    39 
       
    40 	struct TTriggerTreeBasedOnSID
       
    41 	{
       
    42 		TSecureId ownerSID;
       
    43 		RPointerArray <CLbtContainerTriggerEntry> trigArray;
       
    44 	};
       
    45     /**
       
    46      * The Symbian 2 phase constructor.
       
    47      * This method creates a new instance of CLbtRamTriggersClientSIDTree
       
    48      *
       
    49      * @return An instance of this class
       
    50      */
       
    51     static CLbtRamTriggersClientSIDTree* NewL();
       
    52 
       
    53     /**
       
    54      * Destructor.
       
    55      */
       
    56     virtual ~CLbtRamTriggersClientSIDTree();
       
    57 
       
    58 	/**
       
    59      *
       
    60      */    
       
    61     void AddToTreeL(TTriggerTreeBasedOnSID* aEntry );
       
    62     
       
    63     void UpdateEntry( TSecureId aSid,CLbtContainerTriggerEntry* aEntry);
       
    64     
       
    65     /** Reset the whole tree. Remove the entries if required */
       
    66     void ResetL();
       
    67     
       
    68     TBool IsEntryPresent(TSecureId aSid);
       
    69     void SetIteratorL();
       
    70     TTriggerTreeBasedOnSID* GetNextEntryL();
       
    71     TTriggerTreeBasedOnSID* FindEntry(TSecureId aSid);
       
    72     void DeleteFromTreeL( TSecureId aSid );
       
    73     void RemoveTriggerFromSIDTreeL( TSecureId aSid , TLbtTriggerId aId);
       
    74 
       
    75 protected: 
       
    76    
       
    77 
       
    78 private:
       
    79     /**
       
    80      * C++ constructor
       
    81      */
       
    82     CLbtRamTriggersClientSIDTree();
       
    83 
       
    84     /**
       
    85      * Symbian 2nd phase of construction
       
    86      */
       
    87     void ConstructL();
       
    88 
       
    89     /**
       
    90      * C++ Copy Constructor
       
    91      * The private copy constructor prevents the usage of copy constructors
       
    92      * with this class.
       
    93      */
       
    94     CLbtRamTriggersClientSIDTree(const CLbtRamTriggersClientSIDTree& aRamTriggersStore);
       
    95     
       
    96     /**
       
    97      * Overload equality operator
       
    98      * The private overload of the equality operator prevents the usage of
       
    99      * equality operator with this class.
       
   100      */
       
   101     CLbtRamTriggersClientSIDTree& operator =(const CLbtRamTriggersClientSIDTree& aRamTriggersStore);
       
   102     
       
   103     /**
       
   104      * Instance of TLbtTriggerKey to manage key values to access trigger 
       
   105      * information stored in the Btree
       
   106      */
       
   107     TLbtTriggerClientSIDKey                                  iKey;
       
   108     
       
   109     /**
       
   110      * Allocates memory to be used by the BTree to store trigger information
       
   111      */
       
   112     CMemPagePool*                                   iPool;
       
   113     
       
   114     /**
       
   115      * An instance of TBtreeFix to contain the list of enabled and valid 
       
   116      * triggers in the system
       
   117      */
       
   118     TBtreeFix< TTriggerTreeBasedOnSID*, TSecureId >*           iTriggerList;
       
   119     
       
   120     /**
       
   121      * To gain access to trigger information structure
       
   122      */
       
   123    friend class TLbtTriggerClientSIDKey; 
       
   124 
       
   125     TBtreeMark iMark;
       
   126      
       
   127     TBool iNext;
       
   128     };
       
   129 
       
   130 
       
   131 #endif // C_LBTCONTAINER_RAMTRIGGERS_STORE_H