Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Related Pages

HighLevelMain.cpp

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

Generated on Fri Sep 16 18:01:51 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5