00001 #include "HighLevelApi.h"
00002 #include "Configuration.h"
00003 #include "Sct/Exception.h"
00004
00005 #include "sctConfIPC/configipc.h"
00006 #include "Sct/SctNames.h"
00007
00008 #include <ipc/core.h>
00009 #include <ipc/object.h>
00010 #include <ipc/server.h>
00011 #include <pmg/pmg_initSync.h>
00012
00013 #include <iostream>
00014 #include <boost/shared_ptr.hpp>
00015
00016 using namespace std;
00017 using namespace boost;
00018 using namespace SctConfiguration;
00019 using namespace SctTest;
00020
00021 IPCServer ipcServer;
00022 shared_ptr<SctConfiguration::Configuration> configServer;
00023
00024
00025
00026
00027
00028
00029
00030 int main(int argc, char** argv) {
00031 Sct::setExceptionHandlers(argv[0]);
00032
00033 IPCCore::init(argc,argv);
00034 IPCPartition p(::Sct::SctNames::getPartitionName());
00035
00036
00037
00038 try {
00039 configServer = shared_ptr<SctConfiguration::Configuration>(new SctConfiguration::ConfigIPC());
00040 if (!HighLevelApi::instance().publish()) {
00041 cout << "Failed to publish HighLevelApi" << endl;
00042 return 3;
00043 }
00044
00045 cout << "Serving...\n";
00046
00047
00048
00049 pmg_initSync();
00050 ipcServer.run();
00051
00052 cout << "Run over" << std::endl;
00053 HighLevelApi::instance().withdraw();
00054
00055 } catch(SctConfiguration::ConfigurationException &c) {
00056 std::cout << "ConfigurationException: " << c.what() << std::endl;
00057
00058 MRSStream mrsStream(p);
00059 mrsStream << "SctTestApi" << MRS_FATAL << MRS_QUALIF("SctTestApi") << MRS_TEXT("Configuration server not running!") << ENDM;
00060
00061 exit(1);
00062 }
00063 }