本文整理汇总了C++中chunk函数的典型用法代码示例。如果您正苦于以下问题:C++ chunk函数的具体用法?C++ chunk怎么用?C++ chunk使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了chunk函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: main
int main() {
int **data = malloc(4*sizeof(int*));
int *p0 = malloc(sizeof(int));
int *p1 = malloc(sizeof(int));
int *p2 = malloc(sizeof(int));
int *p3 = malloc(sizeof(int));
int i = __VERIFIER_nondet_int();
int upper = __VERIFIER_nondet_int();
if(i >= upper)
return 0;
*p0 = i;
*p3 = upper;
data[0] = p0;
data[1] = p1;
data[2] = p2;
data[3] = p3;
chunk(data);
int *p1_new = (int*) data[1];
int *p2_new = (int*) data[2];
free(p1_new);
free(p2_new);
}
开发者ID:Heizmann,项目名称:sv-benchmarks,代码行数:38,代码来源:chunk3_true-termination.c
示例17: luaS_new
Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) {
struct LexState lexstate;
struct FuncState *pfuncstate = (struct FuncState*)malloc(sizeof(struct FuncState));
Proto *res;
TString *tname = luaS_new(L, name);
setsvalue2s(L, L->top, tname); /* protect name */
incr_top(L);
lexstate.buff = buff;
luaX_setinput(L, &lexstate, z, tname);
open_func(&lexstate, pfuncstate);
pfuncstate->f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */
luaX_next(&lexstate); /* read first token */
chunk(&lexstate);
check(&lexstate, TK_EOS);
close_func(&lexstate);
L->top--; /* remove 'name' from stack */
lua_assert(pfuncstate->prev == NULL);
lua_assert(pfuncstate->f->nups == 0);
lua_assert(lexstate.fs == NULL);
res = pfuncstate->f;
free(pfuncstate);
return res;
}
开发者ID:634351070,项目名称:rt-thread,代码行数:23,代码来源:lparser.c
示例18: chunk
/**
* Imports the file chunks into the database, but does not
* import the file_header itself as a chunk, as it may be
* imbedded within another chunk.
*
* @pre is_regular_file(p)
*/
cafs::file_header cafs::import_file( const fc::path& p ) {
file_header head;
head.file_size = fc::file_size(p);
fc::vector<char> chunk( MAX_CHUNK_SIZE );
// divide file up into chunks and slices
fc::ifstream in( p.string(), fc::ifstream::binary );
uint32_t r = 0;
while( r < head.file_size ) {
size_t some = fc::min( size_t(chunk.size()), size_t(head.file_size-r) );
in.read( chunk.data(), some );
size_t seed = randomize(chunk, *((uint64_t*)fc::sha1::hash(chunk.data(),chunk.size()).data()) );
chunk.resize(some);
auto chunk_head = slice_chunk(chunk);
auto chunk_id = store_chunk( chunk_head, chunk );
head.add_chunk( chunk_id, seed, chunk_head );
r += some;
}
return head;
}
开发者ID:Zhang-Yi,项目名称:tornet,代码行数:30,代码来源:cafs.cpp
示例19: luaS_new
Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) {
struct LexState lexstate;
struct FuncState funcstate;
TString *tname = luaS_new(L, name);
setsvalue2s(L, L->top, tname); /* protect name */
incr_top(L);
lexstate.buff = buff;
luaX_setinput(L, &lexstate, z, tname);
open_func(&lexstate, &funcstate);
funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */
luaX_next(&lexstate); /* read first token */
chunk(&lexstate);
check(&lexstate, TK_EOS);
close_func(&lexstate);
#ifdef LUA_OPTIMIZE_DEBUG
compile_stripdebug(L, funcstate.f);
#endif
L->top--; /* remove 'name' from stack */
lua_assert(funcstate.prev == NULL);
lua_assert(funcstate.f->nups == 0);
lua_assert(lexstate.fs == NULL);
return funcstate.f;
}
开发者ID:3dot3,项目名称:nodemcu-firmware,代码行数:23,代码来源:lparser.c
示例20: peers_
SocketSync<Dtype>::SocketSync(shared_ptr<Solver<Dtype> > root_solver,
const vector<shared_ptr<SocketChannel> > &
peers, int rank)
: P2PSync<Dtype>(root_solver, NULL, root_solver->param()),
peers_(peers),
rank_(rank),
data_send_(peers.size()),
data_recv_(peers.size()),
diff_send_(peers.size()),
diff_recv_(peers.size()),
ctrl_send_(peers.size()),
ctrl_recv_(peers.size()) {
#ifndef CPU_ONLY
int initial_device;
CUDA_CHECK(cudaGetDevice(&initial_device));
CUDA_CHECK(cudaSetDevice(root_solver->param().device_id()));
chunk(rank_, &own_offs_, &own_size_);
for (int peer = 0; peer < peers_.size(); ++peer) {
if (peer == rank_) {
// Chunk for which we are master, connected to all peers.
// Loops must be imbricated to have buffers created in
// the same order on all boxes.
for (int i = 0; i < peers_.size(); ++i) {
if (i != rank_) {
CreateMasterBuffers(i);
}
}
} else {
// Other chunks are connected to their respective masters
CreateWorkerBuffers(peer);
}
}
CUDA_CHECK(cudaSetDevice(initial_device));
#else
NO_GPU;
#endif
}
开发者ID:Aravindreddy986,项目名称:CaffeOnSpark,代码行数:37,代码来源:socket_sync.cpp
注:本文中的chunk函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论