virtual void go() {
        release();
        param *p = param::instance();
        update_values(p);

        Iso_rectangle_2 bbox = get_bbox(p);
        std::string ndvi_file = p->get<boost::filesystem::path>("ndvi").string();
        std::string  dsm_file = p->get<boost::filesystem::path>("dsm" ).string();
        clip_bbox(bbox,ndvi_file);
        clip_bbox(bbox,dsm_file );

        gradient_functor gf(p->get<double>("sigmaD"));
        oriented_gradient_view grad_view(dsm_file,  bbox, gf);
        oriented_ndvi_view     ndvi_view(ndvi_file, bbox);

        m_confg_visitor->add_layer(ndvi_file);
        m_confg_visitor->add_layer(dsm_file);
        set_bbox(p,bbox);
        wxPoint p0(wxCoord(bbox.min().x()),wxCoord(bbox.min().y()));
        wxPoint p1(wxCoord(bbox.max().x()),wxCoord(bbox.max().y()));
        m_confg_visitor->set_bbox(wxRect(p0,p1));

        init_visitor        (p,*m_visitor);
        create_configuration(p,grad_view,ndvi_view,m_config);
        create_sampler      (p,m_sampler);
        create_schedule     (p,m_schedule);
        create_end_test     (p,m_end_test);

        m_thread = new boost::thread(
                simulated_annealing::optimize<configuration,sampler,schedule,end_test,visitor>,
                boost::ref(*m_config), boost::ref(*m_sampler),
                boost::ref(*m_schedule), boost::ref(*m_end_test),
                boost::ref(*m_visitor) );
    }
예제 #2
0
파일: main.cpp 프로젝트: lgosha/ssd
int main(int argc, char *argv[])
{
	QString sFile;
	for(int i=1;i<argc;i++) {
		if( QString(argv[i]) == "--file" ) {
			if( ++i < argc ) { sFile = argv[i]; continue; }
		}
	}

	XMLInit();
	int iRes = 0;
	
	iRes = create_configuration( sFile );
	
	const DOMNode *pNode = pXMLConfig->first(XMLConfig::find(pXMLConfig->root(), "", ""));
	QString sComment;
	
	QFile file( sFile + ".comment" );
	file.open( QIODevice::WriteOnly ); 

	QFile filer( sFile + ".reserve" );
	filer.open( QIODevice::WriteOnly ); 

	int iReverse = -1;
	while(pNode) {
		if(pNode->getNodeType() == DOMNode::COMMENT_NODE) {
				
			sComment = XMLConfig::toQString( pNode->getNodeValue() );
			sComment.replace( QRegExp("\\d{9}\\s+"), "" );

			iReverse = -1;
			iReverse = sComment.indexOf("(r)");
		}
		if(pNode->getNodeType() == DOMNode::ELEMENT_NODE) {
		
		    if( !pXMLConfig->isAttr( pNode, "send" ) || pXMLConfig->attr( pNode, "send" ) != "no" ) {
		    
				file.write( QString( "%1 - <!-- %2 -->\n").arg(pXMLConfig->attr(pNode, "id")).arg(sComment).toAscii() );

				QString str = pXMLConfig->attr(pNode, "id").right(3);
				if( str.toInt() > 1 && str.toInt() < 100 ) {
					filer.write( QString("%1 - %2\n").arg(pXMLConfig->attr(pNode, "id")).arg( iReverse ).toAscii() );
				}
		    
				if( pXMLConfig->attr( pNode, "vtype" ) != "int" )
					printf( "\t\t%s <!-- %s -->\n", QString("<through id=\"%1\" serv=\"%SERV\" vtype=\"%2\"\t/>").arg(pXMLConfig->attr(pNode, "id")).arg(pXMLConfig->attr(pNode, "vtype")).toAscii().constData(), sComment.toAscii().constData() );
				else
					printf( "\t\t%s <!-- %s -->\n", QString("<through id=\"%1\" serv=\"%SERV\" vtype=\"%2\"\t\t/>").arg(pXMLConfig->attr(pNode, "id")).arg(pXMLConfig->attr(pNode, "vtype")).toAscii().constData(), sComment.toAscii().constData() );
				}
		}

		pNode = pXMLConfig->next();
	}
	
	file.close();
	filer.close();

	return 0;
}
예제 #3
0
파일: main.cpp 프로젝트: lgosha/ssd
int main( int argc, char **argv ) {

	int iResult = 0;
	// создание файла отчета программы
	aptrMainLog = auto_ptr<ULog>( new ULog( "../ddv.txt", "cp1251") );
	// первое сообщение
	aptrMainLog->add("start report file");

	// инициализация XML библиотеки
	iResult = XMLInit();
	// проверка выполнения предыдущего действия
	if(!iResult) {
		// чтение конфигурационных файлов
		iResult = create_configuration();
		// конфигурационные файлы прочитаны
		if(!iResult) {
			// создание объектов приложения и главного окна
			QApplication app( argc, argv );
			try {
				CMainWnd wnd( pXMLConfig );
				wnd.show();
				iResult = app.exec();
			}
			catch(const ex_base &ex) {
				// исключение
				aptrMainLog->add(
						QStringList("failed") + QStringList(QString("%1: %2").arg(ex.get_where()).arg(ex.get_what())),
						ULog::eMT_Error
						);
				iResult = 6;
			}
		}
	}

	// удаление объектов файлов конфигурации
	aptrMainLog->add("destroy configuration objects");
	delete pXMLConfig;
	aptrMainLog->add("success", ULog::eMT_Success);

	// деинициализация XML библиотеки
	aptrMainLog->add("deinitialize XML library");
	XMLPlatformUtils::Terminate();
	aptrMainLog->add("success", ULog::eMT_Success);

	// последнее сообщение
	aptrMainLog->add("stop  report file");

	return iResult;
}
예제 #4
0
파일: main.c 프로젝트: rtubio/linklayertool
/* main */
int main(int argc, char **argv)
{

	configuration_t *cfg = NULL;
	ll_socket_t *ll_socket = NULL;
	
	/* 1) Runtime configuration is read from the CLI (POSIX.2). */
	cfg = create_configuration(argc, argv);
	print_configuration(cfg);

	/* 2) Link layer socket is open. */
	if ( ( ll_socket = open_ll_socket
						(	cfg->is_transmitter,
							cfg->tx_delay,
							cfg->if_name,
							cfg->lsap,
							cfg->frame_type	)
						) == NULL )
		{ handle_app_error("Could not open ll_socket.\n"); }
	
	#ifdef KERNEL_RING
		log_app_msg("TX socket open with fd = %d\n", ll_socket->tx_socket_fd);
		log_app_msg("RX socket open with fd = %d\n", ll_socket->rx_socket_fd);
	#else
		log_app_msg("Socket open with fd = %d\n", ll_socket->socket_fd);
	#endif

	/* 3) Set-up this programe either as a transmitter or a receiver. */
	if ( cfg->is_transmitter == true )
	{
		log_app_msg("Setting up transmitter mode...\n");
	}
	else
	{
		log_app_msg("Setting up receiver mode...\n");
	}

	//exit(EXIT_SUCCESS);
	start_ll_socket(ll_socket);

	// 4) sockets are closed before exiting application
	close_ll_socket(ll_socket);
	log_app_msg("Socket is closed.\n");

	exit(EXIT_SUCCESS);

}
예제 #5
0
agg_configuration*
tuple_aggregate::add_to_set(vm::tuple *tpl, const ref_count many)
{
   agg_trie_leaf *leaf(vals.find_configuration(tpl));
   agg_configuration *conf;
   
   if(leaf->get_conf() == NULL) {
      conf = create_configuration();
      leaf->set_conf(conf);
   } else {
      conf = leaf->get_conf();
   }
   
   conf->add_to_set(tpl, many);
   
   return conf;
}
예제 #6
0
int main(int argc, char **argv)
{
	
	/*-----------------------------------------------------------------------------
	 *  Very important to note that XInitThreads is a linux implementation only
	 *-----------------------------------------------------------------------------*/
	XInitThreads();
	JNX_LOG(NULL,"Starting game setup\n");	

	jnx_hashmap *config = create_configuration();
	
	if(game_setup(config) == 0)
	{
		game_run();
	}
	else{
		return 1;
	}	
	return 0;
}
예제 #7
0
파일: RSA_Function.c 프로젝트: LiZeC123/RSA
void Initialize(void){ 
	FILE *fp_primer_number;
	FILE *fp_configuration;
	
	fp_primer_number = fopen("primer_number.txt","r");
	fp_configuration = fopen("configuration.txt","r");
	
	//文件不存在或者被改动,则重新创建 
	if( (fp_primer_number == NULL) || (!check_primer_number())){
		create_primer_number();
	}	
		
	if(fp_configuration == NULL){
		create_configuration();
	}
	
	fclose(fp_primer_number);
	fclose(fp_configuration);
	
}