|
a |
|
b/src/bincimapmime/iofactory.h |
|
|
1 |
/*-*-mode:c++-*-*/
|
|
|
2 |
/* --------------------------------------------------------------------
|
|
|
3 |
* Filename:
|
|
|
4 |
* src/iofactory.h
|
|
|
5 |
*
|
|
|
6 |
* Description:
|
|
|
7 |
* Declaration of the IOFactory class.
|
|
|
8 |
* --------------------------------------------------------------------
|
|
|
9 |
* Copyright 2002, 2003 Andreas Aardal Hanssen
|
|
|
10 |
*
|
|
|
11 |
* This program is free software; you can redistribute it and/or modify
|
|
|
12 |
* it under the terms of the GNU General Public License as published by
|
|
|
13 |
* the Free Software Foundation; either version 2 of the License, or
|
|
|
14 |
* (at your option) any later version.
|
|
|
15 |
*
|
|
|
16 |
* This program is distributed in the hope that it will be useful,
|
|
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
19 |
* GNU General Public License for more details.
|
|
|
20 |
*
|
|
|
21 |
* You should have received a copy of the GNU General Public License
|
|
|
22 |
* along with this program; if not, write to the Free Software
|
|
|
23 |
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
|
|
24 |
* --------------------------------------------------------------------
|
|
|
25 |
*/
|
|
|
26 |
#ifndef IOFACTORY_H_INCLUDED
|
|
|
27 |
#define IOFACTORY_H_INCLUDED
|
|
|
28 |
#include <map>
|
|
|
29 |
#include <string>
|
|
|
30 |
|
|
|
31 |
namespace Binc {
|
|
|
32 |
class IODevice;
|
|
|
33 |
class IOFactory {
|
|
|
34 |
public:
|
|
|
35 |
~IOFactory(void);
|
|
|
36 |
|
|
|
37 |
static void addDevice(IODevice *dev);
|
|
|
38 |
static IOFactory &getInstance(void);
|
|
|
39 |
static IODevice &getClient(void);
|
|
|
40 |
static IODevice &getLogger(void);
|
|
|
41 |
|
|
|
42 |
private:
|
|
|
43 |
IOFactory(void);
|
|
|
44 |
|
|
|
45 |
std::map<std::string, IODevice *> devices;
|
|
|
46 |
};
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
#define bincClient \
|
|
|
50 |
IOFactory::getClient()
|
|
|
51 |
|
|
|
52 |
#if !defined (DEBUG)
|
|
|
53 |
#define bincError if (false) std::cout
|
|
|
54 |
#define bincWarning if (false) std::cout
|
|
|
55 |
#define bincDebug if (false) std::cout
|
|
|
56 |
#else
|
|
|
57 |
#define bincError \
|
|
|
58 |
IOFactory::getLogger().setOutputLevel(0);IOFactory::getLogger()
|
|
|
59 |
#define bincWarning \
|
|
|
60 |
IOFactory::getLogger().setOutputLevel(2);IOFactory::getLogger()
|
|
|
61 |
#define bincDebug \
|
|
|
62 |
IOFactory::getLogger().setOutputLevel(3);IOFactory::getLogger()
|
|
|
63 |
#endif
|
|
|
64 |
|
|
|
65 |
#define bincInfo \
|
|
|
66 |
IOFactory::getLogger().setOutputLevel(1);IOFactory::getLogger()
|
|
|
67 |
|
|
|
68 |
#endif
|