]> granicus.if.org Git - icinga2/blob - base/i2-base.h
Replaced custom event code with Boost.Signals.
[icinga2] / base / i2-base.h
1 /******************************************************************************
2  * Icinga 2                                                                   *
3  * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/)        *
4  *                                                                            *
5  * This program is free software; you can redistribute it and/or              *
6  * modify it under the terms of the GNU General Public License                *
7  * as published by the Free Software Foundation; either version 2             *
8  * of the License, or (at your option) any later version.                     *
9  *                                                                            *
10  * This program is distributed in the hope that it will be useful,            *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
13  * GNU General Public License for more details.                               *
14  *                                                                            *
15  * You should have received a copy of the GNU General Public License          *
16  * along with this program; if not, write to the Free Software Foundation     *
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
18  ******************************************************************************/
19
20 #ifndef I2BASE_H
21 #define I2BASE_H
22
23 /**
24  * @mainpage Icinga Documentation
25  *
26  * Icinga implements a framework for run-time-loadable components which can
27  * pass messages between each other. These components can either be hosted in
28  * the same process or in several host processes (either on the same machine or
29  * on different machines).
30  *
31  * The framework's code critically depends on the following patterns:
32  *
33  * <list type="bullet">
34  * <item>Smart pointers
35  *
36  * The shared_ptr and weak_ptr template classes are used to simplify memory
37  * management and to avoid accidental memory leaks and use-after-free
38  * bugs.</item>
39  *
40  * <item>Observer pattern
41  *
42  * Framework classes expose events which other objects can subscribe to. This
43  * is used to decouple clients of a class from the class' internal
44  * implementation.</item>
45  * </list>
46  */
47
48 /**
49  * @defgroup base Base class library
50  *
51  * The base class library implements commonly-used functionality like
52  * event handling for sockets and timers.
53  */
54
55 #ifdef _MSC_VER
56 #       define HAVE_STDCXX_0X
57 #       pragma warning(disable:4251)
58 #       define _CRT_SECURE_NO_DEPRECATE
59 #       define _CRT_SECURE_NO_WARNINGS
60 #else /* _MSC_VER */
61 #       include "config.h"
62 #endif /* _MSC_VER */
63
64 #define PLATFORM_WINDOWS 1
65 #define PLATFORM_UNIX 2
66
67 #ifdef _WIN32
68 #       define I2_PLATFORM PLATFORM_WINDOWS
69 #       include "win32.h"
70 #else
71 #       define I2_PLATFORM PLATFORM_UNIX
72 #       include "unix.h"
73 #endif
74
75 #include <cstdlib>
76 #include <cstdarg>
77 #include <cstdio>
78 #include <cstring>
79 #include <cassert>
80 #include <cerrno>
81
82 #include <string>
83 #include <exception>
84 #include <stdexcept>
85 #include <sstream>
86 #include <vector>
87 #include <set>
88 #include <iostream>
89 #include <list>
90 #include <typeinfo>
91 #include <map>
92 #include <list>
93 #include <algorithm>
94
95 using namespace std;
96
97 #ifdef HAVE_STDCXX_0X
98 #       include <memory>
99 #       include <functional>
100
101 using namespace std::placeholders;
102
103 #else /* HAVE_STDCXX_0X */
104 #       ifdef HAVE_BOOST
105 #               include <boost/smart_ptr.hpp>
106 #               include <boost/make_shared.hpp>
107 #               include <boost/bind.hpp>
108 #               include <boost/function.hpp>
109
110 using namespace boost;
111
112 #       else /* HAVE_BOOST */
113 #               include <tr1/memory>
114 #               include <tr1/functional>
115 #               include "cxx11-compat.h"
116
117 using namespace std::tr1;
118 using namespace std::tr1::placeholders;
119
120 #endif /* HAVE_BOOST */
121 #endif /* HAVE_STDCXX_0X */
122
123 #include <boost/signal.hpp>
124
125 #if defined(__APPLE__) && defined(__MACH__)
126 #       pragma GCC diagnostic ignored "-Wdeprecated-declarations" 
127 #endif
128
129 #include <openssl/bio.h>
130 #include <openssl/ssl.h>
131 #include <openssl/err.h>
132
133 #ifdef HAVE_GCC_ABI_DEMANGLE
134 #       include <cxxabi.h>
135 #endif /* HAVE_GCC_ABI_DEMANGLE */
136
137 #ifdef I2_BASE_BUILD
138 #       define I2_BASE_API I2_EXPORT
139 #else /* I2_BASE_BUILD */
140 #       define I2_BASE_API I2_IMPORT
141 #endif /* I2_BASE_BUILD */
142
143 #include "utility.h"
144 #include "object.h"
145 #include "exception.h"
146 #include "memory.h"
147 #include "variant.h"
148 #include "eventargs.h"
149 #include "dictionary.h"
150 #include "timer.h"
151 #include "fifo.h"
152 #include "socket.h"
153 #include "tcpsocket.h"
154 #include "tcpclient.h"
155 #include "tcpserver.h"
156 #include "tlsclient.h"
157 #include "objectset.h"
158 #include "objectmap.h"
159 #include "configobject.h"
160 #include "application.h"
161 #include "component.h"
162
163 #endif /* I2BASE_H */