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

C++ svector类代码示例

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

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



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

示例1: parseFormat

int parseFormat(string ffname, ivector & tvec, svector & dnames, svector & delims, int *grpsize) {
  ifstream ifstr(ffname.c_str(), ios::in);
  if (ifstr.fail() || ifstr.eof()) {
    cerr << "couldnt open format file" << endl;
    throw;
  }
  char *next, *third, *newstr, *linebuf = new char[80];
  while (!ifstr.bad() && !ifstr.eof()) {
    ifstr.getline(linebuf, 80);
    if (strlen(linebuf) > 1) {
      next = strchr(linebuf, ' ');
      *next++ = 0;
      third = strchr(next, ' ');
      if (third)
	*third++ = 0;
      dnames.push_back(next);
      if (strncmp(linebuf, "int", 3) == 0) {
	tvec.push_back(ftype_int);
	delims.push_back("");
      } else if (strncmp(linebuf, "dint", 4) == 0) {
	tvec.push_back(ftype_dint);
	delims.push_back("");
      } else if (strncmp(linebuf, "qhex", 4) == 0) {
	tvec.push_back(ftype_qhex);
	delims.push_back("");
      } else if (strncmp(linebuf, "float", 5) == 0) {
	tvec.push_back(ftype_float);
	delims.push_back("");
      } else if (strncmp(linebuf, "double", 6) == 0) {
	tvec.push_back(ftype_double);
	delims.push_back("");
      } else if (strncmp(linebuf, "word", 4) == 0) {
	tvec.push_back(ftype_word);
	delims.push_back("");
      } else if (strncmp(linebuf, "string", 6) == 0) {
	tvec.push_back(ftype_string);
	ifstr.getline(linebuf, 80);
        newstr = new char[strlen(linebuf)+1];
        strcpy(newstr, linebuf);
	delims.push_back(newstr);
      } else if (strncmp(linebuf, "date", 4) == 0) {
	tvec.push_back(ftype_date);
	delims.push_back("");
      } else if (strncmp(linebuf, "mdate", 5) == 0) {
	tvec.push_back(ftype_mdate);
	delims.push_back("");
      } else if (strncmp(linebuf, "cmdate", 6) == 0) {
	tvec.push_back(ftype_cmdate);
	delims.push_back("");
      } else if (strncmp(linebuf, "dt", 2) == 0) {
	tvec.push_back(ftype_dt);
	delims.push_back("");
      } else if (strncmp(linebuf, "mdt", 3) == 0) {
	tvec.push_back(ftype_mdt);
	delims.push_back("");
      } else if (strncmp(linebuf, "group", 5) == 0) {
	sscanf(third, "%d", grpsize);
	tvec.push_back(ftype_group);
	delims.push_back("");
      } else if (strncmp(linebuf, "igroup", 6) == 0) {
	sscanf(third, "%d", grpsize);
	tvec.push_back(ftype_igroup);
	ifstr.getline(linebuf, 80);
	delims.push_back(linebuf);
      } else if (strncmp(linebuf, "digroup", 7) == 0) {
	sscanf(third, "%d", grpsize);
	tvec.push_back(ftype_digroup);
	ifstr.getline(linebuf, 80);
	delims.push_back(linebuf);
      } else {
        cerr << "couldnt parse format file line " << tvec.size()+1 << endl;
	throw;
      }
    }
  }
  return tvec.size();
  delete [] linebuf;
}
开发者ID:codeaudit,项目名称:BIDMach,代码行数:78,代码来源:tparse.cpp


示例2: prepare

    void prepare(svector<iovec>& v, void* ptr, const int sender=-1) {
        struct iovec iov={ptr,size*sizeof(char)};
        v.push_back(iov);
	setCallbackArg(NULL);
    }    
开发者ID:eXistence,项目名称:fastflow,代码行数:5,代码来源:lat11_v2.cpp


示例3: get_op_names

void fpa_decl_plugin::get_op_names(svector<builtin_name> & op_names, symbol const & logic) {
    // These are the operators from the final draft of the SMT FloatingPoint standard
    op_names.push_back(builtin_name("+oo", OP_FPA_PLUS_INF));
    op_names.push_back(builtin_name("-oo", OP_FPA_MINUS_INF));
    op_names.push_back(builtin_name("+zero", OP_FPA_PLUS_ZERO));
    op_names.push_back(builtin_name("-zero", OP_FPA_MINUS_ZERO));
    op_names.push_back(builtin_name("NaN", OP_FPA_NAN));

    op_names.push_back(builtin_name("roundNearestTiesToEven", OP_FPA_RM_NEAREST_TIES_TO_EVEN));
    op_names.push_back(builtin_name("roundNearestTiesToAway", OP_FPA_RM_NEAREST_TIES_TO_AWAY));
    op_names.push_back(builtin_name("roundTowardPositive", OP_FPA_RM_TOWARD_POSITIVE));
    op_names.push_back(builtin_name("roundTowardNegative", OP_FPA_RM_TOWARD_NEGATIVE));
    op_names.push_back(builtin_name("roundTowardZero", OP_FPA_RM_TOWARD_ZERO));

    op_names.push_back(builtin_name("RNE", OP_FPA_RM_NEAREST_TIES_TO_EVEN));
    op_names.push_back(builtin_name("RNA", OP_FPA_RM_NEAREST_TIES_TO_AWAY));
    op_names.push_back(builtin_name("RTP", OP_FPA_RM_TOWARD_POSITIVE));
    op_names.push_back(builtin_name("RTN", OP_FPA_RM_TOWARD_NEGATIVE));
    op_names.push_back(builtin_name("RTZ", OP_FPA_RM_TOWARD_ZERO));

    op_names.push_back(builtin_name("fp.abs", OP_FPA_ABS));
    op_names.push_back(builtin_name("fp.neg", OP_FPA_NEG));
    op_names.push_back(builtin_name("fp.add", OP_FPA_ADD));
    op_names.push_back(builtin_name("fp.sub", OP_FPA_SUB));
    op_names.push_back(builtin_name("fp.mul", OP_FPA_MUL));
    op_names.push_back(builtin_name("fp.div", OP_FPA_DIV));
    op_names.push_back(builtin_name("fp.fma", OP_FPA_FMA));
    op_names.push_back(builtin_name("fp.sqrt", OP_FPA_SQRT));
    op_names.push_back(builtin_name("fp.rem", OP_FPA_REM));
    op_names.push_back(builtin_name("fp.roundToIntegral", OP_FPA_ROUND_TO_INTEGRAL));
    op_names.push_back(builtin_name("fp.min", OP_FPA_MIN));
    op_names.push_back(builtin_name("fp.max", OP_FPA_MAX));
    op_names.push_back(builtin_name("fp.leq", OP_FPA_LE));
    op_names.push_back(builtin_name("fp.lt",  OP_FPA_LT));
    op_names.push_back(builtin_name("fp.geq", OP_FPA_GE));
    op_names.push_back(builtin_name("fp.gt",  OP_FPA_GT));
    op_names.push_back(builtin_name("fp.eq", OP_FPA_EQ));

    op_names.push_back(builtin_name("fp.isNormal", OP_FPA_IS_NORMAL));
    op_names.push_back(builtin_name("fp.isSubnormal", OP_FPA_IS_SUBNORMAL));
    op_names.push_back(builtin_name("fp.isZero", OP_FPA_IS_ZERO));
    op_names.push_back(builtin_name("fp.isInfinite", OP_FPA_IS_INF));
    op_names.push_back(builtin_name("fp.isNaN", OP_FPA_IS_NAN));
    op_names.push_back(builtin_name("fp.isNegative", OP_FPA_IS_NEGATIVE));
    op_names.push_back(builtin_name("fp.isPositive", OP_FPA_IS_POSITIVE));

    op_names.push_back(builtin_name("fp", OP_FPA_FP));
    op_names.push_back(builtin_name("fp.to_ubv", OP_FPA_TO_UBV));
    op_names.push_back(builtin_name("fp.to_sbv", OP_FPA_TO_SBV));
    op_names.push_back(builtin_name("fp.to_real", OP_FPA_TO_REAL));

    op_names.push_back(builtin_name("to_fp", OP_FPA_TO_FP));
    op_names.push_back(builtin_name("to_fp_unsigned", OP_FPA_TO_FP_UNSIGNED));

    /* Extensions */
    op_names.push_back(builtin_name("to_ieee_bv", OP_FPA_TO_IEEE_BV));
    op_names.push_back(builtin_name("fp.to_ieee_bv", OP_FPA_TO_IEEE_BV));
}
开发者ID:NikolajBjorner,项目名称:z3,代码行数:58,代码来源:fpa_decl_plugin.cpp


示例4: get_labels

 virtual void get_labels(svector<symbol> & r) {
     buffer<symbol> tmp;
     ctx().get_relevant_labels(0, tmp);
     r.append(tmp.size(), tmp.c_ptr());            
 }
开发者ID:CharudattaSChitale,项目名称:sygus-comp14,代码行数:5,代码来源:api_parsers.cpp


示例5: ValidNode

BOOL	ValidNode(vertex& N)
{
	// *** Query and cache polygons for ray-casting
	Fvector	PointUp;		PointUp.set(N.Pos);		PointUp.y	+= RCAST_Depth/2;
	Fvector	PointDown;		PointDown.set(N.Pos);	PointDown.y	-= RCAST_Depth/2;

	Fbox	BB;				BB.set	(PointUp,PointUp);		BB.grow(g_params.fPatchSize/2);	// box 1
	Fbox	B2;				B2.set	(PointDown,PointDown);	B2.grow(g_params.fPatchSize/2);	// box 2
	BB.merge(B2			);
	BoxQuery(BB,false	);
	u32	dwCount = XRC.r_count();
	if (dwCount==0)	{
		Log("chasm1");
		return FALSE;			// chasm?
	}

	// *** Transfer triangles and compute sector
	R_ASSERT(dwCount<RCAST_MaxTris);
	static svector<tri,RCAST_MaxTris> tris;		tris.clear();
	for (u32 i=0; i<dwCount; i++)
	{
		tri&		D = tris.last();
		CDB::RESULT&rp = XRC.r_begin()[i];
		*(Level.get_tris()+XRC.r_begin()[i].id);

		D.v[0].set	(rp.verts[0]);
		D.v[1].set	(rp.verts[1]);
		D.v[2].set	(rp.verts[2]);

		Fvector		N;
		N.mknormal	(D.v[0],D.v[1],D.v[2]);
		if (N.y<=0)	continue;

		tris.inc	();
	}
	if (tris.size()==0)	{
		Log("chasm2");
		return FALSE;			// chasm?
	}

	// *** Perform ray-casts and calculate sector
	Fvector P,D,PLP; D.set(0,-1,0);

	float coeff = 0.5f*g_params.fPatchSize/float(RCAST_Count);

	int num_successed_rays = 0;
	for (int x=-RCAST_Count; x<=RCAST_Count; x++) 
	{
		P.x = N.Pos.x + coeff*float(x);
		for (int z=-RCAST_Count; z<=RCAST_Count; z++) {
			P.z = N.Pos.z + coeff*float(z);
			P.y = N.Pos.y;
			N.Plane.intersectRayPoint(P,D,PLP);	// "project" position
			P.y = PLP.y+RCAST_DepthValid/2;

			float	tri_min_range	= flt_max;
			int		tri_selected	= -1;
			float	range = 0.f,u,v;
			for (i=0; i<u32(tris.size()); i++) 
			{
				if (CDB::TestRayTri(P,D,tris[i].v,u,v,range,false)) 
				{
					if (range<tri_min_range) {
						tri_min_range	= range;
						tri_selected	= i;
					}
				}
			}
			if (tri_selected>=0) {
				if (range<RCAST_DepthValid)	num_successed_rays++;

			}
		}
	}
	if (float(num_successed_rays)/float(RCAST_Total) < 0.5f) {
		Msg		("Floating node.");
		return	FALSE;
	}
	return TRUE;
}
开发者ID:2asoft,项目名称:xray,代码行数:80,代码来源:compiler_smooth.cpp


示例6: div

 void div(svector<Numeral> & as, mpz const & g) {
     unsigned n = as.size();
     for (unsigned i = 0; i < n; i++)
         m().div(as[i], g, as[i]);
 }
开发者ID:EinNarr,项目名称:z3,代码行数:5,代码来源:euclidean_solver.cpp


示例7: CreateNode

BOOL	CreateNode(Fvector& vAt, vertex& N)
{
	// *** Query and cache polygons for ray-casting
	Fvector	PointUp;		PointUp.set(vAt);	PointUp.y	+= RCAST_Depth;		SnapXZ	(PointUp);
	Fvector	PointDown;		PointDown.set(vAt);	PointDown.y	-= RCAST_Depth;		SnapXZ	(PointDown);

	Fbox	BB;				BB.set	(PointUp,PointUp);		BB.grow(g_params.fPatchSize/2);	// box 1
	Fbox	B2;				B2.set	(PointDown,PointDown);	B2.grow(g_params.fPatchSize/2);	// box 2
	BB.merge(B2			);
	BoxQuery(BB,false	);
	u32	dwCount = XRC.r_count();
	if (dwCount==0)	{
//		Log("chasm1");
		return FALSE;			// chasm?
	}

	// *** Transfer triangles and compute sector
	R_ASSERT(dwCount<RCAST_MaxTris);
	static svector<tri,RCAST_MaxTris> tris;		tris.clear();
	for (u32 i=0; i<dwCount; i++)
	{
		tri&		D = tris.last();
		CDB::RESULT	&rp = XRC.r_begin()[i];
		CDB::TRI&	T = *(Level.get_tris()+rp.id);

		D.v[0].set	(rp.verts[0]);
		D.v[1].set	(rp.verts[1]);
		D.v[2].set	(rp.verts[2]);
		D.sector	= T.sector;
		D.N.mknormal(D.v[0],D.v[1],D.v[2]);
		if (D.N.y<=0)	continue;

		tris.inc	();
	}
	if (tris.size()==0)	{
//		Log("chasm2");
		return FALSE;			// chasm?
	}

	// *** Perform ray-casts and calculate sector
	WORD Sector = 0xfffe;	// mark as first time

	static svector<Fvector,RCAST_Total>	points;		points.clear();
	static svector<Fvector,RCAST_Total>	normals;	normals.clear();
	Fvector P,D; D.set(0,-1,0);

	float coeff = 0.5f*g_params.fPatchSize/float(RCAST_Count);

	for (int x=-RCAST_Count; x<=RCAST_Count; x++) 
	{
		P.x = vAt.x + coeff*float(x);
		for (int z=-RCAST_Count; z<=RCAST_Count; z++) {
			P.z = vAt.z + coeff*float(z);
			P.y = vAt.y + 10.f;

			float	tri_min_range	= flt_max;
			int		tri_selected	= -1;
			float	range,u,v;
			for (i=0; i<u32(tris.size()); i++) 
			{
				if (CDB::TestRayTri(P,D,tris[i].v,u,v,range,false)) 
				{
					if (range<tri_min_range) {
						tri_min_range	= range;
						tri_selected	= i;
					}
				}
			}
			if (tri_selected>=0) {
				P.y -= tri_min_range;
				points.push_back(P);
				normals.push_back(tris[tri_selected].N);
				WORD TS = WORD(tris[tri_selected].sector);
				if (Sector==0xfffe)	Sector = TS;
				else 				if (Sector!=TS) Sector=InvalidSector;
			}
		}
	}
	if (points.size()<3) {
//		Msg		("Failed to create node at [%f,%f,%f].",vAt.x,vAt.y,vAt.z);
		return	FALSE;
	}
	if (float(points.size())/float(RCAST_Total) < 0.7f) {
//		Msg		("Partial chasm at [%f,%f,%f].",vAt.x,vAt.y,vAt.z);
		return	FALSE;
	}

	// *** Calc normal
	Fvector vNorm;
	vNorm.set(0,0,0);
	for (u32 n=0; n<normals.size(); n++)
		vNorm.add(normals[n]);
	vNorm.div(float(normals.size()));
	vNorm.normalize();
	/*
	{
		// second algorithm (Magic)
		Fvector N,O;
		N.set(vNorm);
		O.set(points[0]);
//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:xray,代码行数:101,代码来源:compiler_build.cpp


示例8: get_op_names

void float_decl_plugin::get_op_names(svector<builtin_name> & op_names, symbol const & logic) {
    op_names.push_back(builtin_name("plusInfinity",  OP_FLOAT_PLUS_INF));
    op_names.push_back(builtin_name("minusInfinity", OP_FLOAT_MINUS_INF));
    op_names.push_back(builtin_name("NaN", OP_FLOAT_NAN));
    op_names.push_back(builtin_name("roundNearestTiesToEven", OP_RM_NEAREST_TIES_TO_EVEN));
    op_names.push_back(builtin_name("roundNearestTiesToAway", OP_RM_NEAREST_TIES_TO_AWAY));
    op_names.push_back(builtin_name("roundTowardPositive", OP_RM_TOWARD_POSITIVE));
    op_names.push_back(builtin_name("roundTowardNegative", OP_RM_TOWARD_NEGATIVE));
    op_names.push_back(builtin_name("roundTowardZero", OP_RM_TOWARD_ZERO));
    
    op_names.push_back(builtin_name("+", OP_FLOAT_ADD)); 
    op_names.push_back(builtin_name("-", OP_FLOAT_SUB)); 
    op_names.push_back(builtin_name("/", OP_FLOAT_DIV)); 
    op_names.push_back(builtin_name("*", OP_FLOAT_MUL)); 

    op_names.push_back(builtin_name("abs", OP_FLOAT_ABS)); 
    op_names.push_back(builtin_name("remainder", OP_FLOAT_REM));  
    op_names.push_back(builtin_name("fusedMA", OP_FLOAT_FUSED_MA));  
    op_names.push_back(builtin_name("squareRoot", OP_FLOAT_SQRT));  
    op_names.push_back(builtin_name("roundToIntegral", OP_FLOAT_ROUND_TO_INTEGRAL));  
    
    op_names.push_back(builtin_name("==", OP_FLOAT_EQ));
    
    op_names.push_back(builtin_name("<",  OP_FLOAT_LT));
    op_names.push_back(builtin_name(">",  OP_FLOAT_GT));
    op_names.push_back(builtin_name("<=", OP_FLOAT_LE));
    op_names.push_back(builtin_name(">=", OP_FLOAT_GE));

    op_names.push_back(builtin_name("isZero", OP_FLOAT_IS_ZERO));
    op_names.push_back(builtin_name("isNZero", OP_FLOAT_IS_NZERO));
    op_names.push_back(builtin_name("isPZero", OP_FLOAT_IS_PZERO));
    op_names.push_back(builtin_name("isSignMinus", OP_FLOAT_IS_SIGN_MINUS));

    op_names.push_back(builtin_name("min", OP_FLOAT_MIN));
    op_names.push_back(builtin_name("max", OP_FLOAT_MAX));

    op_names.push_back(builtin_name("asFloat", OP_TO_FLOAT));    
}
开发者ID:CharudattaSChitale,项目名称:sygus-comp14,代码行数:38,代码来源:float_decl_plugin.cpp


示例9: is_sorted

static void is_sorted(svector<unsigned> const& v) {
    for (unsigned i = 0; i + 1 < v.size(); ++i) {
        SASSERT(v[i] <= v[i+1]);
    }
}
开发者ID:EinNarr,项目名称:z3,代码行数:5,代码来源:sorting_network.cpp


示例10: get_sort_names

void float_decl_plugin::get_sort_names(svector<builtin_name> & sort_names, symbol const & logic) {
    sort_names.push_back(builtin_name("FP", FLOAT_SORT));
    sort_names.push_back(builtin_name("RoundingMode", ROUNDING_MODE_SORT));
}
开发者ID:CharudattaSChitale,项目名称:sygus-comp14,代码行数:4,代码来源:float_decl_plugin.cpp


示例11: and_vec

 static Z3_ast and_vec(Z3_context ctx,svector<Z3_ast> &c) {
     return (c.size() > 1) ? Z3_mk_and(ctx,c.size(),&c[0]) : c[0];
 }
开发者ID:kayceesrk,项目名称:Z3,代码行数:3,代码来源:api_interp.cpp


示例12: get_labels

 virtual void get_labels(svector<symbol> & r) {
     SASSERT(m_context);
     buffer<symbol> tmp;
     m_context->get_relevant_labels(0, tmp);
     r.append(tmp.size(), tmp.c_ptr());
 }
开发者ID:Moondee,项目名称:Artemis,代码行数:6,代码来源:solver.cpp


示例13: operator

 virtual void operator()(model_ref & mdl, unsigned goal_idx) {
     SASSERT(goal_idx == 0);
     for (unsigned i = 0; i < m_const.size(); ++i) {
         mdl->register_decl(m_const[i].first->get_decl(), m_const[i].second);
     }
 }
开发者ID:AleksandarZeljic,项目名称:z3,代码行数:6,代码来源:pb_preprocess_tactic.cpp


示例14: size

 unsigned size() const {
     return m_names.size();
 }
开发者ID:greatmazinger,项目名称:z3,代码行数:3,代码来源:params.cpp


示例15: prepare

 void prepare(cmd_context & ctx) override { m_cmds.reset(); }
开发者ID:NikolajBjorner,项目名称:z3,代码行数:1,代码来源:basic_cmds.cpp


示例16: resize_data

 void resize_data(unsigned sz) {
     m_data_size = sz;
     m_data.resize(m_data_size+1);
     m_data[m_data_size] = s_delimiter;
 }
开发者ID:EinNarr,项目名称:z3,代码行数:5,代码来源:datalog_parser.cpp


示例17: prepare

 virtual void prepare(cmd_context & ctx) { m_cmds.reset(); }
开发者ID:CharudattaSChitale,项目名称:sygus-comp14,代码行数:1,代码来源:basic_cmds.cpp


示例18: empty

 bool empty() const { return m_entries.empty(); }
开发者ID:greatmazinger,项目名称:z3,代码行数:1,代码来源:params.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ symbol类代码示例发布时间:2022-05-31
下一篇:
C++ surfaceScalarField类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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