1 //-------------------------------------------------------------------
2 // License:  See top level LICENSE.txt file.
3 //
4 // Author:  Garrett Potts
5 //
6 // Description:
7 //
8 // Contains class declaration for ossimNotify
9 //-------------------------------------------------------------------
10 //  $Id: ossimNotify.h 23467 2015-08-14 13:59:09Z gpotts $
11 #ifndef ossimNotify_HEADER
12 #define ossimNotify_HEADER 1
13 
14 #include <ossim/base/ossimErrorCodes.h>
15 #include <ossim/base/ossimConstants.h>
16 #include <ossim/base/ossimFilename.h>
17 #include <iostream>
18 #include <fstream>
19 
20 /**
21   * Notification level enumeration.  This specifies the
22   * level of the mesage being written.
23   */
24 enum ossimNotifyLevel
25 {
26    ossimNotifyLevel_ALWAYS = 0,
27    ossimNotifyLevel_FATAL  = 1,
28    ossimNotifyLevel_WARN   = 2,
29    ossimNotifyLevel_NOTICE = 3,
30    ossimNotifyLevel_INFO   = 4,
31    ossimNotifyLevel_DEBUG  = 5
32 };
33 
34 /**
35  * Flags to allow the user to turn off certain notification levels
36  *
37  */
38 enum ossimNotifyFlags
39 {
40    ossimNotifyFlags_NONE   = 0,
41    ossimNotifyFlags_FATAL  = 1,
42    ossimNotifyFlags_WARN   = 2,
43    ossimNotifyFlags_NOTICE = 4,
44    ossimNotifyFlags_INFO   = 8,
45    ossimNotifyFlags_DEBUG  = 16,
46    ossimNotifyFlags_ALL    = (ossimNotifyFlags_FATAL|
47                               ossimNotifyFlags_WARN|
48                               ossimNotifyFlags_NOTICE|
49                               ossimNotifyFlags_INFO|
50                               ossimNotifyFlags_DEBUG)
51 };
52 
53 OSSIMDLLEXPORT void ossimSetDefaultNotifyHandlers();
54 
55 OSSIMDLLEXPORT void ossimSetNotifyStream(std::ostream* outputStream,
56                                          ossimNotifyFlags whichLevelsToRedirect=ossimNotifyFlags_ALL);
57 
58 OSSIMDLLEXPORT std::ostream* ossimGetNotifyStream(ossimNotifyLevel whichLevel);
59 
60 OSSIMDLLEXPORT bool ossimIsReportingEnabled();
61 
62 OSSIMDLLEXPORT std::ostream& ossimNotify(ossimNotifyLevel level = ossimNotifyLevel_WARN);
63 OSSIMDLLEXPORT void ossimNotify(ossimString msg, ossimNotifyLevel notifyLevel = ossimNotifyLevel_WARN);
64 /**
65  *
66  */
67 OSSIMDLLEXPORT void ossimSetLogFilename(const ossimFilename& filename);
68 
69 /** @brief Returns the log filename if set. */
70 /* OSSIMDLLEXPORT const char* ossimGetLogFilename(); */
71 OSSIMDLLEXPORT void ossimGetLogFilename(ossimFilename& logFile);
72 
73 
74 /**
75  *
76  */
77 OSSIMDLLEXPORT void ossimDisableNotify(ossimNotifyFlags notifyLevel=ossimNotifyFlags_ALL);
78 
79 /**
80  *
81  */
82 OSSIMDLLEXPORT void ossimEnableNotify(ossimNotifyFlags notifyLevel=ossimNotifyFlags_ALL);
83 
84 
85 OSSIMDLLEXPORT void ossimSetNotifyFlag(ossimNotifyFlags notifyFlags);
86 OSSIMDLLEXPORT void ossimPushNotifyFlags();
87 OSSIMDLLEXPORT void ossimPopNotifyFlags();
88 OSSIMDLLEXPORT ossimNotifyFlags ossimGetNotifyFlags();
89 
90 
91 /**
92  *
93  */
94 OSSIMDLLEXPORT void  ossimSetError( const char *className,
95                                     ossim_int32 error,
96                                     const char *fmtString=0, ...);
97 
98 /**
99  * This is for general warnings and information feedback
100  *
101  * @param fmtString a C printf() style formatting string used (with the
102  * following arguments) to prepare an error message.
103  */
104 OSSIMDLLEXPORT void  ossimSetInfo( const char *className,
105                                    const char *fmtString=0, ...);
106 
107 #endif /* #ifndef ossimNotify_HEADER */
108