int ClientApp::initializeDetector(DetectorPrx detector) { DetectorData detectorData; localAndClientMsg(VLogger::DEBUG, NULL, "Client using Detector-name: %s\n", detector->ice_getIdentity().name.c_str()); detectorData.type = ::cvac::FILE; // If a detector dat file was passed then use that instead of getting it from the config file if (m_detectorData.length() > 0) { detectorData.file.directory.relativePath = getFilePath(m_detectorData); detectorData.file.filename = getFileName(m_detectorData); } else { // Determine which data files to pass as detector data based on .DetectorFilename in 'config.client' std::string filenameStr = m_detectorName + ".DetectorFilename"; Ice::PropertiesPtr props = communicator()->getProperties(); std::string filename = props->getProperty(filenameStr); if (filename.length() == 0) { localAndClientMsg(VLogger::WARN, NULL, "No .DetectorFilename pair found for %s.\n", m_detectorName.c_str()); return EXIT_FAILURE; } if ((filename.length() > 1 && filename[1] == ':' )|| filename[0] == '/' || filename[0] == '\\') { // absolute path int idx = filename.find_last_of('/'); detectorData.file.directory.relativePath = filename.substr(0, idx); detectorData.file.filename = filename.substr(idx+1, filename.length() - idx); } else { //Add the current directory detectorData.file.directory.relativePath = "detectors"; detectorData.file.filename = filename; } } try { localAndClientMsg(VLogger::INFO, NULL, "Initializing detector with relativePath: %s\n", detectorData.file.directory.relativePath.c_str()); localAndClientMsg(VLogger::INFO, NULL, "Initializing detector with filename: %s\n", detectorData.file.filename.c_str()); detector->initialize(5, detectorData); localAndClientMsg(VLogger::DEBUG, NULL, "IceBox test client: initialized the detector\n"); } catch (const Ice::Exception& ex) { localAndClientMsg(VLogger::WARN, NULL, "Ice- name(): %s\n", ex.ice_name().c_str()); localAndClientMsg(VLogger::WARN, NULL, "Ice- stackTrace(): \n%s\n", ex.ice_stackTrace().c_str()); localAndClientMsg(VLogger::WARN, NULL, "%s\n", ex.what()); return EXIT_FAILURE; } return EXIT_SUCCESS; }
int ClientApp::initializeDetector(DetectorPrx detector) { localAndClientMsg(VLogger::DEBUG, NULL, "Client using Detector-name: %s\n", detector->ice_getIdentity().name.c_str()); // If a detector dat file was passed then use that instead of getting it from the config file if (m_detectorData.length() > 0) { detectorData.directory.relativePath = getFileDirectory(m_detectorData); detectorData.filename = getFileName(m_detectorData); } else { // Determine which data files to pass as detector data based on .DetectorFilename in 'config.client' std::string filenameStr = m_detectorName + ".DetectorFilename"; Ice::PropertiesPtr props = communicator()->getProperties(); std::string filename = props->getProperty(filenameStr); if (filename.length() == 0) { localAndClientMsg(VLogger::WARN, NULL, "No .DetectorFilename pair found for %s.\n", m_detectorName.c_str()); return EXIT_FAILURE; } if ((filename.length() > 1 && filename[1] == ':' )|| filename[0] == '/' || filename[0] == '\\') { // absolute path int idx = filename.find_last_of('/'); detectorData.directory.relativePath = filename.substr(0, idx); detectorData.filename = filename.substr(idx+1, filename.length() - idx); } else { //Add the current directory detectorData.directory.relativePath = "detectors"; detectorData.filename = filename; } } return EXIT_SUCCESS; }