Add setAll() method to Tairent::Core::BitField class.
[tairent.git] / src / core / main.cpp
blobac5c1fc39e7cb07fbe4bcc0387666dfc8b184a5b
1 /***************************************************************************
2 * *
3 * Copyright (C) 2006 David Brodsky *
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 as *
7 * published by the Free Software Foundation and appearing *
8 * in the file LICENSE.GPL included in the packaging of this file. *
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 GNU *
13 * General Public License for more details. *
14 * *
15 ***************************************************************************/
17 #include <iostream>
18 #include <signal.h>
20 #include <tairon/core/config.h>
21 #include <tairon/core/modulemanager.h>
22 #include <tairon/core/threadmanager.h>
23 #include <tairon/net/limitmanager.h>
24 #include <tairon/util/objectmanager.h>
26 #include "netthread.h"
28 int main(int argc, char **argv)
30 // don't crash on broken pipe signal
31 signal(SIGPIPE, SIG_IGN);
33 Tairon::Core::ThreadManager *threadmanager = 0;
34 Tairon::Util::ObjectManager *objectmanager = 0;
35 Tairon::Core::ModuleManager *modulemanager = 0;
37 Tairent::Core::NetThread *netthread = 0;
39 try {
40 Tairon::Core::Config config("tairent.xml");
41 threadmanager = new Tairon::Core::ThreadManager();
42 objectmanager = new Tairon::Util::ObjectManager();
43 modulemanager = new Tairon::Core::ModuleManager();
45 netthread = new Tairent::Core::NetThread();
46 netthread->start();
48 modulemanager->initialize();
49 } catch (const Tairon::Core::Exception &e) {
50 std::cerr << "Caught exception in main: " << (Tairon::Core::String) e << std::endl;
53 if (netthread) {
54 netthread->exit();
55 netthread->join();
58 if (modulemanager) {
59 modulemanager->unloadModules();
62 delete netthread;
64 // this is perfectly valid, even if an exception has been thrown - deleting
65 // null pointer is correct
66 delete modulemanager;
67 delete objectmanager;
68 delete threadmanager;
71 // vim: ai sw=4 ts=4 noet fdm=marker