uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h
changeset 27 70e659bb284f
parent 19 f5bac0badc7e
child 29 ac3859d43844
equal deleted inserted replaced
26:8eb818df3c66 27:70e659bb284f
     1 /*
       
     2 * Copyright (c) 2009 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 /**
     1 /**
    18  * @see alfmoduletest.h for class implementations that these defines use.
     2  * @see alfmoduletest.h for class implementations that these defines use.
    19  */
     3  */
    20 
     4 
    21 #ifndef ALF_MODULE_TEST_DEFINES_H
     5 #ifndef ALF_MODULE_TEST_DEFINES_H
    41     #define AMT_GET_VALUE(x, member)
    25     #define AMT_GET_VALUE(x, member)
    42     #define AMT_INC_COUNTER_IF(cond, member)
    26     #define AMT_INC_COUNTER_IF(cond, member)
    43     #define AMT_DEC_COUNTER_IF(cond, member)
    27     #define AMT_DEC_COUNTER_IF(cond, member)
    44     #define AMT_SET_VALUE_IF(cond, member, val)
    28     #define AMT_SET_VALUE_IF(cond, member, val)
    45     #define AMT_GET_VALUE_IF(cond, x, member)
    29     #define AMT_GET_VALUE_IF(cond, x, member)
       
    30 
       
    31     #define AMT_ADD_TIME(handle, member, effects)
       
    32     #define AMT_GET_TIME(x, handle, index, effects)
       
    33     #define AMT_GET_TIME_POINT_COUNT(handle, x)
       
    34     #define AMT_RESET_TIME(handle)
    46     
    35     
    47     #define AMT_MAP_PTR_TO_KEY_CAST( keyPtr )
    36     #define AMT_MAP_PTR_TO_KEY_CAST( keyPtr )
    48     #define AMT_MAP_CPTR_TO_KEY_CAST( keyCPtr )
    37     #define AMT_MAP_CPTR_TO_KEY_CAST( keyCPtr )
    49     #define AMT_MAP_APPEND_IF(cond, memberMap, key, defaultValue, type)
    38     #define AMT_MAP_APPEND_IF(cond, memberMap, key, defaultValue, type)
    50     #define AMT_MAP_APPEND(memberMap, key, defaultValue, type)
    39     #define AMT_MAP_APPEND(memberMap, key, defaultValue, type)
   104     // Conditional single operation macros, that will do lock/unlock.
    93     // Conditional single operation macros, that will do lock/unlock.
   105     #define AMT_INC_COUNTER_IF(cond, member)        AMT_FUNC_EXC_IF((cond), AMT_DATA()->member++)
    94     #define AMT_INC_COUNTER_IF(cond, member)        AMT_FUNC_EXC_IF((cond), AMT_DATA()->member++)
   106     #define AMT_DEC_COUNTER_IF(cond, member)        AMT_FUNC_EXC_IF((cond), AMT_DATA()->member--)
    95     #define AMT_DEC_COUNTER_IF(cond, member)        AMT_FUNC_EXC_IF((cond), AMT_DATA()->member--)
   107     #define AMT_SET_VALUE_IF(cond, member, val)     AMT_FUNC_EXC_IF((cond), AMT_DATA()->member=(val))
    96     #define AMT_SET_VALUE_IF(cond, member, val)     AMT_FUNC_EXC_IF((cond), AMT_DATA()->member=(val))
   108     #define AMT_GET_VALUE_IF(cond, x, member)       AMT_FUNC_EXC_IF((cond), (x) = AMT_DATA()->member)
    97     #define AMT_GET_VALUE_IF(cond, x, member)       AMT_FUNC_EXC_IF((cond), (x) = AMT_DATA()->member)
       
    98     
       
    99     #define AMT_ADD_TIME(handle, member, effects)   AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ TInt nextFreeIndex = AMT_DATA()->iTimeMap[timemapIndex].iCounter; AMT_DATA()->iTimeMap[timemapIndex].iTimeStamp[nextFreeIndex] = member; AMT_DATA()->iTimeMap[timemapIndex].iCounter++; timemapIndex = 100; break;} timemapIndex++; } if (timemapIndex == 10) { if (AMT_DATA()->iNextFreeMap == 10) { AMT_DATA()->iNextFreeMap = 0;} TInt nextFreeMap = AMT_DATA()->iNextFreeMap; AMT_DATA()->iTimeMap[nextFreeMap].iCounter = 1; AMT_DATA()->iTimeMap[nextFreeMap].iHandle = handle; AMT_DATA()->iTimeMap[nextFreeMap].iTimeStamp[0] = member; AMT_DATA()->iTimeMap[nextFreeMap].iEffects = effects; AMT_DATA()->iNextFreeMap++; /*RDebug::Printf("Handle: %d, %d %d %d", handle, timemapIndex, AMT_DATA()->iNextFreeMap, member)*/;})
       
   100     #define AMT_GET_TIME(x, handle, index, effects) AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ (x) = AMT_DATA()->iTimeMap[timemapIndex].iTimeStamp[index];(effects) = AMT_DATA()->iTimeMap[timemapIndex].iEffects;break;}timemapIndex++;}if(timemapIndex == 10){(x) = KErrNotFound;(effects) = EFalse;})
       
   101     #define AMT_GET_TIME_POINT_COUNT(handle, x)     AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ (x) = AMT_DATA()->iTimeMap[timemapIndex].iCounter;timemapIndex = 100;}timemapIndex++;}if(timemapIndex == 10){(x) = KErrNotFound;})
       
   102     #define AMT_RESET_TIME(handle)                  AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ AMT_DATA()->iTimeMap[timemapIndex].iHandle = 0; AMT_DATA()->iTimeMap[timemapIndex].iCounter = 0;AMT_DATA()->iTimeMap[timemapIndex].iEffects = 0;break;}timemapIndex++;})
   109     
   103     
   110     // Map operation macros, that will do lock/unlock
   104     // Map operation macros, that will do lock/unlock
   111     #define AMT_MAP_PTR_TO_KEY_CAST( keyPtr )                                                   reinterpret_cast< TInt >( keyPtr )
   105     #define AMT_MAP_PTR_TO_KEY_CAST( keyPtr )                                                   reinterpret_cast< TInt >( keyPtr )
   112     #define AMT_MAP_CPTR_TO_KEY_CAST( keyCPtr )                                                 AMT_MAP_PTR_TO_KEY_CAST( static_cast< const CBase* >( keyCPtr ) )
   106     #define AMT_MAP_CPTR_TO_KEY_CAST( keyCPtr )                                                 AMT_MAP_PTR_TO_KEY_CAST( static_cast< const CBase* >( keyCPtr ) )
   113     #define AMT_MAP_APPEND_IF(cond, memberMap, key, defaultValue, type)                         AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.Append(type, key, defaultValue))
   107     #define AMT_MAP_APPEND_IF(cond, memberMap, key, defaultValue, type)                         AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.Append(type, key, defaultValue))
   167         AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorClipRect ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorClipRect ); \
   161         AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorClipRect ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorClipRect ); \
   168         AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorFlags ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorFlag ); \
   162         AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorFlags ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorFlag ); \
   169         AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorColor ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorColor )
   163         AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorColor ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorColor )
   170 
   164 
   171 #define AMT_MAP_RENDER_STAGE_ADD_LAYER() \
   165 #define AMT_MAP_RENDER_STAGE_ADD_LAYER() \
   172         AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeRenderStageCreateLayer ); \
   166         AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeCreateLayer ); \
   173         AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeRenderStageReleaseLayer )
   167         AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeReleaseLayer ); \
       
   168         AMT_MAP_APPEND_IF( aLayer, iIntMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), 0, EAlfModuleTestTypeLayerOrdinalPosition )
   174 
   169 
   175 #define AMT_MAP_RENDER_STAGE_ADD_LAYER_LINK() \
   170 #define AMT_MAP_RENDER_STAGE_ADD_LAYER_LINK() \
   176         AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeRenderStageCreateLayer ); \
   171         AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeCreateLayer ); \
   177         AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeRenderStageReleaseLayer ); \
   172         AMT_MAP_APPEND_LINK( iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeCreateLayer ); \
   178         \
   173         AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeReleaseLayer ); \
   179         AMT_MAP_SET_VALUE( iSurfaceMap, windowId, aLayer.Surface(), EAlfModuleTestTypeRenderStageCreateLayer )
   174         AMT_MAP_APPEND_LINK( iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeReleaseLayer ); \
       
   175         AMT_MAP_APPEND_LINK( iIntMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeLayerOrdinalPosition ); \
       
   176         AMT_MAP_APPEND_LINK( iIntMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeLayerOrdinalPosition ); \
       
   177         \
       
   178         AMT_MAP_SET_VALUE( iSurfaceMap, windowId, aLayer.Surface(), EAlfModuleTestTypeCreateLayer )
       
   179 
       
   180 #define AMT_MAP_RENDER_STAGE_REMOVE_LAYER() \
       
   181         AMT_MAP_SET_VALUE_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), aLayer->Surface(), EAlfModuleTestTypeReleaseLayer )
   180 
   182 
   181 
   183 
   182 // Streamer defines
   184 // Streamer defines
   183                           
   185                           
   184 #define AMT_MAP_STREAMER_NODE_WINDOW_CONSTRUCT() \
   186 #define AMT_MAP_STREAMER_NODE_WINDOW_CONSTRUCT() \
   243         AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorType ); \
   245         AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorType ); \
   244         AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorClipRect ); \
   246         AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorClipRect ); \
   245         AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorFlag ); \
   247         AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorFlag ); \
   246         AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorColor )
   248         AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorColor )
   247 
   249 
   248         
   250 #define AMT_MAP_BRIDGE_SET_ORDINAL_POSITION() \
       
   251         AMT_MAP_SET_VALUE_IF( windowAttributes, iIntMap, windowNodeId, windowAttributes->iOrdinalPosition, EAlfModuleTestTypeLayerOrdinalPosition )
       
   252 
       
   253 
   249 #endif // ALF_MODULE_TEST_DEFINES_H
   254 #endif // ALF_MODULE_TEST_DEFINES_H
   250 
   255 
   251 // End of File
   256 // End of File