Ejemplo n.º 1
0
void LocationsMgr::add_szbase( const std::string& name , const CfgPairs& cfg )
{
	auto draw_name = cfg.count("draw_name") ?  cfg.at("draw_name") : name;

	try {
		auto& vars = vars_cache.get_szarp( cfg.at("base") );

		loc_factory.register_location<SzbaseLocation>(
				name , draw_name , "szbase" , std::ref(vars) );
	} catch( file_not_found_error& e ) {
		throw invalid_value( e.what() );
	} catch( xml_parse_error& e ) {
		throw invalid_value( e.what() );
	}
}
Ejemplo n.º 2
0
void LocationsMgr::add_szbase( const std::string& name , const CfgPairs& cfg )
{
	auto pa = cfg.count("prober_address") ? cfg.at("prober_address") : "127.0.0.1";
	auto pp = cfg.count("prober_port")    ? cfg.at("prober_port")    : "8090";
	auto draw_name = cfg.count("draw_name") ?  cfg.at("draw_name") : name;

	unsigned p;
	try {
		p = boost::lexical_cast<unsigned>(pp);
	} catch( boost::bad_lexical_cast& e ) {
		throw invalid_value("Invalid port number in section " + name );
	}

	try {
		auto& vars = vars_cache.get_szarp( cfg.at("base") );

		loc_factory.register_location<SzbaseLocation>(
				name , draw_name , "szbase" , std::ref(vars) );
	} catch( file_not_found_error& e ) {
		throw invalid_value( e.what() );
	} catch( xml_parse_error& e ) {
		throw invalid_value( e.what() );
	}
}
Ejemplo n.º 3
0
void LocationsMgr::add_proxy( const std::string& name , const CfgPairs& cfg )
{
	unsigned port;
	try {
		port = boost::lexical_cast<unsigned>(cfg.at("port"));
	} catch( boost::bad_lexical_cast& e ) {
		throw invalid_value("Invalid port number in section " + name );
	} catch( std::out_of_range& e ) {
		port = 9002;
	}

	auto draw_name = cfg.count("draw_name") ?  cfg.at("draw_name") : "";

	auto updater = std::make_shared
		<RemotesUpdater>( name , draw_name , cfg.at("address") , port , loc_factory );

	updater->connect();

	updaters[ name ] = updater;
}