ardour
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
libs
ardour
test
test_receiver.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2011 Paul Davis
3
Copyright (C) 2011 Tim Mayberry
4
5
This program is free software; you can redistribute it and/or modify it
6
under the terms of the GNU General Public License as published by the Free
7
Software Foundation; either version 2 of the License, or (at your option)
8
any later version.
9
10
This program is distributed in the hope that it will be useful, but WITHOUT
11
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13
for more details.
14
15
You should have received a copy of the GNU General Public License along
16
with this program; if not, write to the Free Software Foundation, Inc.,
17
675 Mass Ave, Cambridge, MA 02139, USA.
18
*/
19
20
#ifndef ARDOUR_TEST_RECEIVER_H
21
#define ARDOUR_TEST_RECEIVER_H
22
23
#include <iostream>
24
25
#include "
pbd/textreceiver.h
"
26
27
class
TestReceiver
:
public
Receiver
28
{
29
protected
:
30
void
receive
(
Transmitter::Channel
chn,
const
char
* str) {
31
const
char
*prefix =
""
;
32
33
switch
(chn) {
34
case
Transmitter::Error
:
35
prefix =
": [ERROR]: "
;
36
break
;
37
case
Transmitter::Info
:
38
/* ignore */
39
return
;
40
case
Transmitter::Warning
:
41
prefix =
": [WARNING]: "
;
42
break
;
43
case
Transmitter::Fatal
:
44
prefix =
": [FATAL]: "
;
45
break
;
46
case
Transmitter::Throw
:
47
/* this isn't supposed to happen */
48
abort ();
49
}
50
51
/* note: iostreams are already thread-safe: no external
52
lock required.
53
*/
54
55
std::cout << prefix << str << std::endl;
56
57
if
(chn ==
Transmitter::Fatal
) {
58
exit (9);
59
}
60
}
61
};
62
63
#endif // ARDOUR_TEST_RECEIVER_H
TestReceiver
Definition:
test_receiver.h:27
Transmitter::Fatal
Definition:
transmitter.h:38
textreceiver.h
Transmitter::Throw
Definition:
transmitter.h:39
Transmitter::Error
Definition:
transmitter.h:36
Transmitter::Channel
Channel
Definition:
transmitter.h:34
Receiver
Definition:
receiver.h:32
Transmitter::Info
Definition:
transmitter.h:35
TestReceiver::receive
void receive(Transmitter::Channel chn, const char *str)
Definition:
test_receiver.h:30
Transmitter::Warning
Definition:
transmitter.h:37
Generated on Sun May 24 2015 12:15:07 for ardour by
1.8.8