1/*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef TEST_OUTPUT_H
6#define TEST_OUTPUT_H
7
8
9#include <stdarg.h>
10
11#include <KernelExport.h>
12
13
14class TestOutput {
15public:
16								TestOutput();
17	virtual						~TestOutput();
18
19	virtual	int					PrintArgs(const char* format, va_list args) = 0;
20	inline	int					Print(const char* format,...);
21};
22
23
24class DebugTestOutput : public TestOutput {
25public:
26								DebugTestOutput();
27	virtual						~DebugTestOutput();
28
29	virtual	int					PrintArgs(const char* format, va_list args);
30
31private:
32			spinlock			fLock;
33			char				fBuffer[1024];
34};
35
36
37int
38TestOutput::Print(const char* format,...)
39{
40	va_list args;
41	va_start(args, format);
42	int result = PrintArgs(format, args);
43	va_end(args);
44
45	return result;
46}
47
48
49
50#endif	// TEST_OUTPUT_H
51