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

C++ block类代码示例

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

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



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

示例1: convertKey

bool AssocArrayElem::convertKey(block& blk, AssocArrayType& aaType, Variable* keyVar, bool needSwap)
{
    bool result = false; //conversion generated?

    if (keyVar && aaType.keyTYPE().isStringType())
    {
        block* keyBlock = needSwap ? blk.addNewBlock() : &blk;
        //do not convert if the key is explicitly of the System.String type
        if (aaType.keyType().isString())
        {
#if 0
            keyVar->store(*keyBlock);
            loadArray(*keyBlock, *keyVar);
#else
            Variable* v = savePartialResult(*keyBlock, keyVar->getDecl(), keyVar->getType(), false);
            keyBlock->add(*new UTF8Encoding);
            loadArray(*keyBlock, *v);
#endif
            keyBlock->add(*new EncodingGetString);
            result = true;
        }
        if (needSwap)
        {
            blk.swapTail();
        }
    }
    return result;
}
开发者ID:Geod24,项目名称:dnet,代码行数:28,代码来源:assocarray.cpp


示例2: ASSERTION

void block_file::write_block(int position, const block &b) {
	ASSERTION(position < get_block_count());
	ASSERTION(b.get_size() == block_size);

	file.seekp(position * block_size);
	file.write(b.raw_char_pointer(), block_size);
}
开发者ID:andres-arana,项目名称:degree-7506-tp,代码行数:7,代码来源:block_file.cpp


示例3: BlockDef

// as copy
block::block(const block& original)
    :
    BlockDef(original.blockDef()),
    Vertices(original.points()),
    Cells(original.cells()),
    BoundaryPatches(original.boundaryPatches())
{}
开发者ID:degirmen,项目名称:openfoam-extend-OpenFOAM-1.6-ext,代码行数:8,代码来源:block.C


示例4: ok

 void abstract_block_model::ok(block& blk) {
     if (currentblockiteator != end()) currentblockiteator->set_ok();
     currentblockiteator++;
     parcel_iterator endit = blk.end();
     endit++;
     for (parcel_iterator it = blk.begin(); it != endit; ++it) {
         if (it->first->isvalue()) {
             if (!it->first->error()) {
                 switch (SUPER_TYPE(it->first->type())) {
                     case TYPE_EVENT:
                     {
                         executr->write_val_event(it->second, it->first->value_event());
                         break;
                     }
                     case TYPE_REPORT:
                     {
                         executr->write_val_report(it->second, it->first->value_report());
                         break;
                     }
                     default:
                     {
                         executr->write_val(it->second, it->first->value());
                     }
                 }
             }
         }
         if (it->first->error()) {
             executr->error(it->second, it->first->error());
         }
     }
 }
开发者ID:sealeks,项目名称:nsdavinci,代码行数:31,代码来源:driver_blockmodel.cpp


示例5: switch

// Return the neighbour face point from the mapped indices
inline label facePointN
(
    const int facei,
    const block& block,
    const label i,
    const label j
)
{
    switch (facei)
    {
        case 0:
            return facePointN(block, 0, i, j);
        case 1:
            return facePointN(block, block.meshDensity().x(), i, j);
        case 2:
            return facePointN(block, i, 0, j);
        case 3:
            return facePointN(block, i, block.meshDensity().y(), j);
        case 4:
            return facePointN(block, i, j, 0);
        case 5:
            return facePointN(block, i, j, block.meshDensity().z());
        default:
            return -1;
    }
}
开发者ID:CDAC-CFD,项目名称:OpenFOAM-2.4.x,代码行数:27,代码来源:blockMeshMergeFast.C


示例6: allocData

block::block(const block&right){
  //delete []this->data;
  allocData();
  this->b_type=right.getType();
  this->b_pos=right.getPos();
  this->setType(this->b_type);
  this->setState(right.getState());
}
开发者ID:regenadaster,项目名称:Tetris,代码行数:8,代码来源:block.cpp


示例7: hash

std::size_t block_hasher::hash(const block& v) {
    std::size_t seed(0);

    combine(seed, v.type());
    combine(seed, v.content());

    return seed;
}
开发者ID:memsharded,项目名称:dogen,代码行数:8,代码来源:block_hash.cpp


示例8: addInside

void block::addInside(block & check, block grab, int i)
{
	int pos=0;
	if(check.cond&&(pos=check.blockIsInside(grab))){
		check.addInside(check.blocksIn[pos-1],grab,pos-1);
	}
	else {
		addIn(grab, i);
	}
}
开发者ID:heidgera,项目名称:RobotBlocks,代码行数:10,代码来源:blocks.cpp


示例9: resetUsed

void bGroup::resetUsed(block & t)
{
	//-------- resets the log of what blocks have been used in the last print stage
	used[""]=false;
	used[t.title]=false;
	for (unsigned int i=0; i<t.numInside(); i++) {
		resetUsed(t.blocksIn[i]);
	}
	for (unsigned int i=0; i<t.size(); i++) {
		resetUsed(t.blocksOn[i]);
	}
}
开发者ID:heidgera,项目名称:RoboBlocks,代码行数:12,代码来源:blocks_WriteOutFuncs.cpp


示例10: resetList

void resetList(block & t, map<string,bool> & used)
{
	//-------- resets the log of what blocks have been used in the last print stage
	used[""]=false;
	used[t.title]=false;
	for (unsigned int i=0; i<t.numInside(); i++) {
		resetList(t.blocksIn[i],used);
	}
	for (unsigned int i=0; i<t.size(); i++) {
		resetList(t.blocksOn[i],used);
	}
}
开发者ID:heidgera,项目名称:RoboBlocks,代码行数:12,代码来源:blocks_WriteOutFuncs.cpp


示例11: get_previous_hash

code data_base::verify_push(const block& block, size_t height)
{
    if (block.transactions().empty())
        return error::empty_block;

    if (get_next_height(blocks()) != height)
        return error::store_block_invalid_height;

    if (block.header().previous_block_hash() !=
        get_previous_hash(blocks(), height))
        return error::store_block_missing_parent;

    return error::success;
}
开发者ID:pmienk,项目名称:libbitcoin-database,代码行数:14,代码来源:data_base.cpp


示例12: unsignIndex

// Return the neighbour face point from the signed indices
inline label facePointN
(
    const block& block,
    const label i,
    const label j,
    const label k
)
{
    return block.vtxLabel
    (
        unsignIndex(i, block.meshDensity().x()),
        unsignIndex(j, block.meshDensity().y()),
        unsignIndex(k, block.meshDensity().z())
    );
}
开发者ID:CDAC-CFD,项目名称:OpenFOAM-2.4.x,代码行数:16,代码来源:blockMeshMergeFast.C


示例13: generate_genesis_block

  //---------------------------------------------------------------
  bool generate_genesis_block(
      block& bl
    , std::string const & genesis_tx
    , uint32_t nonce
    )
  {
    //genesis block
    bl = boost::value_initialized<block>();


    account_public_address ac = boost::value_initialized<account_public_address>();
    std::vector<size_t> sz;
    construct_miner_tx(0, 0, 0, 0, 0, ac, bl.miner_tx); // zero fee in genesis
    blobdata txb = tx_to_blob(bl.miner_tx);
    std::string hex_tx_represent = string_tools::buff_to_hex_nodelimer(txb);

    std::string genesis_coinbase_tx_hex = config::GENESIS_TX;

    blobdata tx_bl;
    string_tools::parse_hexstr_to_binbuff(genesis_coinbase_tx_hex, tx_bl);
    bool r = parse_and_validate_tx_from_blob(tx_bl, bl.miner_tx);
    CHECK_AND_ASSERT_MES(r, false, "failed to parse coinbase tx from hard coded blob");
    bl.major_version = CURRENT_BLOCK_MAJOR_VERSION;
    bl.minor_version = CURRENT_BLOCK_MINOR_VERSION;
    bl.timestamp = 0;
    bl.nonce = nonce;
    miner::find_nonce_for_given_block(bl, 1, 0);
    bl.invalidate_hashes();
    return true;
  }
开发者ID:Coder420,项目名称:bitmonero,代码行数:31,代码来源:cryptonote_tx_utils.cpp


示例14: addFromClick

void bGroup::addFromClick(block & t, int _x, int _y)
{
	for (unsigned int j=0; j<t.blocksIn.size(); j++) {
		if (!inHand&&!ddopen&&!t.ddSelected){
			int blk=0;
			if(blk=t.blocksIn[j].onBlockIn(_x, _y)){
				addFromClick(t.blocksIn[j].blocksIn[blk-1], _x, _y);
			}
			else if(t.blocksIn[j].clickDown(_x,_y)) {
				int cur=add(t.passBlocks(OF_BLOCK_IN,j));
				inHand=true;
				dispx = blocks[cur].x-_x;
				dispy = blocks[cur].y-_y;
			}
		}
	}
	for (unsigned int j=0; j<t.blocksOn.size(); j++) {
		if (!inHand&&!ddopen&&!t.ddSelected){
			int blk=0;
			if(blk=t.blocksOn[j].onBlockIn(_x, _y)){
				addFromClick(t.blocksOn[j].blocksIn[blk-1], _x, _y);
			}
		}
	}
}
开发者ID:heidgera,项目名称:RobotBlocks,代码行数:25,代码来源:blocks.cpp


示例15: can_place

bool Game::can_place(block b, Point p)
{
  bool onAbsCorner = false;
  bool onRelCorner = false;
  int N = dimension - 1;

  Point corners[4] = { Point(0,0), Point(N, 0), Point(0, N), Point(N, N) };
  Point corner = corners[my_number];
  for(int i = 0; i < b.size(); i++){
    Point q = b[i].add(p);
    int x = q.x;
    int y = q.y;
    if (x > N || x < 0 || y < 0 || y > N || grid[x][y] >= 0
        || grid[x][y] == -2
        || (x > 0 && grid[x-1][y] == my_number)
        || (y > 0 && grid[x][y-1] == my_number)
        || (x < N && grid[x+1][y] == my_number)
        || (y < N && grid[x][y+1] == my_number)) {
      return false;
    }

    onAbsCorner = onAbsCorner || q.eq(corner);
    onRelCorner = onRelCorner
      || (x > 0 && y > 0 && grid[x-1][y-1] == my_number)
      || (x < N && y > 0 && grid[x+1][y-1] == my_number)
      || (x > 0 && y < N && grid[x-1][y+1] == my_number)
      || (x < N && y < N && grid[x+1][y+1] == my_number);
  }

  return grid[corner.x][corner.y] < 0 ? onAbsCorner : onRelCorner;
}
开发者ID:ManasGeorge,项目名称:AWAP,代码行数:31,代码来源:game.cpp


示例16: deallocate

 /**
  * Frees the given block and resets it.
  * \param b Block to be freed.
  */
 void deallocate(block &b)
 {
   if (b) {
     ::free(b.ptr);
     b.reset();
   }
 }
开发者ID:respu,项目名称:AllocatorBuilder,代码行数:11,代码来源:mallocator.hpp


示例17: rotate_block

block Game::rotate_block(block b, int num_rotations)
{
  block newBlock;
  for(int i = 0; i < b.size(); i++){
    newBlock.push_back(b[i].rotate(num_rotations));
  }
  return newBlock;
}
开发者ID:ManasGeorge,项目名称:AWAP,代码行数:8,代码来源:game.cpp


示例18: calc_c22

block calc_c22(block A, block B, block C) {
    block tempC = C.block22();
    tempC.add_scratch();
    future<block> A21B12 = async(rec_mult, A.block21(), B.block12(), C.block22());
    future<block> A22B22 = async(rec_mult, A.block22(), B.block22(), tempC);
    return add_blocks(A21B12.get(), A22B22.get(), C.block22());
}
开发者ID:kempj,项目名称:hpxMP,代码行数:7,代码来源:hpx-mmult.cpp


示例19: calc_c11

block calc_c11(block A, block B, block C) {
    block tempC = C.block11();//scratch space
    tempC.add_scratch();
    future<block> A11B11 = async(rec_mult, A.block11(), B.block11(), C.block11());
    future<block> A12B21 = async(rec_mult, A.block12(), B.block21(), tempC);
    return add_blocks(A11B11.get(), A12B21.get(), C.block11());
}
开发者ID:kempj,项目名称:hpxMP,代码行数:7,代码来源:hpx-mmult.cpp


示例20: verify_insert

code data_base::verify_insert(const block& block, size_t height)
{
    if (block.transactions().empty())
        return error::empty_block;

    if (blocks_->exists(height))
        return error::store_block_duplicate;

    return error::success;
}
开发者ID:pmienk,项目名称:libbitcoin-database,代码行数:10,代码来源:data_base.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ blocked_range类代码示例发布时间:2022-05-31
下一篇:
C++ blobdata类代码示例发布时间: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