photosgallery/inc/glxassert.h
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-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:    Type-safe unique id template
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef GLXASSERT_H
       
    21 #define GLXASSERT_H
       
    22 
       
    23 #include <glxlog.h>
       
    24 #include <glxpanic.h> // enable client to directly use GLX - Panic
       
    25 
       
    26 /**
       
    27  * Used to assert the truth of some condition. If the condition is false, logging will be performed
       
    28  * and appropriate action taken. Unlike GLX_ASSERT_DEBUG it is defined in both release and debug builds.
       
    29  * 
       
    30  * Logging is performed using GLX_LOG_WARNING and is subject to GLX_LOG_WARNING being enabled.
       
    31  *
       
    32  * Code is generated for both debug and release builds.
       
    33  *
       
    34  * @param c A conditional expression which results in true or false.
       
    35  * @param p A function which is called if the conditional expression c is false.
       
    36  * @param l logging that is performed before function p is called.
       
    37  * 
       
    38  * @see GLX_ASSERT_DEBUG
       
    39  * @see GLX_LOG_WARNING
       
    40  */ 
       
    41 #define GLX_ASSERT_ALWAYS( c, p, l )    \
       
    42     {                                   \
       
    43     if ( !( c ) )                       \
       
    44         {                               \
       
    45         GLX_LOG_WARNING( l );           \
       
    46         p;                              \
       
    47         }                               \
       
    48     }
       
    49 
       
    50 #ifdef _DEBUG
       
    51 /**
       
    52  * Used to assert the truth of some condition. If the condition is false, logging will be performed
       
    53  * and appropriate action taken. Used in the same way as GLX_ASSERT_ALWAYS, except that it is only 
       
    54  * defined for debug builds.
       
    55  * 
       
    56  * Logging is performed using GLX_LOG_WARNING and is subject to GLX_LOG_WARNING being enabled.
       
    57  *
       
    58  * Code is generated for debug builds only.
       
    59  *
       
    60  * @param c A conditional expression which results in true or false.
       
    61  * @param p A function which is called if the conditional expression c is false.
       
    62  * @param l logging that is performed before function p is called.
       
    63  * 
       
    64  * @see GLX_ASSERT_ALWAYS
       
    65  * @see GLX_LOG_WARNING
       
    66  */ 
       
    67 # define GLX_ASSERT_DEBUG( c, p, l )    GLX_ASSERT_ALWAYS( c, p, l )
       
    68 #else // _DEBUG
       
    69 # define GLX_ASSERT_DEBUG( c, p, l )
       
    70 #endif // _DEBUG 
       
    71 
       
    72 #endif //GLXASSERT_H