Exemplo n.º 1
0
static void configure_nodes(const std::string &path)
{
	std::vector<server_config> servers;
	for (size_t i = 0; i < groups_count; ++i) {
		for (size_t j = 0; j < nodes_count; ++j) {
			server_config server = default_value(i);
			server.backends[0]("enable", true);
			server.backends[3]("enable", true);
			servers.push_back(server);
		}
	}

	servers.push_back(default_value(groups_count));

	global_data = start_nodes(results_reporter::get_stream(), servers, path, true);
}
Exemplo n.º 2
0
int	init_args(int ac, char **av, t_env *env)
{
  int	i;

  i = 0;
  default_value(env);
  while (i < ac)
    {
      if (strcmp(av[i], "-p") == 0 && av[i + 1])
	env->port = atoi(av[i + 1]);
      else if (strcmp(av[i], "-x") == 0 && av[i + 1])
	env->map.width = atoi(av[i + 1]);
      else if (strcmp(av[i], "-y") == 0 && av[i + 1])
	env->map.height = atoi(av[i + 1]);
      else if (strcmp(av[i], "-n") == 0 && av[i + 1])
	{
	  if (init_team(av, env, i) == -1)
	    return (-1);
	}
      else if (strcmp(av[i], "-c") == 0 && av[i + 1])
	env->max_nb_team = atoi(av[i + 1]);
      else if (strcmp(av[i], "-t") == 0 && av[i + 1])
	env->time = atoi(av[i + 1]);
      i++;
    }
  return ((ac > 3 &&  check_arg(env)) ? 0 : -1);
}
Exemplo n.º 3
0
static bool
maybe_populate_impl(
        const char* name,
        const char* description,
              T&    destination,
        const T&    source,
        const bool  verbose,
        bool (* const default_value)(const T& v))
{
    if (default_value(destination)) {
        if (verbose) {
            // Populating a default isn't interesting, hence DEBUG0
            if (description) {
                DEBUG0("Populating " << name
                      << " (" << description << ") to be " << source);
            } else {
                DEBUG0("Populating " << name << " to be " << source);
            }
        }
        destination = source;
        return true;
    }

    if (verbose) {
        if (description) {
            // Retaining an existing setting is interesting, hence INFO0
            INFO0("Clutching onto " << name
                   << " (" << description << ") of " << destination);
        } else {
            INFO0("Clutching onto " << name << " of " << destination);
        }
    }
    return false;
}
Exemplo n.º 4
0
void Block<T>::clear(T* v, unsigned k)
{
	register T* _p = v;
	register T* lim = v + k;
	T* valptr = default_value();

	while ( _p < lim )
		*_p++ = *valptr;
}
Exemplo n.º 5
0
static nodes_data::ptr configure_test_setup(const std::string &path)
{
	std::vector<server_config> servers;
	for (size_t i = 0; i < groups_count; ++i) {
		for (size_t j = 0; j < nodes_count; ++j) {
			server_config server = default_value(i);
			server.backends[0]("enable", true);
			server.backends[3]("enable", true);
			servers.push_back(server);
		}
	}

	servers.push_back(default_value(groups_count));

	start_nodes_config start_config(results_reporter::get_stream(), std::move(servers), path);
	start_config.fork = true;

	return start_nodes(start_config);
}
Exemplo n.º 6
0
void Block<T>::dummy_fcn()
{
	Block<T> foo;
	foo.size(0);
	foo.move(0,0);
	foo.transfer(0,0);
	foo.clear(0,0);
	foo.copy(foo);
	foo.grow(0);
	(void)default_value();
}
Exemplo n.º 7
0
    virtual size_t active_value() const {
/* Reading of my_active_value is not synchronized with possible updating
   of my_head by other thread. It's ok, as value of my_active_value became
   not invalid, just obsolete. */
        if (!my_head)
            return default_value();
        // non-zero, if market is active
        const size_t workers = market::max_num_workers();
        // We can't exceed market's maximal number of workers.
        // +1 to take master into account
        return workers? min(workers+1, my_active_value): my_active_value;
    }
Exemplo n.º 8
0
Char const* ConfigImpl::get(Char const* kwd) const
{
    verify(kwd);
    Char const* value = 0;
    config_map_t::const_iterator it = m_config_map.find(kwd);
    value = (it == m_config_map.end())
        ? default_value(m_symbols, kwd)
        : it->second.c_str();

    if (!value)
        JAG_INTERNAL_ERROR;

    return value;
}
Exemplo n.º 9
0
static void configure_nodes(const std::string &path)
{
	std::vector<server_config> servers;
	for (size_t i = 0; i < groups_count; ++i) {
		for (size_t j = 0; j < nodes_count; ++j) {
			const int group = i + 1;
			server_config server = default_value(group);
			servers.push_back(server);
		}
	}

	start_nodes_config start_config(results_reporter::get_stream(), std::move(servers), path);
	start_config.fork = true;

	global_data = start_nodes(start_config);
}
Exemplo n.º 10
0
	void Run(){
		Drawing *pDrawingMode = dynamic_cast<Drawing *>(wxGetApp().input_mode_object);
		if (pDrawingMode != NULL)
		{
			wxString message(_("Enter offset in X,Y,Z format (with commas between them)"));
			wxString caption(_("Apply Offset To Selected Location"));
			wxString default_value(_T("0,0,0"));

			wxString value = wxGetTextFromUser(message, caption, default_value);
			wxStringTokenizer tokens(value,_T(" :,\t\n"));
			
			gp_Pnt location(which->m_p);
			for (int i=0; i<3; i++)
			{
				if (tokens.HasMoreTokens())
				{
					double offset = 0.0;
					wxString token = tokens.GetNextToken();
					if (token.ToDouble(&offset))
					{
						offset *= wxGetApp().m_view_units;
						switch(i)
						{
						case 0: 
							location.SetX( location.X() + offset );
							break;

						case 1:
							location.SetY( location.Y() + offset );
							break;

						case 2:
							location.SetZ( location.Z() + offset );
							break;
						}
						
					}
				}
			}

			wxGetApp().m_digitizing->digitized_point = DigitizedPoint(location, DigitizeInputType);
			pDrawingMode->AddPoint();
		}
	}
Exemplo n.º 11
0
/* static */ gp_Pnt HPoint::GetOffset(gp_Pnt location)
{
	wxString message(_("Enter offset in X,Y,Z format (with commas between them)"));
	wxString caption(_("Apply Offset To Selected Location"));
	wxString default_value(_T("0,0,0"));

	wxString value = wxGetTextFromUser(message, caption, default_value);
	wxStringTokenizer tokens(value,_T(":,\t\n"));

	for (int i=0; i<3; i++)
	{
		if (tokens.HasMoreTokens())
		{
			double offset = 0.0;
			wxString token = tokens.GetNextToken();
			wxString evaluated_version;
			if (PropertyDouble::EvaluateWithPython( NULL, token, evaluated_version ))
			{
				evaluated_version.ToDouble(&offset);
				offset *= wxGetApp().m_view_units;
				switch(i)
				{
				case 0:
					location.SetX( location.X() + offset );
					break;

				case 1:
					location.SetY( location.Y() + offset );
					break;

				case 2:
					location.SetZ( location.Z() + offset );
					break;
				}

			}
		}
	}

	return(location);
}
Exemplo n.º 12
0
void mw::XMLParserTestFixture::setUp() {
	mw::FullCoreEnvironmentTestFixture::setUp();
	
	mw::Data default_value(0L);
	testVar = mw::GlobalVariableRegistry->createGlobalVariable( new mw::VariableProperties(&default_value, 
																						   "testVar",
																						   "testVar",
																						   "testVar",
																						   M_NEVER, 
																						   M_WHEN_CHANGED,
																						   true, 
																						   true,
																						   M_CONTINUOUS_INFINITE,
																						   ""));		
	
	CPPUNIT_ASSERT(testVar->getValue().getInteger() == 0);	
	
	ostringstream oss;
	oss << "/tmp/XMLParserTest" << rand() << ".xml";
	temp_xml_file_path = boost::filesystem::path(oss.str(), boost::filesystem::native);
	
}
Exemplo n.º 13
0
server_config server_config::default_srw_value()
{
    server_config config = default_value();
    config.options("srw_config", "tmp");
    return config;
}
Exemplo n.º 14
0
 virtual size_t active_value() const {
     return my_head? my_active_value : default_value();
 }
Exemplo n.º 15
0
void float2_param_t::set_default_value( const Imath::V2f& x)
{
    value().assign( x);
    default_value().assign( x);
}