00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef MONGO_PCH_H
00022 #define MONGO_PCH_H
00023
00024 #if defined(MONGO_EXPOSE_MACROS)
00025 # define JS_C_STRINGS_ARE_UTF8
00026 # undef SUPPORT_UCP
00027 # define SUPPORT_UCP
00028 # undef SUPPORT_UTF8
00029 # define SUPPORT_UTF8
00030 # undef _CRT_SECURE_NO_WARNINGS
00031 # define _CRT_SECURE_NO_WARNINGS
00032 #endif
00033
00034
00035 #if defined(WIN32)
00036 # ifndef _WIN32
00037 # define _WIN32
00038 # endif
00039 #endif
00040
00041 #if defined(_WIN32)
00042
00043 # define _CRT_RAND_S
00044 # ifndef NOMINMAX
00045 # define NOMINMAX
00046 # endif
00047 # include <winsock2.h>
00048 # include <ws2tcpip.h>
00049 # include <wspiapi.h>
00050 # include <windows.h>
00051 #endif
00052
00053 #include <ctime>
00054 #include <sstream>
00055 #include <string>
00056 #include <memory>
00057 #include <string>
00058 #include <iostream>
00059 #include <fstream>
00060 #include <map>
00061 #include <vector>
00062 #include <set>
00063 #include <stdio.h>
00064 #include <stdlib.h>
00065 #include <sstream>
00066 #include <signal.h>
00067 #include "targetver.h"
00068 #include "time.h"
00069 #include "string.h"
00070 #include "limits.h"
00071
00072 #include <boost/any.hpp>
00073 #include "boost/thread/once.hpp"
00074 #include <boost/archive/iterators/transform_width.hpp>
00075 #define BOOST_FILESYSTEM_VERSION 2
00076 #include <boost/filesystem/convenience.hpp>
00077 #include <boost/filesystem/exception.hpp>
00078 #include <boost/filesystem/operations.hpp>
00079 #include <boost/program_options.hpp>
00080 #include <boost/shared_ptr.hpp>
00081 #include <boost/smart_ptr.hpp>
00082 #include <boost/function.hpp>
00083 #include "boost/bind.hpp"
00084 #include "boost/function.hpp"
00085 #include <boost/thread/tss.hpp>
00086 #include "boost/detail/endian.hpp"
00087 #define BOOST_SPIRIT_THREADSAFE
00088 #include <boost/version.hpp>
00089 #include <boost/tuple/tuple.hpp>
00090 #include <boost/thread/thread.hpp>
00091 #include <boost/thread/condition.hpp>
00092 #include <boost/thread/recursive_mutex.hpp>
00093 #include <boost/thread/xtime.hpp>
00094 #undef assert
00095 #define assert MONGO_assert
00096
00097 namespace mongo {
00098
00099 using namespace std;
00100 using boost::shared_ptr;
00101
00102 #if defined(_DEBUG)
00103 const bool debug=true;
00104 #else
00105 const bool debug=false;
00106 #endif
00107
00108
00109 const int VERSION = 4;
00110 const int VERSION_MINOR = 5;
00111
00112 enum ExitCode {
00113 EXIT_CLEAN = 0 ,
00114 EXIT_BADOPTIONS = 2 ,
00115 EXIT_REPLICATION_ERROR = 3 ,
00116 EXIT_NEED_UPGRADE = 4 ,
00117 EXIT_SHARDING_ERROR = 5 ,
00118 EXIT_KILL = 12 ,
00119 EXIT_ABRUPT = 14 ,
00120 EXIT_NTSERVICE_ERROR = 20 ,
00121 EXIT_JAVA = 21 ,
00122 EXIT_OOM_MALLOC = 42 ,
00123 EXIT_OOM_REALLOC = 43 ,
00124 EXIT_FS = 45 ,
00125 EXIT_CLOCK_SKEW = 47 ,
00126 EXIT_NET_ERROR = 48 ,
00127 EXIT_POSSIBLE_CORRUPTION = 60 ,
00128 EXIT_UNCAUGHT = 100 ,
00129 EXIT_TEST = 101 ,
00130
00131 };
00132
00133 void dbexit( ExitCode returnCode, const char *whyMsg = "", bool tryToGetLock = false);
00134
00140 void exit( ExitCode returnCode );
00141 bool inShutdown();
00142
00143 using namespace boost::filesystem;
00144 void asserted(const char *msg, const char *file, unsigned line);
00145 }
00146
00147 #define MONGO_assert(_Expression) (void)( (!!(_Expression)) || (mongo::asserted(#_Expression, __FILE__, __LINE__), 0) )
00148
00149 #include "util/debug_util.h"
00150 #include "util/goodies.h"
00151 #include "util/log.h"
00152 #include "util/allocator.h"
00153 #include "util/assert_util.h"
00154
00155 namespace mongo {
00156
00157 void sayDbContext(const char *msg = 0);
00158 void rawOut( const string &s );
00159
00160 typedef char _TCHAR;
00161
00162 using boost::uint32_t;
00163 using boost::uint64_t;
00164
00165 }
00166
00167 #endif // MONGO_PCH_H