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


C++ block类代码示例

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


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


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