当前位置: 首页>>代码示例>>C++>>正文


C++ OutBuffer::write方法代码示例

本文整理汇总了C++中OutBuffer::write方法的典型用法代码示例。如果您正苦于以下问题:C++ OutBuffer::write方法的具体用法?C++ OutBuffer::write怎么用?C++ OutBuffer::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OutBuffer的用法示例。


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

示例1: beforeSendATParticles

    /* send global tuple information */
    void FixedTupleListAdress::beforeSendParticles
                                    (ParticleList& pl, OutBuffer& buf) {

        std::vector<longint> atpl;

        // loop over the particle list
        for (ParticleList::Iterator pit(pl); pit.isValid(); ++pit) {
            longint pidK = pit->id();
            LOG4ESPP_DEBUG(theLogger, "send particle with pid " << pidK << ", find tuples");

            // find particle that involves this particle id
            GlobalTuples::const_iterator it = globalTuples.find(pidK);
            if (it != globalTuples.end()) {

                // first write the pid of the first particle
                //toSend.push_back(pidK);
                //std::cout << "write pidK "<< pidK << "\n";
            	buf.write(pidK);

				// write the size of the vector
				int s = it->second.size();
				//toSend.push_back(s);
				//std::cout << "write s "<< s << "\n";
				buf.write(s);
				atpl.reserve(s);

				// iterate through vector and add pids
				//std::cout << storage->getRank() << ": removing AT particles ";
				for (tuple::const_iterator it2 = it->second.begin();
				 it2 != it->second.end(); ++it2) {
					//toSend.push_back(*it2);
					//std::cout << " write pid "<< *it2 << " (";

					Particle* tp = storage->lookupAdrATParticle(*it2);
					//std::cout << " write " << tp->getId() << " ("  << tp->getPos() << ")\n";
					buf.write(*tp);
					atpl.push_back(*it2);

					// remove AT particle from storage
					storage->removeAdrATParticle(*it2);
					//std::cout << " " << *it2;
				}
				//std::cout << "\n";

                // delete this pid from the global list
                globalTuples.erase(pidK);

            }
        }

        beforeSendATParticles(atpl, buf);
    }
开发者ID:BackupTheBerlios,项目名称:espressopp,代码行数:53,代码来源:FixedTupleListAdress.cpp

示例2: beforeResort

void beforeResort(ParticleList &pl, OutBuffer& out) {
  if (pl.size() == 1) {
    beforeResortCalled = true;
    int res = 42;
    out.write(res);
  }
}
开发者ID:Clemson-MSE,项目名称:espressopp,代码行数:7,代码来源:PTestDomainDecomposition.cpp

示例3: beforeSendParticles

  void FixedSingleList::beforeSendParticles(ParticleList& pl, OutBuffer& buf) {
	std::vector< longint > toSend(pl.size());
    // loop over the particle list
    for (ParticleList::Iterator pit(pl); pit.isValid(); ++pit) {
      longint pid = pit->id();
      toSend.push_back(pid);
      globalSingles.erase(pid);
      LOG4ESPP_DEBUG(theLogger, "erase and send particle with pid from FixedSingleList" << pid);
    }
    // send the list
    buf.write(toSend);
    LOG4ESPP_INFO(theLogger, "prepared fixed single list before send particles");
  }
开发者ID:Clemson-MSE,项目名称:espressopp,代码行数:13,代码来源:FixedSingleList.cpp

示例4:

    void FixedListComm::beforeSendParticles
                                    (ParticleList& pl, OutBuffer& buf) {

        std::vector<longint> toSend;

        // loop over the particle list
        for (ParticleList::Iterator pit(pl); pit.isValid(); ++pit) {
            longint pid = pit->id();
            LOG4ESPP_DEBUG(theLogger, "send particle with pid " << pid << ", find pairs");

            // find all particles that involve this particle id
            int n = globalLists.count(pid);
            if (n > 0) {
                std::pair<GlobalList::const_iterator,
                 GlobalList::const_iterator>
                equalRange = globalLists.equal_range(pid);

                // get the length of the vector in the map
                int l = equalRange.first->second.size();
                toSend.reserve(toSend.size()+3+n*l);
                // first write the pid of the first particle
                toSend.push_back(pid);
                // then the number of partners
                toSend.push_back(n);
                // then the size of the vector
                toSend.push_back(l);
                // and then the pids of the partners
                for (GlobalList::const_iterator it = equalRange.first;
                it != equalRange.second; ++it) {
                    // iterate through vector to add pids
                    for (pvec::const_iterator it2=it->second.begin();
                    it2!=it->second.end(); ++it2) {
                        toSend.push_back(*it2);
                        LOG4ESPP_DEBUG(theLogger, "send global bond: pid "
                               << pid << " and its vector");
                    }
                }

                // delete all of these pairs from the global list
                globalLists.erase(equalRange.first, equalRange.second);
            }
        }
        // send the list
        buf.write(toSend);
        LOG4ESPP_INFO(theLogger, "prepared fixed pair list before send particles");
    }
开发者ID:Clemson-MSE,项目名称:espressopp,代码行数:46,代码来源:FixedListComm.cpp

示例5: assert

        /**
         * Creates the data symbol for a TLS variable for Mach-O.
         *
         * Input:
         *      vd  the variable declaration for the symbol
         *      s   the regular symbol for the variable
         *
         * Returns: the newly create symbol
         */
        Symbol *createTLVDataSymbol(VarDeclaration *vd, Symbol *s)
        {
            assert(config.objfmt == OBJ_MACH && I64 && (s->ty() & mTYLINK) == mTYthread);

            OutBuffer buffer;
            buffer.writestring(s->Sident);
            buffer.write("$tlv$init", 9);

            const char *tlvInitName = buffer.extractString();
            Symbol *tlvInit = symbol_name(tlvInitName, SCstatic, type_fake(vd->type->ty));
            tlvInit->Sdt = NULL;
            tlvInit->Salignment = type_alignsize(s->Stype);

            type_setty(&tlvInit->Stype, tlvInit->Stype->Tty | mTYthreadData);
            type_setmangle(&tlvInit->Stype, mangle(vd, tlvInit));

            return tlvInit;
        }
开发者ID:bitwise-github,项目名称:dmd,代码行数:27,代码来源:toobj.c

示例6: beforeSendATParticles

  void FixedTripleListAdress::beforeSendATParticles(std::vector<longint>& atpl,
          OutBuffer& buf) {

        //std::cout << "beforeSendATParticles() fixed pl (size " << atpl.size() << ")\n";

        std::vector< longint > toSend;

        // loop over the VP particle list
        for (std::vector<longint>::iterator it = atpl.begin();
                it != atpl.end(); ++it) {
          longint pid = *it;

          LOG4ESPP_DEBUG(theLogger, "send particle with pid " << pid << ", find pairs");

          // find all triples that involve this particle
          int n = globalTriples.count(pid);

          if (n > 0) {
            std::pair<GlobalTriples::const_iterator,
            GlobalTriples::const_iterator> equalRange
                = globalTriples.equal_range(pid);

            // first write the pid of this particle
            // then the number of partners (n)
            // and then the pids of the partners
            toSend.reserve(toSend.size()+2*n+1);
            toSend.push_back(pid);
            toSend.push_back(n);
            for (GlobalTriples::const_iterator it = equalRange.first;
                    it != equalRange.second; ++it) {
                toSend.push_back(it->second.first);
                toSend.push_back(it->second.second);
            }

            // delete all of these triples from the global list
            globalTriples.erase(equalRange.first, equalRange.second);
          }
        }

        // send the list
        buf.write(toSend);
        LOG4ESPP_INFO(theLogger, "prepared fixed triple list before send particles");
  }
开发者ID:niktre,项目名称:espressopp,代码行数:43,代码来源:FixedTripleListAdress.cpp

示例7: assert

        /**
         * Creates the data symbol used to initialize a TLS variable for Mach-O.
         *
         * Params:
         *      vd = the variable declaration for the symbol
         *      s = the back end symbol corresponding to vd
         *
         * Returns: the newly created symbol
         */
        Symbol *createTLVDataSymbol(VarDeclaration *vd, Symbol *s)
        {
            assert(config.objfmt == OBJ_MACH && I64 && (s->ty() & mTYLINK) == mTYthread);

            // Compute identifier for tlv symbol
            OutBuffer buffer;
            buffer.writestring(s->Sident);
            buffer.write("$tlv$init", 9);
            const char *tlvInitName = buffer.peekString();

            // Compute type for tlv symbol
            type *t = type_fake(vd->type->ty);
            type_setty(&t, t->Tty | mTYthreadData);
            type_setmangle(&t, mangle(vd));

            Symbol *tlvInit = symbol_name(tlvInitName, SCstatic, t);
            tlvInit->Sdt = NULL;
            tlvInit->Salignment = type_alignsize(s->Stype);
            if (vd->linkage == LINKcpp)
                tlvInit->Sflags |= SFLpublic;

            return tlvInit;
        }
开发者ID:Cauterite,项目名称:dmd,代码行数:32,代码来源:toobj.c

示例8: runLINK

int runLINK()
{
#if _WIN32
    char *p;
    int i;
    int status;
    OutBuffer cmdbuf;

    global.params.libfiles->push((void *) "user32");
    global.params.libfiles->push((void *) "kernel32");

    for (i = 0; i < global.params.objfiles->dim; i++)
    {
	if (i)
	    cmdbuf.writeByte('+');
	p = (char *)global.params.objfiles->data[i];
	char *ext = FileName::ext(p);
	if (ext)
	    cmdbuf.write(p, ext - p - 1);
	else
	    cmdbuf.writestring(p);
    }
    cmdbuf.writeByte(',');
    if (global.params.exefile)
	cmdbuf.writestring(global.params.exefile);
    else
    {	// Generate exe file name from first obj name
	char *n = (char *)global.params.objfiles->data[0];
	char *ex;

	n = FileName::name(n);
	FileName *fn = FileName::forceExt(n, "exe");
	global.params.exefile = fn->toChars();
    }

    cmdbuf.writeByte(',');
    if (global.params.run)
	cmdbuf.writestring("nul");
//    if (mapfile)
//	cmdbuf.writestring(output);
    cmdbuf.writeByte(',');

    for (i = 0; i < global.params.libfiles->dim; i++)
    {
	if (i)
	    cmdbuf.writeByte('+');
	cmdbuf.writestring((char *) global.params.libfiles->data[i]);
    }

    if (global.params.deffile)
    {
	cmdbuf.writeByte(',');
	cmdbuf.writestring(global.params.deffile);
    }

    /* Eliminate unnecessary trailing commas	*/
    while (1)
    {   i = cmdbuf.offset;
	if (!i || cmdbuf.data[i - 1] != ',')
	    break;
	cmdbuf.offset--;
    }

    if (global.params.resfile)
    {
	cmdbuf.writestring("/RC:");
	cmdbuf.writestring(global.params.resfile);
    }

#if 0
    if (mapfile)
	cmdbuf.writestring("/m");
    if (debuginfo)
	cmdbuf.writestring("/li");
    if (codeview)
    {
	cmdbuf.writestring("/co");
	if (codeview3)
	    cmdbuf.writestring(":3");
    }
#else
    if (global.params.symdebug)
	cmdbuf.writestring("/co");
#endif

    cmdbuf.writestring("/noi");
    for (i = 0; i < global.params.linkswitches->dim; i++)
    {
	cmdbuf.writestring((char *) global.params.linkswitches->data[i]);
    }
    cmdbuf.writeByte(';');

    p = cmdbuf.toChars();

    char *linkcmd = getenv("LINKCMD");
    if (!linkcmd)
	linkcmd = "link";
    status = executecmd(linkcmd, p, 1);
    return status;
#elif linux
//.........这里部分代码省略.........
开发者ID:MrPhil,项目名称:ShortHike,代码行数:101,代码来源:link.c


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