OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Notify.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 
14 #ifndef OSG_NOTIFY_H
15 #define OSG_NOTIFY_H 1
16 
17 #include <osg/Export>
18 #include <osg/Referenced> // for NotifyHandler
19 
20 #include <ostream>
21 
22 namespace osg {
23 
31  ALWAYS=0,
32  FATAL=1,
33  WARN=2,
34  NOTICE=3,
35  INFO=4,
38 };
39 
43 extern OSG_EXPORT void setNotifyLevel(NotifySeverity severity);
44 
47 
49 extern OSG_EXPORT bool initNotifyLevel();
50 
51 #ifdef OSG_NOTIFY_DISABLED
52  inline bool isNotifyEnabled(NotifySeverity) { return false; }
53 #else
54 
55  extern OSG_EXPORT bool isNotifyEnabled(NotifySeverity severity);
56 #endif
57 
78 extern OSG_EXPORT std::ostream& notify(const NotifySeverity severity);
79 
80 inline std::ostream& notify(void) { return notify(osg::INFO); }
81 
82 #define OSG_NOTIFY(level) if (osg::isNotifyEnabled(level)) osg::notify(level)
83 #define OSG_ALWAYS OSG_NOTIFY(osg::ALWAYS)
84 #define OSG_FATAL OSG_NOTIFY(osg::FATAL)
85 #define OSG_WARN OSG_NOTIFY(osg::WARN)
86 #define OSG_NOTICE OSG_NOTIFY(osg::NOTICE)
87 #define OSG_INFO OSG_NOTIFY(osg::INFO)
88 #define OSG_DEBUG OSG_NOTIFY(osg::DEBUG_INFO)
89 #define OSG_DEBUG_FP OSG_NOTIFY(osg::DEBUG_FP)
90 
105 {
106 public:
107  virtual void notify(osg::NotifySeverity severity, const char *message) = 0;
108 };
109 
113 extern OSG_EXPORT void setNotifyHandler(NotifyHandler *handler);
114 
117 
124 {
125 public:
126  void notify(osg::NotifySeverity severity, const char *message);
127 };
128 
129 #if defined(WIN32) && !defined(__CYGWIN__)
130 
135 class OSG_EXPORT WinDebugNotifyHandler : public NotifyHandler
136 {
137 public:
138  void notify(osg::NotifySeverity severity, const char *message);
139 };
140 
141 #endif
142 
143 }
144 
145 #endif
OSG_EXPORT void setNotifyLevel(NotifySeverity severity)
#define OSG_EXPORT
Definition: Export.h:43
OSG_EXPORT NotifySeverity getNotifyLevel()
OSG_EXPORT bool initNotifyLevel()
OSG_EXPORT bool isNotifyEnabled(NotifySeverity severity)
Definition: AlphaFunc.h:19
NotifySeverity
Definition: Notify.h:30
OSG_EXPORT NotifyHandler * getNotifyHandler()
OSG_EXPORT std::ostream & notify(const NotifySeverity severity)
OSG_EXPORT void setNotifyHandler(NotifyHandler *handler)