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


C++ chunk函数代码示例

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


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

示例1: chunk

void
FileChunk::send(synergy::IStream* stream, UInt8 mark, char* data, size_t dataSize)
{
	String chunk(data, dataSize);

	switch (mark) {
	case kDataStart:
		LOG((CLOG_DEBUG2 "sending file chunk start: size=%s", data));
		break;

	case kDataChunk:
		LOG((CLOG_DEBUG2 "sending file chunk: size=%i", chunk.size()));
		break;

	case kDataEnd:
		LOG((CLOG_DEBUG2 "sending file finished"));
		break;
	}

	ProtocolUtil::writef(stream, kMsgDFileTransfer, mark, &chunk);
}
开发者ID:RCB35,项目名称:synergy,代码行数:21,代码来源:FileChunk.cpp

示例2: chunk

void
CClientProxy1_5::fileChunkSending(UInt8 mark, char* data, size_t dataSize)
{
    CString chunk(data, dataSize);

    switch (mark) {
    case kFileStart:
        LOG((CLOG_DEBUG2 "file sending start: size=%s", data));
        break;

    case kFileChunk:
        LOG((CLOG_DEBUG2 "file chunk sending: size=%i", chunk.size()));
        break;

    case kFileEnd:
        LOG((CLOG_DEBUG2 "file sending finished"));
        break;
    }

    CProtocolUtil::writef(getStream(), kMsgDFileTransfer, mark, &chunk);
}
开发者ID:rakete,项目名称:synergy-foss,代码行数:21,代码来源:CClientProxy1_5.cpp

示例3: setSingleChunkForShards

 void setSingleChunkForShards( const vector<BSONObj> &splitPoints ) {
     ChunkMap &chunkMap = const_cast<ChunkMap&>( _chunkMap );
     ChunkRangeManager &chunkRanges = const_cast<ChunkRangeManager&>( _chunkRanges );
     set<Shard> &shards = const_cast<set<Shard>&>( _shards );
     
     vector<BSONObj> mySplitPoints( splitPoints );
     mySplitPoints.insert( mySplitPoints.begin(), _key.globalMin() );
     mySplitPoints.push_back( _key.globalMax() );
     
     for( unsigned i = 1; i < mySplitPoints.size(); ++i ) {
         string name = str::stream() << (i-1);
         Shard shard( name, name );
         shards.insert( shard );
         
         ChunkPtr chunk( new Chunk( this, mySplitPoints[ i-1 ], mySplitPoints[ i ],
                                   shard ) );
         chunkMap[ mySplitPoints[ i ] ] = chunk;
     }
     
     chunkRanges.reloadAll( chunkMap );
 }
开发者ID:TonyRice,项目名称:mongo,代码行数:21,代码来源:chunktests.cpp

示例4: body

static void body (LexState *ls, expdesc *e, int needself, int line) {
  /* body ->  `(' parlist `)' chunk END */
  FuncState new_fs;
  open_func(ls, &new_fs);
#if LUA_REFCOUNT
  luarc_addrefproto(new_fs.f);
#endif /* LUA_REFCOUNT */
  new_fs.f->linedefined = line;
  checknext(ls, '(');
  if (needself) {
    new_localvarliteral(ls, "self", 0);
    adjustlocalvars(ls, 1);
  }
  parlist(ls);
  checknext(ls, ')');
  chunk(ls);
  new_fs.f->lastlinedefined = ls->linenumber;
  check_match(ls, TK_END, TK_FUNCTION, line);
  close_func(ls);
  pushclosure(ls, &new_fs, e);
}
开发者ID:henryfung01,项目名称:GameCode4,代码行数:21,代码来源:lparser.c

示例5: chunk

void chunk(int **data) {
	int *p0 = data[0];
	int *p1 = data[1];
	int *p2 = data[2];
	int *p3 = data[3];
	
	if(*p0 >= *p3) 
		return;
	
	(*p0)++;
	
	*p2 = *p3;
	
	data[1] = malloc(sizeof(int*));
	data[2] = data[1];
	data[3] = data[2];
	
	chunk(data);
	
	free(p3);
}
开发者ID:Heizmann,项目名称:sv-benchmarks,代码行数:21,代码来源:chunk3_true-termination.c

示例6: chunk

/** 현재 Energy Level 값 
 *
 * @param pId EUI64 ID
 *
 * @return 
 *      IF4ERR_NOERROR 성공
 *      IF4ERR_INVALID_ID 잘못된 ID
 *      IF4ERR_INVALID_PARAM 잘못된 pEnergyLevel pointer
 *      IF4ERR_DO_NOT_SUPPORT 지원하지 않음
 *      IF4ERR_CANNOT_CONNECT 장비에 연결되지 않음
 */
int COsakiParser::GetEnergyLevel(EUI64 *pId, BYTE *pEnergyLevel)
{
    CMDPARAM cmdParam;
    METER_STAT stat;
    int nError;
    BYTE nEnergyLevel=0;
	CChunk chunk(128);

    if(pId == NULL) return IF4ERR_INVALID_ID;
    if(pEnergyLevel == NULL) return IF4ERR_INVALID_PARAM;

    memset(&cmdParam, 0, sizeof(CMDPARAM));
    memset(&stat, 0, sizeof(METER_STAT));

    memcpy(&cmdParam.id, pId, sizeof(EUI64));
    cmdParam.codi      = GetCoordinator();
    cmdParam.nMeteringType = METERING_TYPE_BYPASS;
    cmdParam.nOption = ONDEMAND_OPTION_GET_RELAY_STATUS;
	cmdParam.pChunk	= &chunk;

    nError = METERING(&cmdParam, &stat);
    switch(nError) {
        case ONDEMAND_ERROR_OK:
            m_pEndDeviceList->GetEnergyLevel(pId, &nEnergyLevel, NULL);
            *pEnergyLevel = nEnergyLevel;
/** 제주실증단지 DR Level 적용 Patch */
#if     defined(__PATCH_11_65__)
            if(*m_pbPatch_11_65) {
                *pEnergyLevel = Patch_11_65_Nuri2Jeju(nEnergyLevel);
            }
#endif
            return IF4ERR_NOERROR;
        case ONDEMAND_ERROR_NOT_CONNECT:
        case ONDEMAND_ERROR_INIT:
        case ONDEMAND_ERROR_BUSY:
            return IF4ERR_CANNOT_CONNECT;
        default:
            return IF4ERR_UNKNOWN_ERROR;
    }
}
开发者ID:bearxiong99,项目名称:new_swamm,代码行数:51,代码来源:ParserOsaki.cpp

示例7: spriteSurface

void ExplodingSprite::makeChunks(unsigned int n) { 
  // Break the SDL_Surface into n*n squares; where each square
  // has width and height of frameWidth/n and frameHeight/n
  unsigned int chunk_width = frame->getWidth()/n;
  unsigned int chunk_height = frame->getHeight()/n;
  Sint16 source_x = frame->getSourceX();
  Sint16 source_y = frame->getSourceY();
  int speedx = static_cast<int>(velocityX()); // Wanna test for zero...
  int speedy = static_cast<int>(velocityY()); // Make sure it's an int.
  if (speedx == 0) speedx = 1; // Make sure it's not 0;
  if (speedy == 0) speedy = 1; // Make sure it's not 0;

  // Get the SDL_Surface so we can chunk it:
  SDL_Surface* spriteSurface(frame->getSurface()); 
  // i tracks the width, j tracks the height:
  for (unsigned int i = 0; i < n; ++i) {
    for (unsigned int j = 0; j < n; ++j) {
      // Give each chunk it's own speed/direction:
      float sx = (rand() % speedx + 40) * (rand()%2?-1:1); // 'cause %0 is 
      float sy = (rand() % speedy + 40) * (rand()%2?-1:1); // float except
      Frame* frame = 
            new Frame(spriteSurface, chunk_width, chunk_height,
                  source_x+i*chunk_width,  // x coord of surface
                  source_y+j*chunk_height // y coord of surface
                );
      Chunk chunk(
                Vector2f(X()+i*chunk_width,   // x coord of destination 
                         Y()+j*chunk_height), // y coord of destination
                Vector2f(sx, sy),
                getName()+"Chunk",
                frame);
      // chunks uses value semantics, as does frames, but there's
      // a big difference:
      chunks.push_back(chunk);
      frames.push_back(frame);
    }
  }


}
开发者ID:amast09,项目名称:CPSC-416-Video-Game-Project,代码行数:40,代码来源:explodingSprite.cpp

示例8: chunk

void SmallGraphicsObject::applyTransform() {
  TerrainChunk::PolishView& vx = chunk();

  updateTransform();

  Tempest::Matrix4x4 mat = localTransform(vx);

  MVertex *v = &vx.geometry.vertex[glocation];
  float x, y, z, w = 1;

  for( size_t i=0; i<model->vertex.size(); ++i, ++v ){
    const MVertex & s = model->vertex[i];
    *v = s;
    mat.project( s.x,
                 s.y,
                 s.z - vx.zView/sizeZ(),
                 1, x, y, z, w );

    v->x = x;
    v->y = y;
    v->z = z;

    mat.project( s.nx, s.ny, s.nz, 0, x, y, z, w );
    v->nx = x;
    v->ny = y;
    v->nz = z;

    mat.project( s.bx, s.by, s.bz, 0, x, y, z, w );
    v->bx = x;
    v->by = y;
    v->bz = z;
    }

  uint16_t * id = &vx.geometry.index[ ilocation ];
  for( size_t i=0; i<model->index.size(); ++i, ++id ){
    *id = glocation+model->index[i];
    }

  needToUpdate = false;
  }
开发者ID:Try,项目名称:game,代码行数:40,代码来源:smallobjectsview.cpp

示例9: clear

	//---------------------------------------------------------------------------------
	void MeshAndBspLoadContext::load(const DataStreamExPtr& _dataStream)
	{
		clear();
		mDataStream = _dataStream;

		Progress& progress = Progress::getSingleton();
		progress.setRange(0, 100);

		// Read version and size of entire MeshAndBsp.
		readMeshAndBspHeader();

		// Read mesh
		MshFileLoadContext::load(_dataStream);
		progress.setPosition(5);

		// Read BSP
		bool finish = false;
		while(!finish)
		{
			Chunk chunk(mDataStream);
			switch(chunk.getID())
			{
				case 0xC000: readBspInfo(chunk); break;
				case 0xC010: readPolygonIndices(chunk); break;
				case 0xC040: readBspNodes(chunk); break;
				case 0xC045: readLights(chunk); break;
				case 0xC050: readSectors(chunk); break;
				case 0xC0FF: finish = true; break;
			}
		}
		progress.setPosition(10);

		// Remove excess polygons
		countPolygonUsesInLod0();
		removePolygonsNotUsedInLod0();

		// Log statistics
		logStatistics();
	}
开发者ID:raduetsya,项目名称:GothOgre,代码行数:40,代码来源:MeshAndBspLoadContext.cpp

示例10: CompareOnTheFlyLight

void CompareOnTheFlyLight(comparer_context& comp)	{
	scoped_chunk chunk(comp,"aiLight");

	comp.cmp<aiString>("mName");
	const aiLightSourceType type = static_cast<aiLightSourceType>( 
		comp.cmp<uint32_t>("mType"));

	if(type==aiLightSource_DIRECTIONAL) {
		comp.cmp<float>("mAttenuationConstant");
		comp.cmp<float>("mAttenuationLinear");
		comp.cmp<float>("mAttenuationQuadratic");
	}

	comp.cmp<aiVector3D>("mColorDiffuse");
	comp.cmp<aiVector3D>("mColorSpecular");
	comp.cmp<aiVector3D>("mColorAmbient");

	if(type==aiLightSource_SPOT) {
		comp.cmp<float>("mAngleInnerCone");
		comp.cmp<float>("mAngleOuterCone");
	}
}
开发者ID:smacdo,项目名称:assimp,代码行数:22,代码来源:CompareDump.cpp

示例11: chunk

void CacheBase::Write(std::string path, const char* buf, size_t size, off_t off)
{
	FileContent& file = content_list.GetFile(path);
	FileChunk chunk(buf, off, size);
	file.SetChunk(chunk);

	/* No need to lock cache, we don't touch its members */
	pf_stat stat = GetAttr(path);
	time_t now = time(NULL);
	stat.meta_mtime = now;
	stat.mtime = now;
	stat.ctime = now;
	IDList idlist;
	idlist.insert(environment.my_id.Get());
	if(off + (off_t)size > (off_t)stat.size)
	{
		stat.size = (size_t)off + size;
		SetAttr(path, stat, idlist);
	}

	//content_list.RefreshPeersRef(path);
}
开发者ID:TheArboreProject,项目名称:Arbore-DHT,代码行数:22,代码来源:cache_base.cpp

示例12: NS_ABORT_IF_FALSE

bool
WaveReader::ScanForwardUntil(uint32_t aWantedChunk, uint32_t* aChunkSize)
{
  NS_ABORT_IF_FALSE(aChunkSize, "Require aChunkSize argument");
  *aChunkSize = 0;

  for (;;) {
    static const unsigned int CHUNK_HEADER_SIZE = 8;
    char chunkHeader[CHUNK_HEADER_SIZE];
    const char* p = chunkHeader;

    if (!ReadAll(chunkHeader, sizeof(chunkHeader))) {
      return false;
    }

    PR_STATIC_ASSERT(sizeof(uint32_t) * 2 <= CHUNK_HEADER_SIZE);
    uint32_t magic = ReadUint32BE(&p);
    uint32_t chunkSize = ReadUint32LE(&p);

    if (magic == aWantedChunk) {
      *aChunkSize = chunkSize;
      return true;
    }

    // RIFF chunks are two-byte aligned, so round up if necessary.
    chunkSize += chunkSize % 2;

    static const unsigned int MAX_CHUNK_SIZE = 1 << 16;
    PR_STATIC_ASSERT(MAX_CHUNK_SIZE < UINT_MAX / sizeof(char));
    nsAutoArrayPtr<char> chunk(new char[MAX_CHUNK_SIZE]);
    while (chunkSize > 0) {
      uint32_t size = NS_MIN(chunkSize, MAX_CHUNK_SIZE);
      if (!ReadAll(chunk.get(), size)) {
        return false;
      }
      chunkSize -= size;
    }
  }
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:39,代码来源:WaveReader.cpp

示例13: spriteSurface

void Chunker::makeChunks(unsigned int n) { 
  // Break the SDL_Surface into n*n squares; where each square
  // has width and height of frameWidth/n and frameHeight/n
  unsigned int chunk_width = std::max(1u, sprite.getFrame()->getWidth()/n);
  unsigned int chunk_height = std::max(1u, sprite.getFrame()->getHeight()/n);
  int speedx = static_cast<int>(sprite.velocityX()); // Wanna test for zero...
  int speedy = static_cast<int>(sprite.velocityY()); // Make sure it's an int.
  if (speedx == 0) speedx = 1; // Make sure it's not 0;
  if (speedy == 0) speedy = 1; // Make sure it's not 0;

  // Get the SDL_Surface so we can chunk it:
  SDL_Surface* spriteSurface(sprite.getFrame()->getSurface()); 
  Sint16 source_y =sprite.getFrame()->getSourceY();
  while  (source_y < sprite.getFrame()->getHeight() ) {
    Sint16 source_x = sprite.getFrame()->getSourceX();
    while ( source_x < sprite.getFrame()->getWidth() ) {
      // Give each chunk it's own speed/direction:
      float sx = (rand() % speedx + 40) * (rand()%2?-1:1); // 'cause %0 is 
      float sy = (rand() % speedy + 40) * (rand()%2?-1:1); // float except
      Frame* frame = 
            new Frame(spriteSurface, chunk_width, chunk_height,
                  source_x, source_y
                );
      Chunk chunk(
                Vector2f(sprite.X()+source_x,   // x coord of destination 
                         sprite.Y()+source_y), // y coord of destination
                Vector2f(sx, sy),
                sprite.getName()+"/chunk",
                frame);
      // chunks uses value semantics, as does frames, but there's
      // a big difference:
      chunks.push_back(chunk);
      frames.push_back(frame);
      source_x += chunk_width;
    }
    source_y += chunk_height;
  }
}
开发者ID:mysticalbeaver,项目名称:theBestGameEver,代码行数:38,代码来源:explosionStrategy.cpp

示例14: repeatstat

static void repeatstat (LexState *ls, int line) {
  /* repeatstat -> REPEAT block UNTIL cond */
  int condexit;
  FuncState *fs = ls->fs;
  int repeat_init = luaK_getlabel(fs);
  BlockCnt bl1, bl2;
  enterblock(fs, &bl1, 1);  /* loop block */
  enterblock(fs, &bl2, 0);  /* scope block */
  luaX_next(ls);  /* skip REPEAT */
  chunk(ls);
  check_match(ls, TK_UNTIL, TK_REPEAT, line);
#if LUA_EXT_CONTINUE
  if (bl2.continuelist != NO_JUMP) {
    int oldprohibition = fs->prohibitedloc;
    luaK_patchtohere(fs, bl2.continuelist);
    fs->prohibitedloc = bl2.continuepos;
    condexit = cond(ls);  /* read condition (inside scope block) */
    fs->prohibitedloc = oldprohibition;
    bl2.continuelist = NO_JUMP;
  }
  else {
    condexit = cond(ls);  /* read condition (inside scope block) */
  }
#else
  condexit = cond(ls);  /* read condition (inside scope block) */
#endif /* LUA_EXT_CONTINUE */
  if (!bl2.upval) {  /* no upvalues? */
    leaveblock(fs);  /* finish scope */
    luaK_patchlist(ls->fs, condexit, repeat_init);  /* close the loop */
  }
  else {  /* complete semantics when there are upvalues */
    breakstat(ls);  /* if condition then break */
    luaK_patchtohere(ls->fs, condexit);  /* else... */
    leaveblock(fs);  /* finish scope... */
    luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init);  /* and repeat */
  }
  leaveblock(fs);  /* finish loop */
}
开发者ID:henryfung01,项目名称:GameCode4,代码行数:38,代码来源:lparser.c

示例15: info

void CMTPTypeDeviceInfo::ConstructL()
    {
    for (TUint i(0); (i < ENumElements); i++)
        {
        const TElementInfo& info(iElementInfo[i]);
        if (ChunkCount() <= info.iChunkId)
            {
            MMTPType* chunk(NULL);
            
            switch (info.iType)
                {
            case EMTPTypeArray:
                chunk = NewArrayChunkL(info);
                break;
                
            case EMTPTypeFlat:
                chunk = NewFlatChunkL(info);
                break;
                
            case EMTPTypeString:
                chunk = NewStringChunkL(info);
                break;
                
            case EMTPTypeUINT16:
                chunk = NewUInt16Chunk(info);
                break;
                
            default:
                break;
                }
                
            __ASSERT_DEBUG(chunk, User::Invariant());
            CleanupStack::PushL(chunk);
            ChunkAppendL(*chunk);
            CleanupStack::Pop(chunk);
            }
        }
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:38,代码来源:cmtptypedeviceinfo.cpp


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