• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_param函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中set_param函数的典型用法代码示例。如果您正苦于以下问题:C++ set_param函数的具体用法?C++ set_param怎么用?C++ set_param使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了set_param函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: fconfig

//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;
}
开发者ID:HossainTanvir,项目名称:uni,代码行数:36,代码来源:rpc.cpp


示例2: define_param_map

 /**
 * Constructs a WORHP algorithm
 */
worhp::worhp(int iter, double feas, double opt, bool screen_output)
{
	// We construct the map between parameters and integers used to set and get them
	define_param_map();

	// We set the screen output member from algorithm::base
	set_screen_output(screen_output);

	// We deactivate WORHP keyboard handler as it does introduce funny problems
	setenv("WORHP_DISABLE_KEYBOARD_HANDLER", "1", 0);

	// We deal with screen output (this is buggy in lworhp 1.8.0, hopefully future releases can fix the problem
	// and we will be able to restore the screen output upon request
	if (m_screen_output) {
		SetWorhpPrint(default_output);
	} else {
		SetWorhpPrint(no_screen_output);
	}

	// We read the algorithm parameters from the xml file, if this is not found
	// we set default values and ignore the issue.
	int status;
	m_params.initialised = false;
	ReadParams(&status, const_cast<char*>("param.xml"), &m_params);
	status = OK;
	m_params.MatrixCC = false; // Not sure what this deas exactly

	// We set some of the parameters exposed in the constructor
	set_param("TolFeas", feas);
	set_param("TolOpti", opt);
	set_param("MaxIter", iter);
}
开发者ID:osm3000,项目名称:pagmo,代码行数:35,代码来源:worhp.cpp


示例3: set_param_option

int
set_param_option(char *option)
{
    Str tmp = Strnew();
    char *p = option, *q;

    while (*p && !IS_SPACE(*p) && *p != '=')
	Strcat_char(tmp, *p++);
    while (*p && IS_SPACE(*p))
	p++;
    if (*p == '=') {
	p++;
	while (*p && IS_SPACE(*p))
	    p++;
    }
    Strlower(tmp);
    if (set_param(tmp->ptr, p))
	goto option_assigned;
    q = tmp->ptr;
    if (!strncmp(q, "no", 2)) {	/* -o noxxx, -o no-xxx, -o no_xxx */
	q += 2;
	if (*q == '-' || *q == '_')
	    q++;
    }
    else if (tmp->ptr[0] == '-')	/* -o -xxx */
	q++;
    else
	return 0;
    if (set_param(q, "0"))
	goto option_assigned;
    return 0;
  option_assigned:
    return 1;
}
开发者ID:galexcode,项目名称:w3m,代码行数:34,代码来源:rc.c


示例4: checkAndPushRanges

 void checkAndPushRanges(CamData& cd, string param_name, dc1394feature_t feature)
 {
   uint32_t min;
   uint32_t max;
   cd.cam->getFeatureBoundaries(feature, min, max);
   set_param(cd.name + string("/") + param_name + string("_min"), (int)(min));
   set_param(cd.name + string("/") + param_name + string("_max"), (int)(max));
 }
开发者ID:janfrs,项目名称:kwc-ros-pkg,代码行数:8,代码来源:dc1394_cam_server.cpp


示例5: test_param_int

static void test_param_int(CuTest * tc)
{
    struct param *par = 0;
    test_cleanup();
    CuAssertIntEquals(tc, 13, get_param_int(par, "foo", 13));
    set_param(&par, "foo", "23");
    set_param(&par, "bar", "42");
    CuAssertIntEquals(tc, 23, get_param_int(par, "foo", 0));
    CuAssertIntEquals(tc, 42, get_param_int(par, "bar", 0));
}
开发者ID:Xolgrim,项目名称:server,代码行数:10,代码来源:config.test.c


示例6: test_param_flt

static void test_param_flt(CuTest * tc)
{
    struct param *par = 0;
    test_cleanup();
    CuAssertDblEquals(tc, 13, get_param_flt(par, "foo", 13), 0.01);
    set_param(&par, "foo", "23.0");
    set_param(&par, "bar", "42.0");
    CuAssertDblEquals(tc, 23.0, get_param_flt(par, "foo", 0.0), 0.01);
    CuAssertDblEquals(tc, 42.0, get_param_flt(par, "bar", 0.0), 0.01);
}
开发者ID:Xolgrim,项目名称:server,代码行数:10,代码来源:config.test.c


示例7: test_get_set_param

static void test_get_set_param(CuTest * tc)
{
    struct param *par = 0;
    test_cleanup();
    CuAssertStrEquals(tc, 0, get_param(par, "foo"));
    set_param(&par, "foo", "bar");
    set_param(&par, "bar", "foo");
    CuAssertStrEquals(tc, "bar", get_param(par, "foo"));
    CuAssertStrEquals(tc, "foo", get_param(par, "bar"));
}
开发者ID:TomBraun,项目名称:server,代码行数:10,代码来源:config.test.c


示例8: eq_value_changed

void
eq_value_changed (DdbEqualizer *widget)
{
    ddb_dsp_context_t *eq = get_supereq ();
    if (eq) {
        for (int i = 0; i < 18; i++) {
            set_param (eq, i+1, ddb_equalizer_get_band (widget, i));
        }
        set_param (eq, 0, ddb_equalizer_get_preamp (widget));
        deadbeef->streamer_dsp_chain_save ();
    }
}
开发者ID:Gardenya,项目名称:deadbeef,代码行数:12,代码来源:eq.c


示例9: test_unit_limit

static void test_unit_limit(CuTest * tc)
{
  set_param(&global.parameters, "rules.limit.faction", "250");
  CuAssertIntEquals(tc, 250, rule_faction_limit());

  set_param(&global.parameters, "rules.limit.faction", "200");
  CuAssertIntEquals(tc, 200, rule_faction_limit());

  set_param(&global.parameters, "rules.limit.alliance", "250");
  CuAssertIntEquals(tc, 250, rule_alliance_limit());

}
开发者ID:TomBraun,项目名称:server,代码行数:12,代码来源:laws.test.c


示例10: LCD_init

void LCD_init()
{
	int i;
	
	for (i = 0; i < 50*1000*15; i++); // wait 15msec	
	set_param(3);	
	for (i = 0; i < 50*1000*5; i++); // wait 5msec
	set_param(3);
	for (i = 0; i < 50*1000*1; i++); // wait 1msec
	set_param(3);
	for (i = 0; i < 50*1000*1; i++); // wait 1msec
	set_param(2);
	for (i = 0; i < 50*1000*1; i++); // wait 1msec
}
开发者ID:OpenORBE,项目名称:orbe,代码行数:14,代码来源:LCDImpl.c


示例11: test_cannot_create_unit_above_limit

static void test_cannot_create_unit_above_limit(CuTest * tc)
{
  faction *f;

  test_cleanup();
  test_create_world();
  f = test_create_faction(rc_find("human"));
  set_param(&global.parameters, "rules.limit.faction", "4");

  CuAssertIntEquals(tc, 0, checkunitnumber(f, 4));
  CuAssertIntEquals(tc, 2, checkunitnumber(f, 5));

  set_param(&global.parameters, "rules.limit.alliance", "3");
  CuAssertIntEquals(tc, 0, checkunitnumber(f, 3));
  CuAssertIntEquals(tc, 1, checkunitnumber(f, 4));
}
开发者ID:TomBraun,项目名称:server,代码行数:16,代码来源:laws.test.c


示例12: test_upkeep_hunger_damage

void test_upkeep_hunger_damage(CuTest * tc)
{
    region *r;
    unit *u1;
    faction *f1;
    const item_type *i_silver;

    test_cleanup();
    test_create_world();

    i_silver = it_find("money");
    assert(i_silver);
    r = findregion(0, 0);
    f1 = test_create_faction(test_create_race("human"));
    u1 = test_create_unit(f1, r);
    assert(r && u1);

    set_param(&global.parameters, "rules.food.flags", "0");
    u1->hp = 100;
    get_food(r);
    // since u1 and u2 are not allied, u1 should not help u2 with upkeep
    CuAssertTrue(tc, u1->hp < 100);

    test_cleanup();
}
开发者ID:philbooth,项目名称:server,代码行数:25,代码来源:upkeep.test.c


示例13: test_upkeep_from_pool

void test_upkeep_from_pool(CuTest * tc)
{
    region *r;
    unit *u1, *u2;
    const item_type *i_silver;

    test_cleanup();
    test_create_world();

    i_silver = it_find("money");
    assert(i_silver);
    r = findregion(0, 0);
    u1 = test_create_unit(test_create_faction(test_create_race("human")), r);
	assert(u1);
    u2 = test_create_unit(u1->faction, r);
    assert(r && u1 && u2);

    set_param(&global.parameters, "rules.food.flags", "0");
    i_change(&u1->items, i_silver, 30);
    get_food(r);
    CuAssertIntEquals(tc, 10, i_get(u1->items, i_silver));
    CuAssertIntEquals(tc, 0, fval(u1, UFL_HUNGER));
    CuAssertIntEquals(tc, 0, fval(u2, UFL_HUNGER));
    get_food(r);
    CuAssertIntEquals(tc, 0, i_get(u1->items, i_silver));
    CuAssertIntEquals(tc, 0, fval(u1, UFL_HUNGER));
    CuAssertIntEquals(tc, UFL_HUNGER, fval(u2, UFL_HUNGER));

    test_cleanup();
}
开发者ID:philbooth,项目名称:server,代码行数:30,代码来源:upkeep.test.c


示例14: InputTemp

ZibaseTemp::ZibaseTemp(Params &p):
    InputTemp(p),
    port(0)
{
    // Define IO documentation
    ioDoc->friendlyNameSet("ZibaseTemp");
    ioDoc->descriptionSet(_("Zibase temperature sensor"));
    ioDoc->paramAdd("host", _("Zibase IP address on the network"), IODoc::TYPE_STRING, true);
    ioDoc->paramAddInt("port", _("Zibase ethernet port, default to 17100"), 0, 65535, false, 17100);
    ioDoc->paramAdd("zibase_id", _("Zibase device ID (ABC)"), IODoc::TYPE_STRING, true);

    Params devList = {{ "temp", _("Temperature sensor") }};
    ioDoc->paramAddList("zibase_sensor", "Type of sensor", true, devList, "temp");

    if (!param_exists("port")) set_param("port", "17100");

    host = get_param("host");
    Utils::from_string(get_param("port"), port);
    id = get_param("zibase_id");

    sensor_type = ZibaseInfoSensor::eTEMP;

    Zibase::Instance(host, port).sig_newframe.connect(sigc::mem_fun(*this, &ZibaseTemp::valueUpdated));

    cDebugDom("input") << get_param("id");
}
开发者ID:expertisesolutions,项目名称:calaos_base,代码行数:26,代码来源:ZibaseTemp.cpp


示例15: test_shipspeed_max_range

static void test_shipspeed_max_range(CuTest *tc) {
    ship *sh;
    ship_type *stype;
    region *r;
    struct faction *f;
    unit *cap, *crew;

    test_cleanup();
    sh = setup_ship();
    setup_crew(sh, 0, &cap, &crew);
    set_param(&global.parameters, "movement.shipspeed.skillbonus", "5");
    r = sh->region;
    f = test_create_faction(0);
    assert(r && f);
    stype = st_get_or_create(sh->type->_name);

    set_level(cap, SK_SAILING, stype->cptskill + 4);
    set_level(crew, SK_SAILING, (stype->sumskill - stype->cptskill) * 4);
    CuAssertIntEquals_Msg(tc, "skill bonus requires at least movement.shipspeed.skillbonus points", 2, shipspeed(sh, cap));

    set_level(cap, SK_SAILING, stype->cptskill + 5);
    set_level(crew, SK_SAILING, (stype->sumskill - stype->cptskill) * 5);
    CuAssertIntEquals_Msg(tc, "skill bonus from movement.shipspeed.skillbonus", 3, shipspeed(sh, cap));

    set_level(cap, SK_SAILING, stype->cptskill + 15);
    set_level(crew, SK_SAILING, (stype->sumskill - stype->cptskill) * 15);
    CuAssertIntEquals_Msg(tc, "skill-bonus cannot exceed max_range", 4, shipspeed(sh, cap));
    test_cleanup();
}
开发者ID:philbooth,项目名称:server,代码行数:29,代码来源:ship.test.c


示例16: tcp_open

/*
 ****************************************************************
 *	Abre a conexão (parte do servidor)			*
 ****************************************************************
 */
int
tcp_open (int port)
{
	int		fd;
	T_BIND		req;
	INADDR		req_addr;

	if ((fd = t_open (tcpdevname, O_RDWR, (T_INFO *)NULL)) < 0)
		return (-1);

	/*
	 *	Preenche a estrutura T_BIND
	 */
	FILL_INADDR (req_addr, 0, port);
	FILL_NETBUF (req.addr, &req_addr, sizeof (req_addr));
	req.qlen = MAX_LISTEN_QLEN;

	if (t_bind (fd, &req, (T_BIND *)NULL) < 0)
		goto bad;

	if (set_param (fd) < 0)
		goto bad;

	listen_port = port;

	return (fd);

bad:	t_close (fd);
	return (-1);

}	/* end tcp_open */
开发者ID:marioaugustorama,项目名称:tropix-cmd,代码行数:36,代码来源:tcp.c


示例17: tcp_connect

/*
 ****************************************************************
 *	Inicia um cliente					*
 ****************************************************************
 */
int
tcp_connect (int port, const char *name)
{
	int		fd;
	T_BIND		bind;
	T_CALL		call;
	INADDR		bind_addr, addr;
	IPADDR		remote_ip_addr;

	if ((fd = t_open (tcpdevname, O_RDWR, (T_INFO *)NULL)) < 0)
		return (-1);

	/*
	 *	Associa um endereço local.
	 */
	FILL_INADDR (bind_addr, 0, 0);
	FILL_NETBUF (bind.addr, &bind_addr, sizeof (bind_addr));
	bind.qlen = 0;		/* Não vamos dar "t_listen" nesta conexão */

	if (t_bind (fd, &bind, (T_BIND *)NULL) < 0)
		goto bad;

	if (set_param (fd) < 0)
		goto bad;

	/*
	 *	Converte o nome da estação remota em um endereço IP.
	 */
	if (name != NOSTR && name[0] != '\0')
	{
		remote_ip_addr = t_node_to_addr (fd, name, NULL);
		if (remote_ip_addr == -1)
			goto bad;
	}
	else
	{
		remote_ip_addr = LOCAL_IP_ADDR;
	}

	/*
	 *	Preenche a estrutura T_CALL: só o membro addr é relevante.
	 */
	FILL_INADDR (addr, remote_ip_addr, port);

	FILL_NETBUF (call.addr,  &addr, sizeof (addr));
	FILL_NETBUF (call.opt,   NULL,       0);
	FILL_NETBUF (call.udata, NULL,       0);

	/*
	 *	Tenta estabeler a conexão com a estação remota.
	 */
	if (t_connect (fd, &call, (T_CALL *)NULL) < 0)
		goto bad;

	return (fd);

bad:	t_close (fd);
	return (-1);

}	/* end tcp_connect */
开发者ID:marioaugustorama,项目名称:tropix-cmd,代码行数:65,代码来源:tcp.c


示例18: panel_set_option

void
panel_set_option(struct parsed_tagarg *arg)
{
    FILE *f = NULL;
    char *p;

    if (no_rc_dir) {
	disp_message("There's no ~/.w3m directory... config not saved", FALSE);
    }
    else {
	f = fopen(config_file, "wt");
	if (f == NULL) {
	    disp_message("Can't write option!", FALSE);
	}
    }
    while (arg) {
	/*  InnerCharset -> SystemCharset */
	if (arg->value) {
	    p = conv_to_system(arg->value);
	    if (set_param(arg->arg, p)) {
		if (f)
		    fprintf(f, "%s %s\n", arg->arg, p);
	    }
	}
	arg = arg->next;
    }
    if (f)
	fclose(f);
    sync_with_option();
    backBf();
}
开发者ID:galexcode,项目名称:w3m,代码行数:31,代码来源:rc.c


示例19: parse_query

/**
 * Parse the name=value pairs in the query string and set parameters
 * @param params The fastphoto parameters to set
 * @param query The query string
 */
static void
parse_query (fastphoto_t * params, char * query)
{
  char * key, * val, * end;

  if (!query) return;

  key = query;

  do {
    val = strchr (key, '=');
    end = strchr (key, '&');

    if (end) {
      if (val) {
        if (val < end) {
          *val++ = '\0';
        } else {
          val = NULL;
        }
      }
      *end++ = '\0';
    } else {
      if (val) *val++ = '\0';
    }

    /* fprintf (stderr, "%s = %s\n", key, val);*/
    set_param (params, key, val);

    key = end;

  } while (end != NULL);

  return;
}
开发者ID:kfish,项目名称:fastphoto,代码行数:40,代码来源:cgi.c


示例20: interpret_rc

static void
interpret_rc(FILE * f)
{
    Str line;
    Str tmp;
    char *p;

    for (;;) {
	line = Strfgets(f);
	Strchop(line);
	if (line->length == 0)
	    break;
	Strremovefirstspaces(line);
	if (line->ptr[0] == '#')	/* comment */
	    continue;
	tmp = Strnew();
	p = line->ptr;
	while (*p && !IS_SPACE(*p))
	    Strcat_char(tmp, *p++);
	while (*p && IS_SPACE(*p))
	    p++;
	Strlower(tmp);
	set_param(tmp->ptr, p);
    }
}
开发者ID:galexcode,项目名称:w3m,代码行数:25,代码来源:rc.c



注:本文中的set_param函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_params函数代码示例发布时间:2022-05-30
下一篇:
C++ set_palette函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap