00001
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #if HAVE_CONFIG_H
00031 #include "config.h"
00032 #endif
00033
00034 #include "Main.hpp"
00035 #include "GizmoDaemon.hpp"
00036 #include "../libH/Exception.hpp"
00037 #include <cstdlib>
00038 #include <iostream>
00039 #include <boost/shared_ptr.hpp>
00040 #include <boost/filesystem/operations.hpp>
00041
00042 using namespace std;
00043 using namespace H;
00044 using namespace boost;
00045 using namespace boost::filesystem;
00046
00055 int main (int argc, char * argv []) {
00056
00057 path::default_name_check(native);
00058
00059 bool ReloadGizmod;
00060 do {
00061
00062 shared_ptr<GizmoDaemon> pGizmod;
00063 try {
00064 pGizmod = shared_ptr<GizmoDaemon>(new GizmoDaemon);
00065 } catch (H::Exception & e) {
00066 cerr << "\nUnable to Initialize Gizmod :: " << e.message() << "\n\n";
00067 return EXIT_FAILURE;
00068 }
00069
00070
00071 try {
00072 if (!pGizmod->initialize(argc, argv))
00073 return EXIT_SUCCESS;
00074 } catch (H::Exception & e) {
00075 cerr << "\nUnable to Initialize Gizmod :: " << e.message() << "\n\n";
00076 return EXIT_FAILURE;
00077 }
00078
00079
00080 try {
00081 pGizmod->initGizmod();
00082 } catch (H::Exception & e) {
00083 cerr << "Unable to Initialize Gizmod :: " << e.message() << "\n\n";
00084 return EXIT_FAILURE;
00085 }
00086
00087
00088 try {
00089 pGizmod->enterLoop();
00090 } catch (H::Exception & e) {
00091 cerr << "Fatal Error :: " << e.message() << "\n\n";
00092 return EXIT_FAILURE;
00093 }
00094
00095
00096 ReloadGizmod = pGizmod->getReloadConfig();
00097 } while (ReloadGizmod);
00098
00099 return EXIT_SUCCESS;
00100 }