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


C++ data_buffer类代码示例

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


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

示例1: decode

bool checkpoint_sync_unsigned::decode(data_buffer & buffer)
{
    m_version = buffer.read_int32();
    m_hash_checkpoint = buffer.read_sha256();
    
    return true;
}
开发者ID:xCoreDev,项目名称:vcash,代码行数:7,代码来源:checkpoint_sync_unsigned.cpp

示例2: decode

bool checkpoint_sync::decode(data_buffer & buffer)
{
    auto len = buffer.read_var_int();
    
    if (len > 0)
    {
        m_message.resize(len);
        
        buffer.read_bytes(
            reinterpret_cast<char *>(&m_message[0]), m_message.size()
        );
    }
    
    len = buffer.read_var_int();
    
    if (len > 0)
    {
        m_signature.resize(len);
        
        buffer.read_bytes(
            reinterpret_cast<char *>(&m_signature[0]), m_signature.size()
        );
    }
    
    return true;
}
开发者ID:jaggedMiner,项目名称:vanillacoin,代码行数:26,代码来源:checkpoint_sync.cpp

示例3: encode

void zerotime_lock::encode(data_buffer & buffer)
{
    /**
     * Encode the version.
     */
    buffer.write_uint32(m_version);

    /**
     * Encode the transaction.
     */
    m_transaction.encode(buffer);

    /**
     * Encode the transaction hash.
     */
    buffer.write_bytes(
        reinterpret_cast<const char *> (m_hash_tx.digest()),
        sha256::digest_length
    );

    /**
     * Encode the expiration.
     */
    buffer.write_uint64(m_expiration);

    /**
     * No signature is required because:
     * 1. The receiver may want to lock a non-zerotime transaction.
     * 2. It causes no harm to let other's lock the transaction.
     * 3. It conserves bandwidth and processing power.
     */
}
开发者ID:tempbottle,项目名称:vanillacoin,代码行数:32,代码来源:zerotime_lock.cpp

示例4: decode

bool zerotime_question::decode(data_buffer & buffer)
{
    /**
     * Decode the version.
     */
    m_version = buffer.read_uint32();
    
    assert(m_version == current_version);
    
    /**
     * Decode the transaction inputs length.
     */
    auto len = buffer.read_var_int();

    /**
     * Allocate the transaction inputs.
     */
    m_transactions_in.resize(len);
    
    for (auto i = 0; i < len; i++)
    {
        /**
         * Decode the transaction_in.
         */
        m_transactions_in[i].decode(buffer);
    }
    
    return true;
}
开发者ID:greenmo000,项目名称:vcash,代码行数:29,代码来源:zerotime_question.cpp

示例5: decode

void transaction_out::decode(data_buffer & buffer)
{
    /**
     * Decode the value.
     */
    m_value = buffer.read_int64();
    
    /**
     * Read the var_int.
     */
    auto len = buffer.read_var_int();
    
    if (len > 0)
    {
        /**
         * Read the script.
         */
        auto bytes = buffer.read_bytes(len);
        
        /**
         * Insert the script.
         */
        m_script_public_key.insert(
            m_script_public_key.begin(), bytes.begin(), bytes.end()
        );
    }
}
开发者ID:jaggedMiner,项目名称:vanillacoin,代码行数:27,代码来源:transaction_out.cpp

示例6: decode

bool inventory_vector::decode(data_buffer & buffer)
{
    m_type = static_cast<type_t> (buffer.read_uint32());
    m_hash = buffer.read_sha256();
    
    return true;
}
开发者ID:jaggedMiner,项目名称:vanillacoin,代码行数:7,代码来源:inventory_vector.cpp

示例7: encode

bool inventory_vector::encode(data_buffer & buffer)
{
    buffer.write_uint32(m_type);
    buffer.write_sha256(m_hash);
    
    return true;
}
开发者ID:jaggedMiner,项目名称:vanillacoin,代码行数:7,代码来源:inventory_vector.cpp

示例8: encode

void chainblender_join::encode(data_buffer & buffer)
{
    /**
     * Encode the version.
     */
    buffer.write_uint32(m_version);
    
    /**
     * The session id must be null for a cbjoin.
     */
    if (m_hash_session_id.is_empty() == false)
    {
        log_error(
            "ChainBlender join message has invalid hash session "
            "id = " << m_hash_session_id.to_string() << "."
        );
    }
    
    /**
     * Encode the session id.
     */
    buffer.write_sha256(m_hash_session_id);
    
    /**
     * Encode the denomination.
     */
    buffer.write_int64(m_denomination);
}
开发者ID:greenmo000,项目名称:vcash,代码行数:28,代码来源:chainblender_join.cpp

示例9:

offs_t cop420_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params)
{
	uint8_t opcode = opcodes.r8(pc);
	uint8_t next_opcode = opcodes.r8(pc+1);
	uint16_t address;
	uint32_t flags = 0;
	int bytes = 1;

	if ((opcode >= 0x80 && opcode <= 0xBE) || (opcode >= 0xC0 && opcode <= 0xFE))
	{
		int page = pc >> 6;

		if (page == 2 || page == 3) //JP pages 2,3
		{
			address = (uint16_t)((pc & 0x380) | (opcode & 0x7F));
			util::stream_format(stream, "JP %03X", address);
		}
		else
		{
			if ((opcode & 0xC0) == 0xC0) //JP other pages
			{
				address = (uint16_t)((pc & 0x3C0) | (opcode & 0x3F));
				util::stream_format(stream, "JP %03X", address);
			}
			else                    //JSRP
			{
				address = (uint16_t)(0x80 | (opcode & 0x3F));
				util::stream_format(stream, "JSRP %03X", address);
				flags = STEP_OVER;
			}
		}
	}
开发者ID:Dagarman,项目名称:mame,代码行数:32,代码来源:cop420ds.cpp

示例10: decode

bool merkle_tree_partial::decode(data_buffer & buffer)
{
    m_total_transactions = buffer.read_uint32();
    
    auto count = buffer.read_var_int();
    
    for (auto i = 0; i < count; i++)
    {
        m_hashes.push_back(buffer.read_sha256());
    }
    
    std::vector<std::uint8_t> bytes;
    
    auto len = buffer.read_var_int();
    
    if (len > 0)
    {
        bytes.resize(len);
        
        buffer.read_bytes(reinterpret_cast<char *>(&bytes[0]), len);
    }
    
    m_flags.resize(bytes.size() * 8);
    
    for (auto i = 0; i < m_flags.size(); i++)
    {
        m_flags[i] = (bytes[i / 8] & (1 << (i % 8))) != 0;
    }
    
    is_invalid_ = false;
    
    return true;
}
开发者ID:rafaelfelicio,项目名称:vcash-1,代码行数:33,代码来源:merkle_tree_partial.cpp

示例11: erase_begin

bool erase_begin(data_buffer& buffer, index123_type& index123)
{
  data_pointer ptr = buffer.begin();
  auto itr = index123.find( ptr.get_offset() /*static_cast<offset_t>( static_cast<size_t>(ptr) )*/);
  index123.erase(itr);
  buffer.deallocate(ptr, 1);
  return true;
}
开发者ID:dmitry-saprykin,项目名称:v-set,代码行数:8,代码来源:multiset_test_impl.cpp

示例12: encode

void hd_configuration::encode(data_buffer & buffer) const
{
    assert(m_id_key_master.digest().size() == ripemd160::digest_length);
    buffer.write_uint32(m_version);
    buffer.write_uint32(m_index);
    buffer.write_bytes(
        reinterpret_cast<const char *> (&m_id_key_master.digest()[0]),
        ripemd160::digest_length
    );
}
开发者ID:xCoreDev,项目名称:vcash,代码行数:10,代码来源:hd_configuration.cpp

示例13: data_buffer

            /**
             * Copy constructor
             * @param other The other data_buffer.
             */
			data_buffer(const data_buffer & other)
			    : m_read_ptr(0)
                , file_offset_(other.file_offset_)
                , file_(other.file_)
			{
                clear();
                
			    write_bytes(other.data(), other.size());
                
                m_read_ptr = m_data.size() > 0 ? &m_data[0] : 0;
			}
开发者ID:machado-rev,项目名称:vcash,代码行数:15,代码来源:data_buffer.hpp

示例14: decode

bool hd_configuration::decode(data_buffer & buffer)
{
    m_version = buffer.read_uint32();
    m_index = buffer.read_uint32();
    buffer.read_bytes(
        reinterpret_cast<char *> (&m_id_key_master.digest()[0]),
        ripemd160::digest_length
    );

    return true;
}
开发者ID:xCoreDev,项目名称:vcash,代码行数:11,代码来源:hd_configuration.cpp

示例15: encode

void checkpoint_sync::encode(data_buffer & buffer)
{
    buffer.write_var_int(m_message.size());
    buffer.write_bytes(
        reinterpret_cast<char *>(&m_message[0]), m_message.size()
    );
    
    buffer.write_var_int(m_signature.size());
    buffer.write_bytes(
        reinterpret_cast<char *>(&m_signature[0]), m_signature.size()
    );
}
开发者ID:jaggedMiner,项目名称:vanillacoin,代码行数:12,代码来源:checkpoint_sync.cpp


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