/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2012 University of Bonn. All rights reserved. * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. */ /* * ControllerOptions.cpp * * Created on: 01.06.2012 * Author: heber */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/MemDebug.hpp" #include "ControllerOptions.hpp" #include "CodePatterns/Log.hpp" int ControllerOptions::parseServerPort(boost::program_options::variables_map &vm) { if (vm.count("server")) { server = vm["server"].as< std::string >(); serverport = server.substr(server.find_last_of(':')+1, std::string::npos); server = server.substr(0, server.find_last_of(':')); try { boost::lexical_cast(serverport); } catch (boost::bad_lexical_cast &) { ELOG(1, "Could not interpret " << serverport << " as server:port."); return 255; } LOG(1, "INFO: Using " << server << ":" << serverport << " as server's address."); } else { ELOG(1, "Requiring server's address (host:port) to connect to."); return 255; } return 0; } int ControllerOptions::parseCommand(boost::program_options::variables_map &vm, const std::vector &Commands) { if (!vm.count("command")) { ELOG(1, "Controller requires one of the following commands: "+toString(Commands)); return 255; } command = vm["command"].as< std::string >(); return 0; }