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

Generated on Thu Jul 15 09:50:46 2004 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5