Menu

[r46]: / framework / trunk / main.cpp  Maximize  Restore  History

Download this file

72 lines (55 with data), 1.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
#include <memory>
#include "main_thread.h"
#include "thread_pool.h"
#include "global_config.h"
#include "url.h"
#include "templates.h"
#include "data.h"
using namespace std;
Templates_Set templates;
auto_ptr<Users> users;
auto_ptr<Messages> all_messages;
auto_ptr<Texts_Collector> texts;
void setup()
{
users_t user;
user.username="artik";
user.password="artkmst";
cerr<<"Setting up: "<<users->id.add(user)<<endl;
user.username="maas";
user.password="maas";
users->id.add(user);
}
int main(int argc,char **argv)
{
try{
global_config.load(argc,argv);
templates.load();
Environment env(global_config.sval( "bdb.path" ).c_str());
users=auto_ptr<Users>(new Users(env));
all_messages=auto_ptr<Messages>(new Messages(env));
texts=auto_ptr<Texts_Collector>(new Texts_Collector(env,"tests.db"));
env.create();
users->create();
all_messages->create();
texts->create();
if(argc>2 && strcmp(argv[1],"setup")==0) {
setup();
}
Run_Application<Main_Thread>(argc,argv);
users->close();
all_messages->close();
texts->close();
env.close();
cout<<"Exiting\n";
}
catch(HTTP_Error &s) {
cerr<<s.get()<<endl;
return 1;
}
catch(DbException &e) {
cerr<<e.what()<<endl;
}
return 0;
}
MongoDB Logo MongoDB