1 | /*
|
---|
2 | * TOPPERS/JSP Kernel
|
---|
3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
4 | * Just Standard Profile Kernel
|
---|
5 | *
|
---|
6 | * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
|
---|
7 | * Toyohashi Univ. of Technology, JAPAN
|
---|
8 | *
|
---|
9 | * ä¸è¨è使¨©è
|
---|
10 | ã¯ï¼ä»¥ä¸ã® (1)ã(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
11 | * ã«ãã£ã¦å
|
---|
12 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
13 | * è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
14 | * ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
15 | å¸ï¼ä»¥ä¸ï¼
|
---|
16 | * å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
17 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
18 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
19 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
20 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
21 | * ç¨ã§ããå½¢ã§åé
|
---|
22 | å¸ããå ´åã«ã¯ï¼åé
|
---|
23 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
24 | * è
|
---|
25 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è使¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
26 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
27 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
28 | * ç¨ã§ããªãå½¢ã§åé
|
---|
29 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
30 | * ã¨ï¼
|
---|
31 | * (a) åé
|
---|
32 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
33 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
34 | * 使¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
35 | * (b) åé
|
---|
36 | å¸ã®å½¢æ
|
---|
37 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
38 | * å ±åãããã¨ï¼
|
---|
39 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
40 | * 害ãããï¼ä¸è¨è使¨©è
|
---|
41 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
42 | 責ãããã¨ï¼
|
---|
43 | *
|
---|
44 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨è使¨©è
|
---|
45 | ã
|
---|
46 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
47 | * å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
48 | * æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
49 | *
|
---|
50 | * @(#) $Id: message.h,v 1.5 2003/12/20 06:51:58 takayuki Exp $
|
---|
51 | */
|
---|
52 |
|
---|
53 | // $Header: /home/CVS/configurator/base/message.h,v 1.5 2003/12/20 06:51:58 takayuki Exp $
|
---|
54 |
|
---|
55 | #ifndef MESSAGE_H
|
---|
56 | #define MESSAGE_H
|
---|
57 |
|
---|
58 | #ifdef _MSC_VER
|
---|
59 | # pragma warning(disable:4290) //C++ ã®ä¾å¤ã®æå®ã¯ç¡è¦ããã¾ãã颿°ã __declspec(nothrow) ã§ãªããã¨ã®ã¿è¡¨ç¤ºããã¾ãã
|
---|
60 | # pragma warning(disable:4786) //ãããã°æ
|
---|
61 | å ±ã§èå¥åã255æåã«åãæ¨ã¦ããã¾ããã
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | #include <string>
|
---|
65 | #include <sstream>
|
---|
66 | #include <stdarg.h>
|
---|
67 | #include <stdexcept>
|
---|
68 |
|
---|
69 | //#include "base/testsuite.h"
|
---|
70 | #include "base/singleton.h"
|
---|
71 | #include "base/except.h"
|
---|
72 |
|
---|
73 | /*
|
---|
74 | * æååæ´å½¢ãã«ãã¼ã¯ã©ã¹
|
---|
75 | */
|
---|
76 | class Formatter
|
---|
77 | {
|
---|
78 | protected:
|
---|
79 | std::string templatestring; //ãã³ãã¬ã¼ãæåå
|
---|
80 | std::stringstream content; //æååæ´å½¢ã¨æ¸å¼æ¸ã¿æååå¯è½å ´æç¨ã¹ããªã¼ã
|
---|
81 | bool accept; //弿°ãåå
|
---|
82 | ¥å¯è½ãã©ãã
|
---|
83 |
|
---|
84 | //次ã®å¼æ°ã®æ¿å
|
---|
85 | ¥å
|
---|
86 | ã¸ã¨ç§»å
|
---|
87 | void shift(void) throw();
|
---|
88 |
|
---|
89 | //æªè¨å®ã®å¼æ°ã (null) ã§ç½®æ
|
---|
90 | void shift_all(void) throw();
|
---|
91 |
|
---|
92 | public:
|
---|
93 | //ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿
|
---|
94 | Formatter(void) throw();
|
---|
95 |
|
---|
96 | //ã³ã³ã¹ãã©ã¯ã¿
|
---|
97 | Formatter(std::string src) throw();
|
---|
98 |
|
---|
99 | //ã³ãã¼ã³ã³ã¹ãã©ã¯ã¿
|
---|
100 | Formatter(const Formatter & src) throw();
|
---|
101 |
|
---|
102 | //ãã³ãã¬ã¼ãæååã®è¨å® (ä¸èº«ã¯æ¶ãã)
|
---|
103 | void assign(std::string src) throw();
|
---|
104 |
|
---|
105 | //å
|
---|
106 | 容ã®ã¯ãªã¢
|
---|
107 | void clear(void) throw();
|
---|
108 |
|
---|
109 | //代å
|
---|
110 | ¥æ¼ç®å
|
---|
111 | Formatter & operator =(const Formatter & src) throw();
|
---|
112 |
|
---|
113 | //弿°ã®è¨å®
|
---|
114 | template<class T>
|
---|
115 | Formatter & operator << (const T & src) throw()
|
---|
116 | {
|
---|
117 | std::string::size_type pos;
|
---|
118 |
|
---|
119 | //弿°ãåå
|
---|
120 | ¥å¯è½ãªã
|
---|
121 | if(accept) {
|
---|
122 | pos = content.str().size();
|
---|
123 | content << src;
|
---|
124 |
|
---|
125 | /* 空æåã§ãªããã°æ¬¡ã®æ¿å
|
---|
126 | ¥å ´æã«ç§»å */
|
---|
127 | if(pos != content.str().size())
|
---|
128 | shift();
|
---|
129 | }
|
---|
130 | return *this;
|
---|
131 | }
|
---|
132 |
|
---|
133 | //å
|
---|
134 | é¨ã¡ãã»ã¼ã¸ã®åãåºã
|
---|
135 | std::string str(void) throw();
|
---|
136 |
|
---|
137 | //æ¨æºåºåã¹ããªã¼ã ã¸ã®åºåç¨ operator << å®ç¾©
|
---|
138 | friend inline std::ostream & operator << (std::ostream & out, Formatter msg) throw()
|
---|
139 | {
|
---|
140 | out << msg.content.str();
|
---|
141 | return out;
|
---|
142 | }
|
---|
143 |
|
---|
144 | // TESTSUITE_PROTOTYPE(main)
|
---|
145 | };
|
---|
146 |
|
---|
147 | /*
|
---|
148 | * ã¡ãã»ã¼ã¸åºåç¨ã«2è¨èªå¯¾å¿ãè¡ã£ãæååæ´å½¢ãã«ãã¼ã¯ã©ã¹
|
---|
149 | */
|
---|
150 | class Message : public Formatter
|
---|
151 | {
|
---|
152 | public:
|
---|
153 | enum tagLanguage
|
---|
154 | {
|
---|
155 | ENGLISH = 0,
|
---|
156 | JAPANESE = 1,
|
---|
157 |
|
---|
158 | LAST_LANG, //æå¾ã®ä½ç½®
|
---|
159 | NEUTRAL = ENGLISH, //æ¨æºè¨èª
|
---|
160 | };
|
---|
161 |
|
---|
162 | /* åºåã¡ãã»ã¼ã¸è¨èªå¶å¾¡ã¯ã©ã¹ */
|
---|
163 | class MessageControl
|
---|
164 | {
|
---|
165 | protected:
|
---|
166 | int language; //ã©ã®è¨èªã使ç¨ããã®ã
|
---|
167 |
|
---|
168 | public:
|
---|
169 | //ã³ã³ã¹ãã©ã¯ã¿
|
---|
170 | SINGLETON_CONSTRUCTOR(MessageControl) throw() : language(NEUTRAL) {};
|
---|
171 |
|
---|
172 | //ã¢ã¯ã»ãµ
|
---|
173 | inline void setLanguage(int _language) throw() { language = _language; }
|
---|
174 | inline int getLanguage(void) const throw() { return language; }
|
---|
175 |
|
---|
176 | const char * select(const char * msg1, const char * msg2, va_list vl ) throw();
|
---|
177 | };
|
---|
178 |
|
---|
179 | protected:
|
---|
180 |
|
---|
181 | //æ´¾çã¯ã©ã¹ç¨ã³ã³ã¹ãã©ã¯ã¿
|
---|
182 | void _initialize(const char * src1, const char * src2, va_list vl) throw();
|
---|
183 |
|
---|
184 | public:
|
---|
185 | //ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿
|
---|
186 | Message(void) throw();
|
---|
187 |
|
---|
188 | //ã³ã³ã¹ãã©ã¯ã¿ (åä¸è¨èª)
|
---|
189 | Message(std::string src) throw();
|
---|
190 |
|
---|
191 | //ã³ã³ã¹ãã©ã¯ã¿ (è¤æ°è¨èª)
|
---|
192 | Message(const char * src1, const char * src2, ... ) throw();
|
---|
193 |
|
---|
194 | //ã³ãã¼ã³ã³ã¹ãã©ã¯ã¿
|
---|
195 | Message(const Message & src) throw();
|
---|
196 |
|
---|
197 | //ãã³ãã¬ã¼ãæååã®è¨å® (ä¸èº«ã¯æ¶ãã)
|
---|
198 | void assign(std::string src) throw() { Formatter::assign(src); }
|
---|
199 | void assign(const char * src1, const char * src2, ... ) throw();
|
---|
200 |
|
---|
201 | //è¨èªé¸æ
|
---|
202 | static void selectLanguage(enum tagLanguage lang = NEUTRAL) throw();
|
---|
203 |
|
---|
204 | //è¨èªã®åå¾
|
---|
205 | static enum tagLanguage getCurrentLanguage(void) throw()
|
---|
206 | { return static_cast<enum tagLanguage>(Singleton<MessageControl>::getInstance()->getLanguage()); }
|
---|
207 |
|
---|
208 | //TESTSUITE_PROTOTYPE(main)
|
---|
209 | };
|
---|
210 |
|
---|
211 |
|
---|
212 | /*
|
---|
213 | * åé·åºåç¨æååæ´å½¢ãã«ãã¼ã¯ã©ã¹
|
---|
214 | */
|
---|
215 | class VerboseMessage : public Message
|
---|
216 | {
|
---|
217 | public:
|
---|
218 | //å
|
---|
219 | ±éã®åé·åºåæ
|
---|
220 | å ±ãæã¤ã¯ã©ã¹
|
---|
221 | class VerboseControl
|
---|
222 | {
|
---|
223 | public:
|
---|
224 | bool verbose; //åé·åºåãè¡ããã©ãã
|
---|
225 | std::ostream * out; //åºåå
|
---|
226 |
|
---|
227 |
|
---|
228 | //ã³ã³ã¹ãã©ã¯ã¿
|
---|
229 | SINGLETON_CONSTRUCTOR(VerboseControl) throw() : verbose(false), out(0)
|
---|
230 | {}
|
---|
231 |
|
---|
232 | //åé·åºåå¶å¾¡
|
---|
233 | template<class T>
|
---|
234 | inline const VerboseControl & operator << (const T & src) const throw()
|
---|
235 | {
|
---|
236 | if(verbose && out != 0)
|
---|
237 | (*out) << src;
|
---|
238 | return *this;
|
---|
239 | }
|
---|
240 |
|
---|
241 | //verboseã¢ã¯ã»ãµ
|
---|
242 | void setVerbose(bool _verbose) throw()
|
---|
243 | { verbose = _verbose; }
|
---|
244 | bool getVerbose(void) const throw()
|
---|
245 | { return verbose; }
|
---|
246 |
|
---|
247 | //outã¢ã¯ã»ãµ
|
---|
248 | void setStream(std::ostream * _out) throw()
|
---|
249 | { out = _out; }
|
---|
250 | std::ostream * getStream(void) throw()
|
---|
251 | { return out; }
|
---|
252 | };
|
---|
253 |
|
---|
254 | //åé·åºåã¹ããªã¼ã (åç´ãªææ¢æ©æ§ã¤ãã©ããã¼ã¯ã©ã¹)
|
---|
255 | class VerboseStream
|
---|
256 | {
|
---|
257 | protected:
|
---|
258 | std::ostream * out;
|
---|
259 |
|
---|
260 | public:
|
---|
261 | VerboseStream(std::ostream * _out = 0) throw() : out(_out) {};
|
---|
262 |
|
---|
263 | template<class T>
|
---|
264 | VerboseStream & operator << (const T & src) throw()
|
---|
265 | {
|
---|
266 | if(out != 0)
|
---|
267 | (*out) << src;
|
---|
268 | return *this;
|
---|
269 | }
|
---|
270 | };
|
---|
271 |
|
---|
272 | protected:
|
---|
273 | //ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿ (ãã¹ãç¨)
|
---|
274 | VerboseMessage(void) throw();
|
---|
275 |
|
---|
276 | public:
|
---|
277 |
|
---|
278 | //ã³ã³ã¹ãã©ã¯ã¿
|
---|
279 | VerboseMessage(const char * src) throw();
|
---|
280 | VerboseMessage(const std::string & src) throw();
|
---|
281 | VerboseMessage(const char * src1, const char * src2, ... ) throw();
|
---|
282 |
|
---|
283 | //ãã¹ãã©ã¯ã¿
|
---|
284 | ~VerboseMessage(void) throw();
|
---|
285 |
|
---|
286 | //åé·åºåå¶å¾¡ (ã¢ã¯ã»ãµåé)
|
---|
287 | inline static void setVerbose(bool _verbose) throw()
|
---|
288 | { Singleton<VerboseControl>::getInstance()->setVerbose(_verbose); }
|
---|
289 |
|
---|
290 | //åé·åºåå
|
---|
291 | ã¹ããªã¼ã è¨å® (ã¢ã¯ã»ãµåé)
|
---|
292 | inline static void setStream(std::ostream * _stream) throw()
|
---|
293 | { Singleton<VerboseControl>::getInstance()->setStream(_stream); }
|
---|
294 |
|
---|
295 | //åé·åºåå¶å¾¡ã®ç¶æ
|
---|
296 | åå¾
|
---|
297 | inline static bool getVerbose(void) throw()
|
---|
298 | { return Singleton<VerboseControl>::getInstance()->getVerbose(); }
|
---|
299 |
|
---|
300 | //åé·åºåå
|
---|
301 | ã¹ããªã¼ã ã®åå¾ (è¨å®ãããã®ã¨åããã®ã¯åºã¦ããªã)
|
---|
302 | inline static VerboseStream getStream(void) throw()
|
---|
303 | { return VerboseStream(getVerbose() ? Singleton<VerboseControl>::getInstance()->getStream() : 0); }
|
---|
304 |
|
---|
305 | //TESTSUITE_PROTOTYPE(main)
|
---|
306 | };
|
---|
307 |
|
---|
308 | /*
|
---|
309 | * ä¾å¤ã¡ãã»ã¼ã¸ç¨æååæ´å½¢ãã«ãã¼ã¯ã©ã¹
|
---|
310 | */
|
---|
311 | class ExceptionMessage : public Message
|
---|
312 | {
|
---|
313 | public:
|
---|
314 | //ä¾å¤ã®å±éºåº¦ã¬ãã«
|
---|
315 | enum tagLevel {
|
---|
316 | DEFAULT = 0,
|
---|
317 | FATAL = 1,
|
---|
318 | WARNING = 2
|
---|
319 | };
|
---|
320 |
|
---|
321 | #ifdef EXCEPT_H
|
---|
322 | class ExceptionMessageException : public Exception
|
---|
323 | {
|
---|
324 | friend class ExceptionMessage;
|
---|
325 | protected:
|
---|
326 | ExceptionMessageException(int _code, std::string _details) throw() : Exception("ExceptionMessage", _code, _details) {}
|
---|
327 | };
|
---|
328 | #endif
|
---|
329 |
|
---|
330 | protected:
|
---|
331 | enum tagLevel level;
|
---|
332 |
|
---|
333 | public:
|
---|
334 | //ã³ã³ã¹ãã©ã¯ã¿
|
---|
335 | ExceptionMessage(const char * src) throw();
|
---|
336 | ExceptionMessage(const std::string & src) throw();
|
---|
337 | ExceptionMessage(const char * src1, const char * src2, ...) throw();
|
---|
338 |
|
---|
339 | ExceptionMessage(enum tagLevel level = DEFAULT) throw();
|
---|
340 | ExceptionMessage(enum tagLevel level, const char * src) throw();
|
---|
341 | ExceptionMessage(enum tagLevel level, const std::string & src) throw();
|
---|
342 | ExceptionMessage(enum tagLevel level, const char * src1, const char * src2, ...) throw();
|
---|
343 |
|
---|
344 | ExceptionMessage(const ExceptionMessage & src) throw();
|
---|
345 |
|
---|
346 |
|
---|
347 | //å±éºåº¦ã¬ãã«åç
|
---|
348 | §
|
---|
349 | inline bool operator == (enum tagLevel _level) const throw()
|
---|
350 | { return level == _level; }
|
---|
351 |
|
---|
352 | //å±éºåº¦ã¬ãã«åç
|
---|
353 | §
|
---|
354 | inline bool operator != (enum tagLevel _level) const throw()
|
---|
355 | { return !(operator ==(_level)); }
|
---|
356 |
|
---|
357 | //弿°ã®è¨å® (è¿å´å¤ã®åãMessage & ãã ExceptionMessage & ã«ããããã®å°ç´°å·¥)
|
---|
358 | template<class T>
|
---|
359 | inline ExceptionMessage & operator << (const T & src) throw()
|
---|
360 | {
|
---|
361 | Message::operator << ( src );
|
---|
362 | return *this;
|
---|
363 | }
|
---|
364 |
|
---|
365 | #ifdef EXCEPT_H //Exceptionã¯ã©ã¹ã使ç¨ããå ´å
|
---|
366 | //ä¾å¤ã®çºç
|
---|
367 | bool throwException(void) throw(Exception)
|
---|
368 | {
|
---|
369 | ExceptionMessageException exc(level, str());
|
---|
370 | return exc.throwException();
|
---|
371 | }
|
---|
372 | //ãããã¥ã¬ã¼ã¿
|
---|
373 | inline ExceptionMessage & operator << ( ExceptionMessage & (* func)(ExceptionMessage &) ) throw(Exception)
|
---|
374 | { return (*func)(*this); }
|
---|
375 |
|
---|
376 | #else //stdexceptã使ç¨ããå ´å
|
---|
377 | //ä¾å¤ã®çºç
|
---|
378 | template<class T>
|
---|
379 | bool throwException(void) throw(T)
|
---|
380 | {
|
---|
381 | throw T(str());
|
---|
382 | return true;
|
---|
383 | }
|
---|
384 | //ãããã¥ã¬ã¼ã¿
|
---|
385 | inline ExceptionMessage & operator << ( ExceptionMessage & (* func)(ExceptionMessage &) ) throw(T)
|
---|
386 | { return (*func)(*this); }
|
---|
387 | #endif
|
---|
388 |
|
---|
389 | //TESTSUITE_PROTOTYPE(main)
|
---|
390 | };
|
---|
391 |
|
---|
392 | #ifdef EXCEPT_H //Exceptionã¯ã©ã¹ã使ç¨ããå ´å
|
---|
393 |
|
---|
394 | //ä¾å¤ãã¹ãã¼ããããã®ãããã¥ã¬ã¼ã¿
|
---|
395 | inline ExceptionMessage & throwException(ExceptionMessage & excmsg) throw(Exception)
|
---|
396 | {
|
---|
397 | excmsg.throwException();
|
---|
398 | return excmsg;
|
---|
399 | }
|
---|
400 |
|
---|
401 | #else
|
---|
402 | //ä¾å¤ãã¹ãã¼ããããã®ãããã¥ã¬ã¼ã¿
|
---|
403 | template<class T>
|
---|
404 | inline ExceptionMessage & throwException(ExceptionMessage & excmsg) throw(T)
|
---|
405 | {
|
---|
406 | excmsg.throwException<T>();
|
---|
407 | return excmsg;
|
---|
408 | }
|
---|
409 |
|
---|
410 | #endif
|
---|
411 |
|
---|
412 |
|
---|
413 |
|
---|
414 | /*
|
---|
415 | * ãããã°æ
|
---|
416 | å ±åºåç¨æååæ´å½¢ãã«ãã¼ã¯ã©ã¹
|
---|
417 | */
|
---|
418 | class DebugMessage : public Formatter
|
---|
419 | {
|
---|
420 | public:
|
---|
421 | //å
|
---|
422 | ±éã®åé·åºåæ
|
---|
423 | å ±ãæã¤ã¯ã©ã¹ (ã·ã³ã°ã«ãã³ã«ããã®ã§VerboseControlãåããã®ãã¯ã©ã¹åãã)
|
---|
424 | class DebugControl : public VerboseMessage::VerboseControl
|
---|
425 | { public: SINGLETON_CONSTRUCTOR_(DebugControl) throw() : VerboseMessage::VerboseControl(_singleton) {} };
|
---|
426 |
|
---|
427 |
|
---|
428 | protected:
|
---|
429 | //ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿ (ãã¹ãç¨)
|
---|
430 | DebugMessage(void) throw();
|
---|
431 |
|
---|
432 | public:
|
---|
433 |
|
---|
434 | //ã³ã³ã¹ãã©ã¯ã¿
|
---|
435 | DebugMessage(std::string src) throw();
|
---|
436 |
|
---|
437 | //ãã¹ãã©ã¯ã¿
|
---|
438 | ~DebugMessage(void) throw();
|
---|
439 |
|
---|
440 | //åé·åºåå¶å¾¡ (ã¢ã¯ã»ãµåé)
|
---|
441 | inline static void setVerbose(bool _verbose) throw()
|
---|
442 | { Singleton<DebugControl>::getInstance()->setVerbose(_verbose); }
|
---|
443 |
|
---|
444 | //åé·åºåå
|
---|
445 | ã¹ããªã¼ã è¨å® (ã¢ã¯ã»ãµåé)
|
---|
446 | inline static void setStream(std::ostream * _stream) throw()
|
---|
447 | { Singleton<DebugControl>::getInstance()->setStream(_stream); }
|
---|
448 |
|
---|
449 | //åé·åºåå¶å¾¡ã®ç¶æ
|
---|
450 | åå¾
|
---|
451 | inline static bool getVerbose(void) throw()
|
---|
452 | { return Singleton<DebugControl>::getInstance()->getVerbose(); }
|
---|
453 |
|
---|
454 | //åé·åºåå
|
---|
455 | ã¹ããªã¼ã ã®åå¾ (è¨å®ãããã®ã¨åããã®ã¯åºã¦ããªã)
|
---|
456 | inline static VerboseMessage::VerboseStream getStream(void) throw()
|
---|
457 | { return VerboseMessage::VerboseStream(getVerbose() ? Singleton<DebugControl>::getInstance()->getStream() : 0); }
|
---|
458 |
|
---|
459 | // TESTSUITE_PROTOTYPE(main)
|
---|
460 | };
|
---|
461 |
|
---|
462 |
|
---|
463 | #endif //MESSAGE_H
|
---|
464 |
|
---|
465 |
|
---|