uiaccelerator_plat/alf_visual_api/inc/alf/alfstatic.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     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:   Static class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __ALFSTATIC_H__
       
    21 #define __ALFSTATIC_H__
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 /* Forward declarations. */
       
    26 class CAlfEnv;
       
    27 
       
    28 /**
       
    29  * Miscellaneous globally used functions, and thread local storage space.
       
    30  * 
       
    31  * CAlfStatic contains all the functions that tend to be used across classes.
       
    32  * These functions are written in a non-OO fashion because
       
    33  * they are used everywhere, so passing data such as delta step down through the
       
    34  * entire class heirarchy is inefficient.
       
    35  */
       
    36 NONSHARABLE_CLASS(CAlfStatic) : public CBase
       
    37     {
       
    38 public:
       
    39 
       
    40     /* Constructors and destructor. */
       
    41 
       
    42     /**
       
    43      * Constructor. The user application should not explicitly
       
    44      * construct a CAlfStatic - it is constructed by CHuiEnv.
       
    45      *
       
    46      * @param aPrimaryEnv The toolkit environment. 
       
    47      */
       
    48     IMPORT_C static CAlfStatic* NewLC(CAlfEnv* aPrimaryEnv);
       
    49 
       
    50     /**
       
    51      * Constructor. The user application should not explicitly
       
    52      * construct a CAlfStatic - it is constructed by CHuiEnv.
       
    53      *
       
    54      * @param aPrimaryEnv The toolkit environment. 
       
    55      */
       
    56     IMPORT_C static CAlfStatic* NewL(CAlfEnv* aPrimaryEnv);
       
    57 
       
    58 
       
    59     /**
       
    60      * Destructor.
       
    61      */
       
    62     virtual ~CAlfStatic();
       
    63 
       
    64 
       
    65     /* Methods. */
       
    66 
       
    67     /**
       
    68      * Determines the primary CHuiEnv instance.
       
    69      */
       
    70     IMPORT_C static CAlfEnv& Env();
       
    71 
       
    72 protected:
       
    73 
       
    74     /* Constructors. */
       
    75 
       
    76     /**
       
    77      * Constructor. Should not be called through the API.
       
    78      */
       
    79     CAlfStatic();
       
    80 
       
    81     /**
       
    82      * Second-phase constructor.
       
    83      * @param aPrimaryEnv Pass in the environment.
       
    84      */
       
    85     void ConstructL(CAlfEnv* aPrimaryEnv);
       
    86 
       
    87 
       
    88 private:
       
    89 
       
    90     /* Private methods */
       
    91 
       
    92     /**
       
    93      * Returns a pointer to the thread-local data struct.
       
    94      */
       
    95     IMPORT_C static struct TTlsData* Data();
       
    96 
       
    97     /**
       
    98      * Updates the toolkit's time counters. This includes the toolkit's
       
    99      * realtime clock, the internal absolute clock (which is affected by the
       
   100      * time factor), the amount of elapsed time since last UpdateTime()
       
   101      * invocation, and the amount of elapsed time since the first UpdateTime()
       
   102      * invocation (which was done in the beginning of the first refresh).
       
   103      * 
       
   104      * @param aData TLS Data which encapsulates the internal time variables.
       
   105      */
       
   106     static void UpdateTime(struct TTlsData* aData);
       
   107 
       
   108 private:
       
   109 
       
   110     /**
       
   111      * Thread local storage for this DLL, as we cannot declare static
       
   112      * global variables in Symbian.
       
   113      */
       
   114     struct TTlsData* iData;
       
   115 
       
   116     friend class CAlfEnv;
       
   117     };
       
   118 
       
   119 #endif //__ALFSTATIC_H__