Show
Ignore:
Timestamp:
02/12/10 12:45:00 (5 years ago)
Author:
robert
Message:

Introduced OSG_WARN, OSG_NOTICE, OSG_INFO, OSG_DEBUG convinience macros that map to OSG_NOTIFY(osg::WARN) etc.

Introduced the OSG_NOTIFY_DISABLE Cmake variable + include/osg/Config #define to control whether the OpenSceneGraph build
should disable the notification system completely. By setting OSG_NOTIFY_DISABLE to ON in CMake and then rebuilding the
the OSG you can get a slightly smaller (~1%) and more slightly efficient library which can be good for shipping applications,
but with downside of reduced ability to detect runtime problems and their causes.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osg/Notify

    r11047 r11057  
    4646extern OSG_EXPORT NotifySeverity getNotifyLevel(); 
    4747 
    48 /** is notification enabled, given the current setNotifyLevel() setting? */ 
    49 extern OSG_EXPORT bool isNotifyEnabled(NotifySeverity severity); 
    50  
    5148/** initialize notify level. */ 
    5249extern OSG_EXPORT bool initNotifyLevel(); 
     50 
     51#ifdef OSG_NOTIFY_DISABLED 
     52    inline bool isNotifyEnabled(NotifySeverity) { return false; } 
     53#else 
     54    /** is notification enabled, given the current setNotifyLevel() setting? */ 
     55    extern OSG_EXPORT bool isNotifyEnabled(NotifySeverity severity); 
     56#endif 
    5357 
    5458/** notify messaging function for providing fatal through to verbose 
     
    7781 
    7882#define OSG_NOTIFY(level) if (isNotifyEnabled(level)) osg::notify(level) 
    79  
    80 #if _DEBUG 
    81     #define OSG_DEBUG_NOTIFY(level) if (isNotifyEnabled(level)) osg::notify(level) 
    82 #else 
    83     // when using an optimized build use if (false) to tell the compiler to ignore the rest of the notify. 
    84     #define OSG_DEBUG_NOTIFY(level) if (false) osg::notify(level) 
    85 #endif 
     83#define OSG_FATAL OSG_NOTIFY(osg::FALTAL) 
     84#define OSG_WARN OSG_NOTIFY(osg::WARN) 
     85#define OSG_NOTICE OSG_NOTIFY(osg::NOTICE) 
     86#define OSG_INFO OSG_NOTIFY(osg::INFO) 
     87#define OSG_DEBUG OSG_NOTIFY(osg::DEBUG_INFO) 
    8688 
    8789/** Handler processing output of notification stream. It acts as a sink to