Line | |
---|
1 | #include <iomanip.h>
|
---|
2 | #include <fstream.h>
|
---|
3 | #include <iostream.h>
|
---|
4 |
|
---|
5 | #include <TROOT.h>
|
---|
6 | #include <TSystem.h>
|
---|
7 | #include <TApplication.h>
|
---|
8 |
|
---|
9 | #include "MCosy.h"
|
---|
10 | #include "MLogManip.h"
|
---|
11 | #include "base/timer.h"
|
---|
12 |
|
---|
13 | #define clog(txt) \
|
---|
14 | { \
|
---|
15 | const Bool_t is = lout.IsOutputDeviceEnabled(MLog::eStdout); \
|
---|
16 | lout << edev(MLog::eStdout) << txt << endl; \
|
---|
17 | if (is) \
|
---|
18 | lout.EnableOutputDevice(MLog::eStdout); \
|
---|
19 | }
|
---|
20 |
|
---|
21 | int main(int argc, char **argv)
|
---|
22 | {
|
---|
23 | Timer time;
|
---|
24 | time.Now();
|
---|
25 |
|
---|
26 | //
|
---|
27 | // this must move to MGCosy !!!! (or MApplication)
|
---|
28 | //
|
---|
29 | MLog lout("log/cosy.log", kTRUE);
|
---|
30 | lout.EnableOutputDevice(MLog::eStdout);
|
---|
31 |
|
---|
32 | clog("Starting Cosy at " << time.GetTimeStr() << " ...");
|
---|
33 |
|
---|
34 | //
|
---|
35 | // start the main window
|
---|
36 | //
|
---|
37 | clog("- Initialising Root environment.");
|
---|
38 |
|
---|
39 | TROOT root("Cosy", "Magic Control System");
|
---|
40 | TApplication app("App", &argc, argv);
|
---|
41 |
|
---|
42 | //
|
---|
43 | // Create the Network. Device: /dev/dpm_00, Rate: 500kbps
|
---|
44 | //
|
---|
45 | clog("- Constructing MCosy.");
|
---|
46 | MCosy *cosy = new MCosy("/dev/dpm_00", 500, lout);
|
---|
47 |
|
---|
48 | clog("- Starting MCosy.");
|
---|
49 | cosy->Start();
|
---|
50 |
|
---|
51 | clog("- Starting mainloop.");
|
---|
52 | app.Run(kTRUE);
|
---|
53 |
|
---|
54 | clog("- Stopping cosy.");
|
---|
55 | cosy->Stop();
|
---|
56 | clog("- cosy stopped.");
|
---|
57 |
|
---|
58 | delete cosy;
|
---|
59 |
|
---|
60 | clog("- Terminating Program.");
|
---|
61 | cout << "The End." << endl;
|
---|
62 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.