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