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

C++ def函数代码示例

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

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



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

示例1: MessageFormat

void TestMessageFormat::sample() 
{
    MessageFormat *form = 0;
    UnicodeString buffer1, buffer2;
    UErrorCode success = U_ZERO_ERROR;
    form = new MessageFormat("There are {0} files on {1}", success);
    if (U_FAILURE(success)) {
        errln("Err: Message format creation failed");
        logln("Sample message format creation failed.");
        return;
    }
    UnicodeString abc("abc");
    UnicodeString def("def");
    Formattable testArgs1[] = { abc, def };
    FieldPosition fieldpos(0);
    assertEquals("format",
                 "There are abc files on def",
                 form->format(testArgs1, 2, buffer2, fieldpos, success));
    assertSuccess("format", success);
    delete form;
}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:21,代码来源:tmsgfmt.cpp


示例2: def

void
ZeroLengthSection::computeSectionDefs(void)
{
	// Get nodal displacements
	const Vector &u1 = theNodes[0]->getTrialDisp();
	const Vector &u2 = theNodes[1]->getTrialDisp();

	// Compute differential displacements
	const Vector diff = u2 - u1;

	// Set some references to make the syntax nicer
	Vector &def = *v;
	const Matrix &tran = *A;

	def.Zero();

	// Compute element basic deformations ... v = A*(u2-u1)
	for (int i = 0; i < order; i++)
		for (int j = 0; j < numDOF/2; j++)
			def(i) += -diff(j)*tran(i,j);
}
开发者ID:lge88,项目名称:OpenSees,代码行数:21,代码来源:ZeroLengthSection.cpp


示例3: init_openravepy_spacesampler

void init_openravepy_spacesampler()
{
    {
        scope spacesampler = class_<PySpaceSamplerBase, boost::shared_ptr<PySpaceSamplerBase>, bases<PyInterfaceBase> >("SpaceSampler", DOXY_CLASS(SpaceSamplerBase), no_init)
                             .def("SetSeed",&PySpaceSamplerBase::SetSeed, args("seed"), DOXY_FN(SpaceSamplerBase,SetSeed))
                             .def("SetSpaceDOF",&PySpaceSamplerBase::SetSpaceDOF, args("dof"), DOXY_FN(SpaceSamplerBase,SetSpaceDOF))
                             .def("GetDOF",&PySpaceSamplerBase::GetDOF, DOXY_FN(SpaceSamplerBase,GetDOF))
                             .def("GetNumberOfValues",&PySpaceSamplerBase::GetNumberOfValues, args("seed"), DOXY_FN(SpaceSamplerBase,GetNumberOfValues))
                             .def("Supports",&PySpaceSamplerBase::Supports, args("seed"), DOXY_FN(SpaceSamplerBase,Supports))
                             .def("GetLimits",&PySpaceSamplerBase::GetLimits, args("seed"), DOXY_FN(SpaceSamplerBase,GetLimits))
                             .def("SampleSequence",&PySpaceSamplerBase::SampleSequence, SampleSequence_overloads(args("type", "num","interval"), DOXY_FN(SpaceSamplerBase,SampleSequence "std::vector; size_t; IntervalType")))
                             .def("SampleSequence2D",&PySpaceSamplerBase::SampleSequence2D, SampleSequence2D_overloads(args("type", "num","interval"), DOXY_FN(SpaceSamplerBase,SampleSequence "std::vector; size_t; IntervalType")))
                             .def("SampleSequenceOneReal", &PySpaceSamplerBase::SampleSequenceOneReal, SampleSequenceOneReal_overloads(args("interval"), DOXY_FN(SpaceSamplerBase,SampleSequenceOneReal)))
                             .def("SampleSequenceOneUInt32", &PySpaceSamplerBase::SampleSequenceOneUInt32, DOXY_FN(SpaceSamplerBase,SampleSequenceOneUInt32))
                             .def("SampleComplete",&PySpaceSamplerBase::SampleComplete, SampleComplete_overloads(args("type", "num","interval"), DOXY_FN(SpaceSamplerBase,SampleComplete "std::vector; size_t; IntervalType")))
                             .def("SampleComplete2D",&PySpaceSamplerBase::SampleComplete2D, SampleComplete2D_overloads(args("type", "num","interval"), DOXY_FN(SpaceSamplerBase,SampleComplete "std::vector; size_t; IntervalType")))
        ;
    }

    def("RaveCreateSpaceSampler",openravepy::RaveCreateSpaceSampler,args("env","name"),DOXY_FN1(RaveCreateSpaceSampler));
}
开发者ID:ajshort,项目名称:openrave,代码行数:21,代码来源:openravepy_spacesampler.cpp


示例4: def

Def* IdentityAnalyzer::coerceIdentity(UnaryStmt* instr, const Type* to_type) {
  Def* value_in = def(instr->value_in());
  if (subtypeof(type(value_in), to_type))
    return identity(instr, value_in);
  return def_;
}
开发者ID:ajwfrost,项目名称:avmplus,代码行数:6,代码来源:hm-identityanalyzer.cpp


示例5: LOG

std::shared_ptr<Font> Font::get(ResourceManager& rm, const std::string& path, int size)
{
	if(path.empty())
	{
		LOG(LogError) << "Tried to get font with no path!";
		return std::shared_ptr<Font>();
	}

	std::pair<std::string, int> def(path, size);
	auto foundFont = sFontMap.find(def);
	if(foundFont != sFontMap.end())
	{
		if(!foundFont->second.expired())
			return foundFont->second.lock();
	}

	std::shared_ptr<Font> font = std::shared_ptr<Font>(new Font(rm, path, size));
	sFontMap[def] = std::weak_ptr<Font>(font);
	rm.addReloadable(font);
	return font;
}
开发者ID:BernardWrangle,项目名称:EmulationStation,代码行数:21,代码来源:Font.cpp


示例6: s

//---------------------------------------------------------------------------
int XsltPolicy::create_policy_from_mi(const std::string& report)
{
    Xslt s(no_https);
    xmlSetGenericErrorFunc(&s, &s.manage_generic_error);

    xmlDocPtr doc = xmlParseMemory(report.c_str(), report.length());
    xmlSetGenericErrorFunc(NULL, NULL);

    if (!doc)
    {
        // maybe put the errors from s.errors
        error = "The MediaInfo report given cannot be parsed";
        return -1;
    }

    xmlNodePtr root = xmlDocGetRootElement(doc);
    if (!root)
    {
        error = "No root node, leaving";
        xmlFreeDoc(doc);
        return 0;
    }

    for (xmlNodePtr child = root->children; child; child = child->next)
    {
        std::string def("media");
        if (child->type == XML_TEXT_NODE || !child->name || def.compare((const char*)child->name))
            continue;

        if (find_media_track_node(child) < 0)
        {
            xmlFreeDoc(doc);
            return -1;
        }
        break;
    }

    xmlFreeDoc(doc);
    return 0;
}
开发者ID:tribouille,项目名称:MediaConch_SourceCode,代码行数:41,代码来源:XsltPolicy.cpp


示例7: show_dialog

/**
 * Displays a window.
 * - Arg 1: WML table describing the window.
 * - Arg 2: function called at pre-show.
 * - Arg 3: function called at post-show.
 * - Ret 1: integer.
 */
int show_dialog(lua_State *L, CVideo & video)
{
	config def_cfg = luaW_checkconfig(L, 1);

	gui2::twindow_builder::tresolution def(def_cfg);
	scoped_dialog w(L, gui2::build(video, &def));

	if (!lua_isnoneornil(L, 2)) {
		lua_pushvalue(L, 2);
		lua_call(L, 0, 0);
	}

	int v = scoped_dialog::current->window->show(true, 0);

	if (!lua_isnoneornil(L, 3)) {
		lua_pushvalue(L, 3);
		lua_call(L, 0, 0);
	}

	lua_pushinteger(L, v);
	return 1;
}
开发者ID:alalazo,项目名称:wesnoth,代码行数:29,代码来源:lua_gui2.cpp


示例8: dee

void dee(int x)
{
    node *p,*q;
    if (head->data==x) def();
    else
    {
        q=head;
        p=q->next;
        while ((p->data!=x) && (p!=tail))
        {
            q=p;
            p=p->next;
        }
        if (p!=tail)
        {
            q->next=p->next;
            free(p);
        }
        else if (tail->data==x){q->next=NULL;
        free(tail);}
    }
}
开发者ID:Alecs94,项目名称:DSA-lab,代码行数:22,代码来源:main.c


示例9: main

int main()
{
    int x;
    char s[20];
    FILE *g;
    g=fopen("input.dat","r");
    while (fscanf(g,"%s",&s)==1)
    {


        if (strcmp("AF",s)==0)
        {
            fscanf(g,"%d",&x);
            adf(x);
        }
        else if (strcmp("AL",s)==0)
        {
            fscanf(g,"%d",&x);
            adl(x);
        }
        else if (strcmp("DF",s)==0) def();
        else if (strcmp("DL",s)==0) del();
        else if (strcmp("DE",s)==0) {fscanf(g,"%d",&x); dee(x);}
        else if (strcmp("PRINT_ALL",s)==0) print_alll();
        else if (strcmp("PRINT_F",s)==0)
        {
            fscanf(g,"%d",&x);
            print_fi(x);
        }
        else if (strcmp("PRINT_L",s)==0)
        {
            fscanf(g,"%d",&x);
            print_la(x);
        }
        else if (strcmp("DOOM_THE_LIST",s)==0) doom_the_listt();
    }

return 0;
}
开发者ID:Alecs94,项目名称:DSA-lab,代码行数:39,代码来源:main.c


示例10: log

    //---------------------------------------------------------------------
    bool
    PFile::isPolygonDefinitionListValid( void )
    {
        Ogre::Log::Stream log( Ogre::LogManager::getSingleton().stream() );

        size_t vertex_count( m_vertices.size() )
              ,normal_count( m_normals.size() )
              ,edge_count  ( m_edges.size() );
        for( size_t p( m_polygon_definitions.size() ); p--; )
        {
            PolygonDefinition& def( m_polygon_definitions[p] );
            for( int i(3); i--; )
            {
                if( def.vertex[i] >= vertex_count )
                {
                    log << "Error: index to vertex is out of Bounds "
                        << " m_polygon_definitions[" << p << "]"
                        << ".vertex[" << i << "]: " << def.vertex[i];
                    return false;
                }
                if( def.normal[i] >= normal_count )
                {
                    log << "Error: index to normal is out of Bounds "
                        << " m_polygon_definitions[" << p << "]"
                        << ".normal[" << i << "]: " << def.normal[i];
                    return false;
                }
                if( def.edge[i] >= edge_count )
                {
                    log << "Error: index to edge is out of Bounds "
                        << " m_polygon_definitions[" << p << "]"
                        << ".edge[" << i << "]: " << def.edge[i];
                    return false;
                }
            }
        }

        return true;
    }
开发者ID:adrielvel,项目名称:q-gears,代码行数:40,代码来源:QGearsPFile.cpp


示例11: AddOneTwoInt

void AddOneTwoInt() {

  class_<ERIMethod>("ERI_method", init<>())
    .def("use_symmetry",&ERIMethod::set_symmetry,
	 return_self<>())
    .def("coef_R_memo", &ERIMethod::set_coef_R_memo,
	 return_self<>());

  def("calc_mat_complex", CalcMat_Complex);
  def("calc_mat_hermite", CalcMat_Hermite);
  def("calc_mat", CalcMat);
  
  def("calc_ERI_complex", CalcERI_Complex);
  def("calc_ERI_hermite", CalcERI_Hermite);
  def("calc_ERI", CalcERI);

}
开发者ID:ReiMatsuzaki,项目名称:l2func,代码行数:17,代码来源:symmolint_bind.cpp


示例12: init_openravepy_physicsengine

void init_openravepy_physicsengine()
{
    class_<PyPhysicsEngineBase, boost::shared_ptr<PyPhysicsEngineBase>, bases<PyInterfaceBase> >("PhysicsEngine", DOXY_CLASS(PhysicsEngineBase), no_init)
    .def("GetPhysicsOptions",&PyPhysicsEngineBase::GetPhysicsOptions, DOXY_FN(PhysicsEngineBase,GetPhysicsOptions))
    .def("SetPhysicsOptions",&PyPhysicsEngineBase::SetPhysicsOptions, DOXY_FN(PhysicsEngineBase,SetPhysicsOptions "int"))
    .def("InitEnvironment",&PyPhysicsEngineBase::InitEnvironment, DOXY_FN(PhysicsEngineBase,InitEnvironment))
    .def("DestroyEnvironment",&PyPhysicsEngineBase::DestroyEnvironment, DOXY_FN(PhysicsEngineBase,DestroyEnvironment))
    .def("InitKinBody",&PyPhysicsEngineBase::InitKinBody, DOXY_FN(PhysicsEngineBase,InitKinBody))
    .def("SetLinkVelocity",&PyPhysicsEngineBase::SetLinkVelocity, args("link","velocity"), DOXY_FN(PhysicsEngineBase,SetLinkVelocity))
    .def("SetLinkVelocities",&PyPhysicsEngineBase::SetLinkVelocity, args("body","velocities"), DOXY_FN(PhysicsEngineBase,SetLinkVelocities))
    .def("GetLinkVelocity",&PyPhysicsEngineBase::GetLinkVelocity, DOXY_FN(PhysicsEngineBase,GetLinkVelocity))
    .def("GetLinkVelocities",&PyPhysicsEngineBase::GetLinkVelocity, DOXY_FN(PhysicsEngineBase,GetLinkVelocities))
    .def("SetBodyForce",&PyPhysicsEngineBase::SetBodyForce, DOXY_FN(PhysicsEngineBase,SetBodyForce))
    .def("SetBodyTorque",&PyPhysicsEngineBase::SetBodyTorque, DOXY_FN(PhysicsEngineBase,SetBodyTorque))
    .def("AddJointTorque",&PyPhysicsEngineBase::AddJointTorque, DOXY_FN(PhysicsEngineBase,AddJointTorque))
    .def("GetLinkForceTorque",&PyPhysicsEngineBase::GetLinkForceTorque, DOXY_FN(PhysicsEngineBase,GetLinkForceTorque))
    .def("SetGravity",&PyPhysicsEngineBase::SetGravity, DOXY_FN(PhysicsEngineBase,SetGravity))
    .def("GetGravity",&PyPhysicsEngineBase::GetGravity, DOXY_FN(PhysicsEngineBase,GetGravity))
    .def("SimulateStep",&PyPhysicsEngineBase::SimulateStep, DOXY_FN(PhysicsEngineBase,SimulateStep))
    ;

    def("RaveCreatePhysicsEngine",openravepy::RaveCreatePhysicsEngine,args("env","name"),DOXY_FN1(RaveCreatePhysicsEngine));
}
开发者ID:GaussCheng,项目名称:openrave,代码行数:23,代码来源:openravepy_physicsengine.cpp


示例13: main

int main(void)
{
    IndexBufferSet *ibs = new IndexBufferSet();
    TermBufferSet tbset;

    TermBuffer t1("a");
    TermBuffer t2("b");
    TermBuffer t3("c");

    tbset.insert(t1);
    tbset.insert(t2);
    tbset.insert(t3);

    std::string def("default");
    ibs->merge(def, tbset);

    TBIterator itr = tbset.find(t2);
    if (itr == tbset.end()) {
        std::cerr << "error" << std::endl;
    }

    return 0;
}
开发者ID:feeblefakie,项目名称:misc,代码行数:23,代码来源:test2.cpp


示例14: TRC_ERROR

bool AlarmTableDefs::populate_map(std::string path,
                                  std::map<unsigned int, unsigned int>& dup_check)
{
  std::string error;
  std::vector<AlarmDef::AlarmDefinition> alarm_definitions;
  bool rc = JSONAlarms::validate_alarms_from_json(path, error, alarm_definitions);

  if (!rc)
  {
    TRC_ERROR("%s", error.c_str());
    return rc;
  }

  std::vector<AlarmDef::AlarmDefinition>::const_iterator a_it;
  for (a_it = alarm_definitions.begin(); a_it != alarm_definitions.end(); a_it++)
  {
    if (dup_check.count(a_it->_index))
    {
      TRC_ERROR("alarm %d.*: is multiply defined", a_it->_index);
      rc = false;
      break;
    }
    else
    {
      dup_check[a_it->_index] = 1;
    }

    std::vector<AlarmDef::SeverityDetails>::const_iterator s_it;

    for (s_it = a_it->_severity_details.begin(); s_it != a_it->_severity_details.end(); s_it++)
    {
      AlarmTableDef def(*a_it, *s_it);
      AlarmTableDefs::insert_def(def);
    }
  }
  return rc;
}
开发者ID:Metaswitch,项目名称:clearwater-snmp-handlers,代码行数:37,代码来源:alarm_table_defs.cpp


示例15: main

int main(int argc, const char *argv[])
{
	FILE *source, *dest;
	const char *source_filename;
	char *dest_filename;

	if (argc != 2) {
		fprintf(stderr, "usage: ./zpipe filename\n");
		exit(EXIT_FAILURE);
	}

	source_filename = argv[1];

	dest_filename = malloc(strlen(source_filename) + 5 + 1);
	strcat(dest_filename, source_filename);
	strcat(dest_filename, ".zlib");

	source = fopen(SOURCE, "rb");
	if (source == NULL) {
		fprintf(stderr, "Can't open file %s", source_filename);
		exit(EXIT_FAILURE);
	}
	dest = fopen(dest_filename, "wb");
	if (dest == NULL) {
		fprintf(stderr, "Can't open file %s", dest_filename);
		fclose(source);
		exit(EXIT_FAILURE);
	}

	def(source , dest, Z_DEFAULT_COMPRESSION);

	fclose(source);
	fclose(dest);

	return 0;
}
开发者ID:YogaPan,项目名称:linux-basic,代码行数:36,代码来源:zpipe.c


示例16: LOG

Status ViewCatalog::_reloadIfNeeded_inlock(OperationContext* txn) {
    if (_valid.load())
        return Status::OK();

    LOG(1) << "reloading view catalog for database " << _durable->getName();

    // Need to reload, first clear our cache.
    _viewMap.clear();

    Status status = _durable->iterate(txn, [&](const BSONObj& view) {
        NamespaceString viewName(view["_id"].str());
        ViewDefinition def(
            viewName.db(), viewName.coll(), view["viewOn"].str(), view["pipeline"].Obj());
        _viewMap[viewName.ns()] = std::make_shared<ViewDefinition>(def);
    });
    _valid.store(status.isOK());

    if (!status.isOK()) {
        LOG(0) << "could not load view catalog for database " << _durable->getName() << ": "
               << status;
    }

    return status;
}
开发者ID:mikety,项目名称:mongo,代码行数:24,代码来源:view_catalog.cpp


示例17: TS_fileRead

v8Function TS_fileRead(V8ARGS)
{
    if(args.Length()<2){
        THROWERROR("[scriptfs] TS_fileRead Error: Called with fewer than 2 arguments!\n");
    }
    CHECK_ARG_STR(0);
	CHECK_ARG_STR(1);
    v8::String::AsciiValue key(args[0]);
    v8::String::AsciiValue def(args[1]);
	v8::Local<v8::Object> self = args.Holder();
	v8::Local<v8::External> wrap = v8::Local<v8::External>::Cast(self->GetInternalField(0));
	void* ptr = wrap->Value();
	const char * keyval = static_cast<T5_file*>(ptr)->getValue(*key);
	if(keyval==NULL){
        static_cast<T5_file*>(ptr)->writeValue(*key, *def);
        return v8::String::New(*def);
	}
	if(args[1]->IsNumber()){
		return v8::Number::New(atof(keyval));
	}
	else{
		return v8::String::New(keyval);
	}
}
开发者ID:carriercomm,项目名称:TurboSphere,代码行数:24,代码来源:scriptfs.cpp


示例18: void

void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Operation op), Operation op) {
  def(code, flags, in, out, (Template::generator)gen, (int)op);
}
开发者ID:ismo1652,项目名称:jvmnotebook,代码行数:3,代码来源:templateTable.cpp


示例19: WriteSave

void WriteSave(const char *fn, SAVESTATE_t* save, int compress) {
	int i;
	FILE* ofile;
	FILE* cfile;
	char temp_save[PATH_MAX];
	
	if (!save) {
		return;
	}
	if (compress == 0) {
		ofile = fopen(fn, "wb");
	} else {
		GetAppDataString(temp_save, PATH_MAX - 1 - strlen(tmpSuffix));
		strcat(temp_save, tmpSuffix);
		mkstemp(temp_save);
		ofile = fopen(temp_save,"wb");
	}
		
	if (!ofile) {
		return;
	}

	fputs(DETECT_STR, ofile);

	fputi(SAVE_HEADERSIZE, ofile);	
	
	fputi(save->version_major, ofile);
	fputi(save->version_minor, ofile);
	fputi(save->version_build, ofile);
	fputi(save->model, ofile);
	fputi(save->chunk_count, ofile);
	fwrite(save->author, 1,32, ofile);
	fwrite(save->comment, 1, 64, ofile);
	
	for(i = 0; i < save->chunk_count; i++) {
		fputc(save->chunks[i]->tag[0], ofile);
		fputc(save->chunks[i]->tag[1], ofile);
		fputc(save->chunks[i]->tag[2], ofile);
		fputc(save->chunks[i]->tag[3], ofile);
		fputi(save->chunks[i]->size,ofile);
		fwrite(save->chunks[i]->data, 1, save->chunks[i]->size, ofile);
	}
	fclose(ofile);
	
	if (compress) {
		cfile = fopen(fn, "wb");
		if (!cfile) {
			return;
		}
		ofile = fopen(temp_save,"rb");
		if (!ofile) {
			return;
		}
		//int error;
		fputs(DETECT_CMP_STR, cfile);
		switch(compress) {
#ifdef ZLIB_WINAPI
			case ZLIB_CMP:
				{
					fputc(ZLIB_CMP, cfile);
				
					int error = def(ofile, cfile, 9);
					break;
				}
#endif
			default:
				break;
		}
		fclose(ofile);
		fclose(cfile);
		remove(temp_save);
	}
}
开发者ID:elfprince13,项目名称:cli-wabbitemu,代码行数:73,代码来源:savestate.cpp


示例20: identity

/// Analyze lexical lookup instructions HR_findprop and HR_findpropstrict.
///
Def* IdentityAnalyzer::doFindStmt(NaryStmt3* instr) {
  int index;
  if (findScope(lattice_, instr, &index) == kScopeLocal)
    return identity(instr, def(instr->vararg(index)));
  return def_;
}
开发者ID:ajwfrost,项目名称:avmplus,代码行数:8,代码来源:hm-identityanalyzer.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ defFree函数代码示例发布时间:2022-05-30
下一篇:
C++ deepCopy函数代码示例发布时间: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