Changeset 11057 for OpenSceneGraph/trunk/src/osg/Notify.cpp
- Timestamp:
- 02/12/10 12:45:00 (3 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osg/Notify.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osg/Notify.cpp
r10764 r11057 115 115 static osg::ApplicationUsageProxy Notify_e0(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE, "OSG_NOTIFY_LEVEL <mode>", "FATAL | WARN | NOTICE | DEBUG_INFO | DEBUG_FP | DEBUG | INFO | ALWAYS"); 116 116 117 static bool s_NeedNotifyInit = true; 117 118 static osg::NotifySeverity g_NotifyLevel = osg::NOTICE; 118 119 static osg::NullStream *g_NullStream; … … 121 122 void osg::setNotifyLevel(osg::NotifySeverity severity) 122 123 { 123 osg::initNotifyLevel();124 if (s_NeedNotifyInit) osg::initNotifyLevel(); 124 125 g_NotifyLevel = severity; 125 126 } … … 128 129 osg::NotifySeverity osg::getNotifyLevel() 129 130 { 130 osg::initNotifyLevel();131 if (s_NeedNotifyInit) osg::initNotifyLevel(); 131 132 return g_NotifyLevel; 132 133 } … … 141 142 osg::NotifyHandler* osg::getNotifyHandler() 142 143 { 143 osg::initNotifyLevel();144 if (s_NeedNotifyInit) osg::initNotifyLevel(); 144 145 osg::NotifyStreamBuffer *buffer = static_cast<osg::NotifyStreamBuffer *>(g_NotifyStream->rdbuf()); 145 146 return buffer ? buffer->getNotifyHandler() : 0; … … 148 149 bool osg::initNotifyLevel() 149 150 { 150 static bool s_NotifyInit = false;151 151 static osg::NullStream s_NullStream; 152 152 static osg::NotifyStream s_NotifyStream; 153 154 if (s_NotifyInit) return true;155 153 156 154 g_NullStream = &s_NullStream; … … 194 192 buffer->setNotifyHandler(new StandardNotifyHandler); 195 193 196 s_N otifyInit = true;194 s_NeedNotifyInit = false; 197 195 198 196 return true; … … 200 198 } 201 199 200 #ifndef OSG_NOTIFY_DISABLED 202 201 bool osg::isNotifyEnabled( osg::NotifySeverity severity ) 203 202 { 203 if (s_NeedNotifyInit) osg::initNotifyLevel(); 204 204 return severity<=g_NotifyLevel; 205 205 } 206 #endif 206 207 207 208 std::ostream& osg::notify(const osg::NotifySeverity severity) 208 209 { 209 static bool initialized = false; 210 if (!initialized) 211 { 212 initialized = osg::initNotifyLevel(); 213 } 214 215 if (severity<=g_NotifyLevel) 210 if (s_NeedNotifyInit) osg::initNotifyLevel(); 211 212 if (osg::isNotifyEnabled(severity)) 216 213 { 217 214 g_NotifyStream->setCurrentSeverity(severity);
