Exemplo n.º 1
0
//config file processing
int rpc::read_config(std::string sparams)
{
        sconfig=sparams;
        std::replace( sparams.begin(), sparams.end(),';', '\n' );
	std::istrstream fconfig(sparams.c_str());
	//assure(fconfig,fname_config.c_str());
	char buf[200];
	while (fconfig.getline(buf,200))
	{
		std::string nstr(buf);
		if ((nstr.size()>0) and (nstr.at(0)!='/')) {
		int ind1=nstr.find('=');
		int ind2=nstr.length()-1;
		std::string pname=nstr.substr(0,ind1);
		std::string pvalue=nstr.substr(ind1+1,ind2-ind1-2);
		std::string ptype=nstr.substr(ind2);
		if (ptype.length()>0){
		switch (ptype.at(0)){
		case 'd':case 'f':
			set_param(pname,atof(pvalue.c_str()));
			break;
		case 'c':
			set_param(pname,pvalue.at(0));
			break;
		case 'i':
			set_param(pname,atoi(pvalue.c_str()));
			break;
		case 's':
			set_param(pname,pvalue);
			break;
		};};
		};
	};
	return 0;
}
Exemplo n.º 2
0
//Included an init function for this also. Just to be safe.
void GSDevice11::InitExternalFX()
{
	if (!ExShader_Compiled)
	{
		try {
			std::string config_name(theApp.GetConfigS("shaderfx_conf"));
			std::ifstream fconfig(config_name);
			std::stringstream shader;
			if (fconfig.good())
				shader << fconfig.rdbuf() << "\n";
			else
				fprintf(stderr, "GSdx: External shader config '%s' not loaded.\n", config_name.c_str());

			std::string shader_name(theApp.GetConfigS("shaderfx_glsl"));
			std::ifstream fshader(shader_name);
			if (fshader.good())
			{
				shader << fshader.rdbuf();
				CompileShader(shader.str().c_str(), shader.str().length(), shader_name.c_str(), D3D_COMPILE_STANDARD_FILE_INCLUDE, "ps_main", nullptr, &m_shaderfx.ps);
			}
			else
			{
				fprintf(stderr, "GSdx: External shader '%s' not loaded and will be disabled!\n", shader_name.c_str());
			}
		}
		catch (GSDXRecoverableError) {
			printf("GSdx: failed to compile external post-processing shader. \n");
		}
		ExShader_Compiled = true;
	}
}
Exemplo n.º 3
0
//config file processing
int rpc::load_config()
{
	std::ifstream fconfig(fname_config.c_str());
	//assure(fconfig,fname_config.c_str());
	char buf[200];
	while (fconfig.getline(buf,200))
	{
		std::string nstr(buf);
		if ((nstr.size()>0) and (nstr.at(0)!='/')) {
		int ind1=nstr.find('=');
		int ind2=nstr.rfind(' ');
		std::string pname=nstr.substr(0,ind1);
		std::string pvalue=nstr.substr(ind1+1,ind2-ind1-1);
		std::string ptype=nstr.substr(ind2+1);
		parameter new_param;
		new_param.pname=pname;
		switch (ptype.at(0)){
		case 'd':case 'f':
			new_param.ptype=1;
			new_param.dvalue=atof(pvalue.c_str());
			break;
		case 'c':
			new_param.ptype=2;
			new_param.cvalue=pvalue.at(0);
			break;
		case 'i':
			new_param.ptype=3;
			new_param.ivalue=atoi(pvalue.c_str());
			break;
		case 's':
			new_param.ptype=5;
			new_param.strvalue=pvalue;
			break;
		};
		vparams.push_back(new_param);
		};
	};
	if (sconfig.length()>0)
		read_config(sconfig);
	return 0;
}
Exemplo n.º 4
0
int main (int argc, char**argv) {
    int i, j, n, k, iter, curr, next, sum;
    double p, riter;
    if (argc < 2) {
        fprintf (stderr, "Usage: %s <p>\n", argv[0]);
        fprintf (stderr, "where\n");
        fprintf (stderr, "\tp = probability of first transition\n");
        return 1;
    }
    init();
    p = atof (argv[1]);
    
    printf ("Totally asymmetric exclusion process\n");
    printf ("with backward-sequental update rule\n");
    printf ("on a ring with L=%d positions and N=%d particles.\n", L, N);
    printf ("Transition probabilities: p=%lf.\n", p);
    
    for (j=L-1; j>=0; j--) {
        printf ("\nInitial bound: (%d,%d)\n", (L+j-1)%L+1, (L+j)%L+1);
        for (n=0; n<NSTATES; n++) {
            for (i=0; i<L; i++) {
                hist[i] = 0;
                current[i] = 0;
            }
            for (iter=0; iter<NITER; iter++) {
                /* Reinitialization */
                for (i=0; i<L; i++) {
                    icurrent[i] = 0;
                    chain_old[i] = C[n][i];
                    chain[i] = C[n][i];
                }
                for (i=0; i<NSTATES; i++) {
                    prob[i] = 0;
                }
                /* Update chain */
                for (i=L-1; i>=0; i--) {
                    curr = (i+j+L)%L;
                    next = (i+1+j+L)%L;
                    update(curr, next, p);
                }
                fconfig();
                for (i=0; i<L; i++) {
                    if (chain[i]) hist[i]++;
                    if (icurrent[i]) current[i]++;
                }
                for (i=0; i<NSTATES; i++) {
                    if (prob[i]) cprob[i]++;
                }
            }
            for (i=0; i<L; i++) {
                chist[i] += hist[i];
                ccurrent[i] += current[i];
            }
            
            sum=0; for (i=0; i<L; i++) sum+=hist[i];
            
            printf("\n--------------+"); for(i=0; i<L; i++) printf("-------+");
            printf("\nPosition      |"); for(i=0; i<L; i++) printf(" %5d |", i+1);
            printf("\nConfiguration |"); for(i=0; i<L; i++) printf(" %5d |", C[n][i]);
            printf("\n--------------+"); for(i=0; i<L; i++) printf("-------+");
            printf("\nCurrent J     |"); for(i=0; i<L; i++) printf(" %5d |", current[i]);
            printf("\nOccurrences   |"); for(i=0; i<L; i++) printf(" %5d |", hist[i]);
            printf("\n--------------+"); for(i=0; i<L; i++) printf("-------+");
            printf("\nCheck sum of occurrences: %5d", sum);
            printf("\nNumber of iterations:     %5d", NITER);
            printf("\n");
        }
    }
    
    riter = (double) (L * NITER * NSTATES);
    sum = 0; for (i=0; i<NSTATES; i++) sum+=cprob[i];
    
    printf("\nSummary:");
    printf("\n----+"); for(i=0; i<L; i++) printf("-------+");
    printf("\nJ   |"); for(i=0; i<L; i++) printf(" %5.3lf |", ccurrent[i]/riter);
    printf("\nDOS |"); for(i=0; i<L; i++) printf(" %5.3lf |", chist[i]/riter);
    printf("\n----+"); for(i=0; i<L; i++) printf("-------+");
    printf("\nOut configurations: "); for(i=0; i<NSTATES; i++) printf("%5.3lf ", cprob[i]/riter);
    printf("\nCheck sum: %5.3lf", sum/riter);
    printf("\n");
    return 0;
}
Exemplo n.º 5
0
void SettingDlg::SaveSettings()
{
	wxFileConfig fconfig("FluoRender Settings");

	fconfig.Write("ver_major", VERSION_MAJOR_TAG);
	fconfig.Write("ver_minor", VERSION_MINOR_TAG);

	fconfig.SetPath("/gm calculation");
	fconfig.Write("mode", m_gmc_mode);

	fconfig.SetPath("/peeling layers");
	fconfig.Write("value", m_peeling_layers);

	fconfig.SetPath("/micro blend");
	fconfig.Write("mode", m_micro_blend);

	fconfig.SetPath("/save project");
	fconfig.Write("mode", m_prj_save);

	fconfig.SetPath("/realtime compress");
	fconfig.Write("mode", m_realtime_compress);

	fconfig.SetPath("/skip bricks");
	fconfig.Write("mode", m_skip_bricks);

	fconfig.SetPath("/mouse int");
	fconfig.Write("mode", m_mouse_int);

	fconfig.SetPath("/dir shadow");
	fconfig.Write("mode", m_shadow_dir);
	fconfig.Write("x", m_shadow_dir_x);
	fconfig.Write("y", m_shadow_dir_y);

	fconfig.SetPath("/test mode");
	fconfig.Write("speed", m_test_speed);
	fconfig.Write("param", m_test_param);
	fconfig.Write("wiref", m_test_wiref);

	fconfig.SetPath("/wavelength to color");
	fconfig.Write("c1", m_wav_color1);
	fconfig.Write("c2", m_wav_color2);
	fconfig.Write("c3", m_wav_color3);
	fconfig.Write("c4", m_wav_color4);

	fconfig.SetPath("/time id");
	fconfig.Write("value", m_time_id);

	fconfig.SetPath("/grad bg");
	fconfig.Write("value", m_grad_bg);

	fconfig.SetPath("/override vox");
	fconfig.Write("value", m_override_vox);

	fconfig.SetPath("/soft threshold");
	fconfig.Write("value", m_soft_threshold);

	fconfig.SetPath("/save cmp");
	fconfig.Write("value", VRenderFrame::GetCompression());

	fconfig.SetPath("/run script");
	fconfig.Write("value", m_run_script);

	fconfig.SetPath("/paint history");
	fconfig.Write("value", m_paint_hist_depth);

	fconfig.SetPath("/text font");
	fconfig.Write("file", m_font_file);
	fconfig.Write("value", m_text_size);

	//memory settings
	fconfig.SetPath("/memory settings");
	fconfig.Write("mem swap", m_mem_swap);
	fconfig.Write("graphics mem", m_graphics_mem);
	fconfig.Write("large data size", m_large_data_size);
	fconfig.Write("force brick size", m_force_brick_size);
	fconfig.Write("up time", m_up_time);
	EnableStreaming(m_mem_swap);

	//update order
	fconfig.SetPath("/update order");
	fconfig.Write("value", m_update_order);

	//point volume mode
	fconfig.SetPath("/point volume mode");
	fconfig.Write("value", m_point_volume_mode);

	//ruler use transfer function
	fconfig.SetPath("/ruler use transf");
	fconfig.Write("value", m_ruler_use_transf);

	//ruler time dependent
	fconfig.SetPath("/ruler time dependent");
	fconfig.Write("value", m_ruler_time_dep);

	//flags for flipping pvxml
	fconfig.SetPath("/pvxml flip");
	fconfig.Write("x", m_pvxml_flip_x);
	fconfig.Write("y", m_pvxml_flip_y);

	//pixel format
	fconfig.SetPath("/pixel format");
	fconfig.Write("red_bit", m_red_bit);
	fconfig.Write("green_bit", m_green_bit);
	fconfig.Write("blue_bit", m_blue_bit);
	fconfig.Write("alpha_bit", m_alpha_bit);
	fconfig.Write("depth_bit", m_depth_bit);
	fconfig.Write("samples", m_samples);

	//context attrib
	fconfig.SetPath("/context attrib");
	fconfig.Write("gl_major_ver", m_gl_major_ver);
	fconfig.Write("gl_minor_ver", m_gl_minor_ver);
	fconfig.Write("gl_profile_mask", m_gl_profile_mask);

	//cl device
	fconfig.SetPath("/cl device");
	fconfig.Write("device_id", m_cl_device_id);

	wxString expath = wxStandardPaths::Get().GetExecutablePath();
	expath = expath.BeforeLast(GETSLASH(),NULL);
#ifdef _WIN32
    wxString dft = expath + "\\" + SETTING_FILE_NAME;
#else
    wxString dft = expath + "/../Resources/" + SETTING_FILE_NAME;
#endif
	wxFileOutputStream os(dft);
	fconfig.Save(os);
}
Exemplo n.º 6
0
void SettingDlg::GetSettings()
{
	m_gmc_mode = 2;
	m_prj_save = false;
	m_realtime_compress = false;
	m_skip_bricks = false;
	m_test_speed = false;
	m_test_param = false;
	m_test_wiref = false;
	m_peeling_layers = 1;
	m_micro_blend = false;
	m_shadow_dir = false;
	m_shadow_dir_x = 0.0;
	m_shadow_dir_y = 0.0;
	m_mouse_int = true;
	m_wav_color1 = 5;
	m_wav_color2 = 5;
	m_wav_color3 = 5;
	m_wav_color4 = 5;
	m_time_id = "_T";
	m_grad_bg = false;
	m_override_vox = true;
	m_soft_threshold = 0.0;
	m_run_script = false;
	m_text_size = 12;
	m_font_file = "";
	m_mem_swap = false;
	m_graphics_mem = 1000.0;
	m_large_data_size = 1000.0;
	m_force_brick_size = 128;
	m_up_time = 100;
	m_update_order = 0;
	m_point_volume_mode = 0;
	m_ruler_use_transf = false;
	m_ruler_time_dep = true;
	m_pvxml_flip_x = false;
	m_pvxml_flip_y = false;
	m_red_bit = 8;
	m_green_bit = 8;
	m_blue_bit = 8;
	m_alpha_bit = 8;
	m_depth_bit = 24;
	m_samples = 0;
	m_gl_major_ver = 4;
	m_gl_minor_ver = 4;
	m_gl_profile_mask = 2;
	m_cl_device_id = 0;
	m_paint_hist_depth = 0;

	wxString expath = wxStandardPaths::Get().GetExecutablePath();
	expath = expath.BeforeLast(GETSLASH(),NULL);
#ifdef _WIN32
    wxString dft = expath + "\\" + SETTING_FILE_NAME;
#else
    wxString dft = expath + "/../Resources/" + SETTING_FILE_NAME;
#endif
	wxFileInputStream is(dft);
	if (!is.IsOk())
		return;
	wxFileConfig fconfig(is);

	//gradient magnitude
	if (fconfig.Exists("/gm calculation"))
	{
		fconfig.SetPath("/gm calculation");
		m_gmc_mode = fconfig.Read("mode", 2l);
	}
	//depth peeling
	if (fconfig.Exists("/peeling layers"))
	{
		fconfig.SetPath("/peeling layers");
		m_peeling_layers = fconfig.Read("value", 1l);
	}
	//micro blending
	if (fconfig.Exists("/micro blend"))
	{
		fconfig.SetPath("/micro blend");
		fconfig.Read("mode", &m_micro_blend, false);
	}
	//save project
	if (fconfig.Exists("/save project"))
	{
		fconfig.SetPath("/save project");
		fconfig.Read("mode", &m_prj_save, false);
	}
	//realtime compression
	if (fconfig.Exists("/realtime compress"))
	{
		fconfig.SetPath("/realtime compress");
		fconfig.Read("mode", &m_realtime_compress, false);
	}
	//skip empty bricks
	if (fconfig.Exists("/skip bricks"))
	{
		fconfig.SetPath("/skip bricks");
		fconfig.Read("mode", &m_skip_bricks, false);
	}
	//mouse interactions
	if (fconfig.Exists("/mouse int"))
	{
		fconfig.SetPath("/mouse int");
		fconfig.Read("mode", &m_mouse_int, true);
	}
	//shadow
	if (fconfig.Exists("/dir shadow"))
	{
		fconfig.SetPath("/dir shadow");
		fconfig.Read("mode", &m_shadow_dir, false);
		fconfig.Read("x", &m_shadow_dir_x, 0.0);
		fconfig.Read("y", &m_shadow_dir_y, 0.0);
	}
	//test mode
	if (fconfig.Exists("/test mode"))
	{
		fconfig.SetPath("/test mode");
		fconfig.Read("speed", &m_test_speed, false);
		fconfig.Read("param", &m_test_param, false);
		fconfig.Read("wiref", &m_test_wiref, false);
	}
	//wavelength to color
	if (fconfig.Exists("/wavelength to color"))
	{
		fconfig.SetPath("/wavelength to color");
		fconfig.Read("c1", &m_wav_color1, 5);
		fconfig.Read("c2", &m_wav_color2, 5);
		fconfig.Read("c3", &m_wav_color3, 5);
		fconfig.Read("c4", &m_wav_color4, 5);
	}
	//time sequence identifier
	if (fconfig.Exists("/time id"))
	{
		fconfig.SetPath("/time id");
		fconfig.Read("value", &m_time_id);
	}
	//gradient background
	if (fconfig.Exists("/grad bg"))
	{
		fconfig.SetPath("/grad bg");
		fconfig.Read("value", &m_grad_bg);
	}
	//save compressed
	if (fconfig.Exists("/save cmp"))
	{
		bool save_cmp;
		fconfig.SetPath("/save cmp");
		fconfig.Read("value", &save_cmp);
		VRenderFrame::SetCompression(save_cmp);
	}
	//override vox
	if (fconfig.Exists("/override vox"))
	{
		fconfig.SetPath("/override vox");
		fconfig.Read("value", &m_override_vox);
	}
	//soft threshold
	if (fconfig.Exists("/soft threshold"))
	{
		fconfig.SetPath("/soft threshold");
		fconfig.Read("value", &m_soft_threshold);
	}
	//run script
	if (fconfig.Exists("/run script"))
	{
		fconfig.SetPath("/run script");
		fconfig.Read("value", &m_run_script);
	}
	//paint history depth
	if (fconfig.Exists("/paint history"))
	{
		fconfig.SetPath("/paint history");
		fconfig.Read("value", &m_paint_hist_depth);
	}
	//text font
	if (fconfig.Exists("/text font"))
	{
		fconfig.SetPath("/text font");
		fconfig.Read("file", &m_font_file);
		fconfig.Read("value", &m_text_size);
	}
	//memory settings
	if (fconfig.Exists("/memory settings"))
	{
		fconfig.SetPath("/memory settings");
		//enable mem swap
		fconfig.Read("mem swap", &m_mem_swap);
		//graphics memory limit
		fconfig.Read("graphics mem", &m_graphics_mem);
		//large data size
		fconfig.Read("large data size", &m_large_data_size);
		//force brick size
		fconfig.Read("force brick size", &m_force_brick_size);
		//response time
		fconfig.Read("up time", &m_up_time);
	}
	EnableStreaming(m_mem_swap);
	//update order
	if (fconfig.Exists("/update order"))
	{
		fconfig.SetPath("/update order");
		fconfig.Read("value", &m_update_order);
	}
	//point volume mode
	if (fconfig.Exists("/point volume mode"))
	{
		fconfig.SetPath("/point volume mode");
		fconfig.Read("value", &m_point_volume_mode);
	}
	//ruler use transfer function
	if (fconfig.Exists("/ruler use transf"))
	{
		fconfig.SetPath("/ruler use transf");
		fconfig.Read("value", &m_ruler_use_transf);
	}
	//ruler time dependent
	if (fconfig.Exists("/ruler time dep"))
	{
		fconfig.SetPath("/ruler time dep");
		fconfig.Read("value", &m_ruler_time_dep);
	}
	//flags for pvxml flipping
	if (fconfig.Exists("/pvxml flip"))
	{
		fconfig.SetPath("/pvxml flip");
		fconfig.Read("x", &m_pvxml_flip_x);
		fconfig.Read("y", &m_pvxml_flip_y);
	}
	//pixel format
	if (fconfig.Exists("/pixel format"))
	{
		fconfig.SetPath("/pixel format");
		fconfig.Read("red_bit", &m_red_bit);
		fconfig.Read("green_bit", &m_green_bit);
		fconfig.Read("blue_bit", &m_blue_bit);
		fconfig.Read("alpha_bit", &m_alpha_bit);
		fconfig.Read("depth_bit", &m_depth_bit);
		fconfig.Read("samples", &m_samples);
	}
	//context attrib
	if (fconfig.Exists("/context attrib"))
	{
		fconfig.SetPath("/context attrib");
		fconfig.Read("gl_major_ver", &m_gl_major_ver);
		fconfig.Read("gl_minor_ver", &m_gl_minor_ver);
		fconfig.Read("gl_profile_mask", &m_gl_profile_mask);
	}
	//cl device
	if (fconfig.Exists("/cl device"))
	{
		fconfig.SetPath("/cl device");
		fconfig.Read("device_id", &m_cl_device_id);
	}

	UpdateUI();
}
Exemplo n.º 7
0
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  try
    {
      DDS::DomainParticipantFactory_var dpf = TheParticipantFactoryWithArgs(argc, argv);
      DDS::DomainParticipant_var participant1;
      DDS::DomainParticipant_var participant2;

      {
        OpenDDS::DCPS::TypeSupport_var typsup = new Xyz::FooTypeSupportImpl;

        Options configopt(argc, argv);
        ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Running colocation opt %C\n"),
          configopt.collocation_str.c_str()
        ));
        Factory fconfig(configopt, typsup);

        Options plainopt;
        Factory fplain(plainopt, typsup);

        DDS::DataReaderListener_var drl1(new DataReaderListenerImpl(configopt));
        DDS::DataReaderListener_var drl2(new DataReaderListenerImpl(plainopt));

        if (configopt.collocation_str == "none")
          {
            participant1 = fconfig.participant(dpf);
            Puller r(fconfig, dpf, participant1, drl1);
            TEST_ASSERT(assert_supported(configopt, r.reader_.in()));
            r.pull(ACE_Time_Value(1));

          }
        else if (configopt.collocation_str == "process")
          {
            participant1 = fconfig.participant(dpf);
            Puller r1(fconfig, dpf, participant1, drl1);

            participant2 = fplain.participant(dpf);
            Puller r2(fplain, dpf, participant2, drl2);

            TEST_ASSERT (participant1.in() != participant2.in());

            TEST_ASSERT(assert_supported(configopt, r1.reader_));
            if (configopt.entity_str == "none")
              {
                TEST_ASSERT(assert_supported(configopt, r1.reader_));
              }
            else
              {
                TEST_ASSERT(!assert_supported(configopt, r2.reader_));
              }

            r1.pull(ACE_Time_Value(1));
          }
        else if (configopt.collocation_str == "participant")
          {
            participant1 = fconfig.participant(dpf);
            participant2 = participant1;

            Puller r1(fconfig, dpf, participant1, drl1);

            Puller r2(fplain, dpf, participant2, drl2);

            TEST_ASSERT(assert_supported(configopt, r1.reader_));
            TEST_ASSERT(assert_supported(configopt, r2.reader_));

            r1.pull(ACE_Time_Value(1));
          }

        else if (configopt.collocation_str == "pubsub")
          {
            participant1 = fconfig.participant(dpf);
            participant2 = participant1;

            DDS::Subscriber_var subscriber1(fconfig.subscriber(participant1));
            Puller r1(fconfig, dpf, participant1, subscriber1, drl1);

            DDS::Subscriber_var subscriber2(fplain.subscriber(participant2));
            Puller r2(fplain, dpf, participant2, subscriber2, drl1);

            TEST_ASSERT(assert_supported(configopt, r1.reader_));
            TEST_ASSERT(assert_supported(configopt, r2.reader_));

            r1.pull(ACE_Time_Value(1));
          }

        if (configopt.collocation_str == "none")
          {
            TEST_ASSERT(assert_subscription_matched(configopt, drl1));
          }
        else if (configopt.collocation_str == "process")
          {
            TEST_ASSERT(assert_subscription_matched(configopt, drl1)
                        && assert_subscription_matched(configopt, drl2));
          }
        else if (configopt.collocation_str == "participant")
          {
            TEST_ASSERT(assert_subscription_matched(configopt, drl1)
                        && assert_subscription_matched(configopt, drl2));
          }
        else if (configopt.collocation_str == "pubsub")
          {
            TEST_ASSERT(assert_subscription_matched(configopt, drl1)
                        && assert_subscription_matched(configopt, drl2));
          }
      }

      ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Shutting subscriber down ...\n")));

      {
        ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, shutdown_lock, 1);
        shutdown_flag = true;
      }

      // only want to clean up participant2 if it isn't just pointing to
      // participant1
      if (participant1.in() == participant2.in())
        participant2 = 0;

      if (participant1) {
        ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) deleting entities1\n")));
        // Delete any topics, publishers and subscribers owned by participant
        participant1->delete_contained_entities();
        ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) deleting participant1\n")));
        // Delete participant itself
        dpf->delete_participant(participant1);
      }
      if (participant2) {
        ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) deleting entities2\n")));
        // Delete any topics, publishers and subscribers owned by participant
        participant2->delete_contained_entities();
        ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) deleting participant2\n")));
        // Delete participant itself
        dpf->delete_participant(participant2);
      }
      ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Subscriber shutting down svc part\n")));
      // Shut down info repo connection
      TheServiceParticipant->shutdown();
      ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Subscriber shutdown complete\n")));

    }
  catch (char const *ex)
    {
      ACE_ERROR_RETURN((LM_ERROR,
                    ACE_TEXT("(%P|%t) Assertion failed.\n"), ex), -1);
    }
  catch (const CORBA::Exception &ex)
    {
      ex._tao_print_exception("Exception caught in main.cpp:");
      return 1;
    }
  catch (const OpenDDS::DCPS::Transport::MiscProblem& )
    {
      ACE_ERROR_RETURN((LM_ERROR,
                    ACE_TEXT("(%P|%t) Transport::MiscProblem caught.\n")), -1);
    }

  ACE_ERROR_RETURN((LM_INFO,
                    ACE_TEXT("(%P|%t) done.\n")), 0);
}
Exemplo n.º 8
0
//load default
void BrushToolDlg::LoadDefault()
{
	wxString expath = wxStandardPaths::Get().GetExecutablePath();
	expath = expath.BeforeLast(GETSLASH(),NULL);
#ifdef _WIN32
	wxString dft = expath + "\\default_brush_settings.dft";
#else
	wxString dft = expath + "/../Resources/default_brush_settings.dft";
#endif
	wxFileInputStream is(dft);
	if (!is.IsOk())
		return;
	wxFileConfig fconfig(is);

	wxString str;
	double val;
	int ival;
	bool bval;

	//brush properties
	fconfig.Read("brush_ini_thresh", &m_dft_ini_thresh);
	fconfig.Read("brush_gm_falloff", &m_dft_gm_falloff);
	fconfig.Read("brush_scl_falloff", &m_dft_scl_falloff);
	if (fconfig.Read("brush_scl_translate", &m_dft_scl_translate))
	{
		str = wxString::Format("%.1f", m_dft_scl_translate*m_max_value);
		m_brush_scl_translate_sldr->SetRange(0, int(m_max_value*10.0));
		m_brush_scl_translate_text->SetValue(str);
	}
	//auto thresh
	if (fconfig.Read("auto_thresh", &bval))
		m_estimate_thresh_chk->SetValue(bval);
	//edge detect
	if (fconfig.Read("edge_detect", &bval))
		m_edge_detect_chk->SetValue(bval);
	//hidden removal
	if (fconfig.Read("hidden_removal", &bval))
		m_hidden_removal_chk->SetValue(bval);
	//select group
	if (fconfig.Read("select_group", &bval))
		m_select_group_chk->SetValue(bval);
	//2d influence
	if (fconfig.Read("brush_2dinfl", &val))
	{
		str = wxString::Format("%.2f", val);
		m_brush_2dinfl_text->SetValue(str);
	}
	//size 1
	if (fconfig.Read("brush_size1", &val) && val>0.0)
	{
		str = wxString::Format("%d", (int)val);
		m_brush_size1_text->SetValue(str);
	}
	//size 2 link
	if (fconfig.Read("use_brush_size2", &bval))
	{
		m_brush_size2_chk->SetValue(bval);
		if (bval)
		{
			m_brush_size2_sldr->Enable();
			m_brush_size2_text->Enable();
		}
		else
		{
			m_brush_size2_sldr->Disable();
			m_brush_size2_text->Disable();
		}
	}
	//size 2
	if (fconfig.Read("brush_size2", &val) && val>0.0)
	{
		str = wxString::Format("%d", (int)val);
		m_brush_size2_text->SetValue(str);
	}
	//iterations
	if (fconfig.Read("brush_iters", &ival))
	{
		switch (ival)
		{
		case 1:
			m_brush_iterw_rb->SetValue(true);
			m_brush_iters_rb->SetValue(false);
			m_brush_iterss_rb->SetValue(false);
			break;
		case 2:
			m_brush_iterw_rb->SetValue(false);
			m_brush_iters_rb->SetValue(true);
			m_brush_iterss_rb->SetValue(false);
			break;
		case 3:
			m_brush_iterw_rb->SetValue(false);
			m_brush_iters_rb->SetValue(false);
			m_brush_iterss_rb->SetValue(true);
			break;
		}
	}
	//component analyzer
	//selected only
	if (fconfig.Read("ca_select_only", &bval))
		m_ca_select_only_chk->SetValue(bval);
	//min voxel
	if (fconfig.Read("ca_min", &ival))
	{
		m_dft_ca_min = ival;
		str = wxString::Format("%d", ival);
		m_ca_min_text->SetValue(str);
	}
	//max voxel
	if (fconfig.Read("ca_max", &ival))
	{
		m_dft_ca_max = ival;
		str = wxString::Format("%d", ival);
		m_ca_max_text->SetValue(str);
	}
	//ignore max
	if (fconfig.Read("ca_ignore_max", &bval))
	{
		m_ca_ignore_max_chk->SetValue(bval);
		if (bval)
			m_ca_max_text->Disable();
		else
			m_ca_max_text->Enable();
	}
	//thresh
	if (fconfig.Read("ca_thresh", &m_dft_ca_thresh))
	{
		str = wxString::Format("%.1f", m_dft_ca_thresh*m_max_value);
		m_ca_thresh_sldr->SetRange(0, int(m_max_value*10.0));
		m_ca_thresh_text->SetValue(str);
	}
	//falloff
	fconfig.Read("ca_falloff", &m_dft_ca_falloff);
	//size map
	if (fconfig.Read("ca_size_map", &bval))
		m_ca_size_map_chk->SetValue(bval);   
	//nr thresh
	fconfig.Read("nr_thresh", &m_dft_nr_thresh);
	//nr size
	if (fconfig.Read("nr_size", &m_dft_nr_size))
	{
		str = wxString::Format("%d", (int)val);
		m_nr_size_text->SetValue(str);
	}
}
Exemplo n.º 9
0
//save default
void BrushToolDlg::SaveDefault()
{
	wxFileConfig fconfig("FluoRender default brush settings");
	double val;
	wxString str;
	//brush properties
	fconfig.Write("brush_ini_thresh", m_dft_ini_thresh);
	fconfig.Write("brush_gm_falloff", m_dft_gm_falloff);
	fconfig.Write("brush_scl_falloff", m_dft_scl_falloff);
	fconfig.Write("brush_scl_translate", m_dft_scl_translate);
	//auto thresh
	fconfig.Write("auto_thresh", m_estimate_thresh_chk->GetValue());
	//edge detect
	fconfig.Write("edge_detect", m_edge_detect_chk->GetValue());
	//hidden removal
	fconfig.Write("hidden_removal", m_hidden_removal_chk->GetValue());
	//select group
	fconfig.Write("select_group", m_select_group_chk->GetValue());
	//2d influence
	str = m_brush_2dinfl_text->GetValue();
	str.ToDouble(&val);
	fconfig.Write("brush_2dinfl", val);
	//size 1
	str = m_brush_size1_text->GetValue();
	str.ToDouble(&val);
	fconfig.Write("brush_size1", val);
	//size2 link
	fconfig.Write("use_brush_size2", m_brush_size2_chk->GetValue());
	//size 2
	str = m_brush_size2_text->GetValue();
	str.ToDouble(&val);
	fconfig.Write("brush_size2", val);
	//iterations
	int ival = m_brush_iterw_rb->GetValue()?1:
		m_brush_iters_rb->GetValue()?2:
		m_brush_iterss_rb->GetValue()?3:0;
	fconfig.Write("brush_iters", ival);
	//component analyzer
	//selected only
	fconfig.Write("ca_select_only", m_ca_select_only_chk->GetValue());
	//min voxel
	str = m_ca_min_text->GetValue();
	str.ToDouble(&val);
	fconfig.Write("ca_min", val);
	//max voxel
	str = m_ca_max_text->GetValue();
	str.ToDouble(&val);
	fconfig.Write("ca_max", val);
	//ignore max
	fconfig.Write("ca_ignore_max", m_ca_ignore_max_chk->GetValue());
	//thresh
	fconfig.Write("ca_thresh", m_dft_ca_thresh);
	//falloff
	fconfig.Write("ca_falloff", m_dft_ca_falloff);
	//size map
	fconfig.Write("ca_size_map", m_ca_size_map_chk->GetValue());	
	//noise removal
	//nr thresh
	fconfig.Write("nr_thresh", m_dft_nr_thresh);
	//nr_size
	wxString expath = wxStandardPaths::Get().GetExecutablePath();
	expath = expath.BeforeLast(GETSLASH(),NULL);
#ifdef _WIN32
	wxString dft = expath + "\\default_brush_settings.dft";
#else
	wxString dft = expath + "/../Resources/default_brush_settings.dft";
#endif
	wxFileOutputStream os(dft);
	fconfig.Save(os);
}