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


C++ Blob函数代码示例

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


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

示例1: CHECK

void MatrixServerTable<T>::ProcessGet(const std::vector<Blob>& data,
  std::vector<Blob>* result) {
  CHECK(data.size() == 1);
  CHECK_NOTNULL(result);

  result->push_back(data[0]); // also push the key

  size_t keys_size = data[0].size<integer_t>();
  integer_t* keys = reinterpret_cast<integer_t*>(data[0].data());

  //get all rows
  if (keys_size == 1 && keys[0] == -1){
    Blob value(sizeof(T) * storage_.size());
    T* pvalues = reinterpret_cast<T*>(value.data());
    updater_->Access(storage_.size(), storage_.data(), pvalues);
    result->push_back(value);
    result->push_back(Blob(&server_id_, sizeof(int)));
    Log::Debug("[ProcessGet] Server = %d, getting rows offset = %d, #rows = %d\n",
      server_id_, row_offset_, storage_.size() / num_col_);
    return;
  }

  integer_t row_size = sizeof(T)* num_col_;
  result->push_back(Blob(keys_size * row_size));
  T* vals = reinterpret_cast<T*>((*result)[1].data());
  integer_t offset_v = 0;
  for (auto i = 0; i < keys_size; ++i) {
    integer_t offset_s = (keys[i] - row_offset_) * num_col_;
    updater_->Access(num_col_, storage_.data(), vals + offset_v, offset_s);
    offset_v += num_col_;
    Log::Debug("[ProcessAdd] Server = %d, getting #row = %d\n",
      server_id_, keys[i]);
  }
}
开发者ID:pbnj-io,项目名称:multiverso,代码行数:34,代码来源:matrix_table.cpp

示例2: while

bool BdbReader::Read(Blob& key, Blob& value) {
LAB_AGAIN:
	while (true) {
		if (m_idx < 0)
			return false;
		if (m_idx < m_entries)
			break;
		if (!LoadNextPage(m_pgno+1))
			return false;
	}
	int keyIdx = *((UInt16*)(m_curPage.data()+26)+m_idx*2),
		valIdx = *((UInt16*)(m_curPage.data()+26)+m_idx*2+1);
	if (keyIdx+3 > m_curPage.Size || valIdx+3 > m_curPage.Size) {
		m_idx = m_entries;
		goto LAB_AGAIN;
	}
	++m_idx;
	int keyLen = *(UInt16*)(m_curPage.data()+keyIdx),
		valLen = *(UInt16*)(m_curPage.data()+valIdx);
	if (keyIdx+keyLen > m_curPage.Size || valIdx+valLen > m_curPage.Size) {
		m_idx = m_entries;
		goto LAB_AGAIN;
	}
	if (*(m_curPage.data()+keyIdx+2) != 1 || *(m_curPage.data()+valIdx+2) != 1)
		goto LAB_AGAIN;
	key = Blob(m_curPage.data()+keyIdx+3, keyLen);
	value = Blob(m_curPage.data()+valIdx+3, valLen);
	return true;
}
开发者ID:coinhelper,项目名称:coin,代码行数:29,代码来源:bdb-reader.cpp

示例3: Blob

Blob Object::toBlob() const
{
	if(isBlob())
		return Blob(*this);
	else
		return Blob();
}
开发者ID:balooloo,项目名称:libgit2pp,代码行数:7,代码来源:object.cpp

示例4: Blob

void 
Sha256WithRsaSignature::set(const struct ndn_Signature& signatureStruct)
{
  digestAlgorithm_ = Blob(signatureStruct.digestAlgorithm);
  witness_ = Blob(signatureStruct.witness);
  signature_ = Blob(signatureStruct.signature);
  publisherPublicKeyDigest_.set(signatureStruct.publisherPublicKeyDigest);
  keyLocator_.set(signatureStruct.keyLocator);
}
开发者ID:flily,项目名称:ndn-cpp,代码行数:9,代码来源:sha256-with-rsa-signature.cpp

示例5: FamilySize

Blob IPAddress::GetAddressBytes() const {
	int size = FamilySize(AddressFamily);
	if (!size)
		Throw(ExtErr::UnknownHostAddressType);
	switch ((int)get_AddressFamily()) {
	case AF_INET:
		return Blob(&m_sin.sin_addr, 4);
	case AF_INET6:
		return Blob(&m_sin6.sin6_addr, 16);
	default:
		Throw(ExtErr::UnknownHostAddressType);
	}
}
开发者ID:Groestlcoin,项目名称:el,代码行数:13,代码来源:ext-ip-address.cpp

示例6: Throw

Blob Sec256Signature::Serialize() const {
	uint8_t buf[100];
	size_t size = sizeof buf;
	if (!secp256k1_ecdsa_sig_serialize(buf, &size, &m_r, &m_s))
		Throw(errc::invalid_argument);
	return Blob(buf, size);
}
开发者ID:ufasoft,项目名称:coin,代码行数:7,代码来源:secp256k1-envelop.cpp

示例7: ASSERT

Blob Sec256Dsa::PrivKeyToDER(RCSpan privKey, bool bCompressed) {
	ASSERT(privKey.size() == 32);
	uint8_t ar[279];
	size_t privkeylen = sizeof ar;
	Sec256Check(::ec_privkey_export_der(g_sec256Ctx, ar, &privkeylen, privKey.data(), bCompressed));
	return Blob(ar, privkeylen);
}
开发者ID:ufasoft,项目名称:coin,代码行数:7,代码来源:secp256k1-envelop.cpp

示例8: gotStaleData

    /** We got some data for a ledger we are no longer acquiring
        Since we paid the price to receive it, we might as well stash it in case we need it.
        Nodes are received in wire format and must be stashed/hashed in prefix format
    */
    void gotStaleData (std::shared_ptr<protocol::TMLedgerData> packet_ptr)
    {
        const uint256 uZero;
        Serializer s;
        try
        {
            for (int i = 0; i < packet_ptr->nodes ().size (); ++i)
            {
                auto const& node = packet_ptr->nodes (i);

                if (!node.has_nodeid () || !node.has_nodedata ())
                    return;

                auto newNode = SHAMapAbstractNode::make(
                    Blob (node.nodedata().begin(), node.nodedata().end()),
                    0, snfWIRE, uZero, false);

                if (!newNode)
                    return;

                s.erase();
                newNode->addRaw(s, snfPREFIX);

                auto blob = std::make_shared<Blob> (s.begin(), s.end());

                getApp().getOPs().addFetchPack (newNode->getNodeHash(), blob);
            }
        }
        catch (...)
        {
        }
    }
开发者ID:xdv,项目名称:divvyd,代码行数:36,代码来源:InboundLedgers.cpp

示例9: ConvertFromBase58

Blob ConvertFromBase58(RCString s, bool bCheckHash) {
	BigInteger bi = 0;
	for (const char *p=s; *p; ++p) {
		if (const char *q = strchr(s_pszBase58, *p)) {
			bi = bi*58 + BigInteger(q-s_pszBase58);
		} else
			Throw(errc::invalid_argument);
	}
	vector<byte> v((bi.Length+7)/8);
	bi.ToBytes(&v[0], v.size());
	if (v.size()>=2 && v.end()[-1]==0 && v.end()[-1]>=0x80)
		v.resize(v.size()-1);
	vector<byte> r;
	for (const char *p=s; *p==s_pszBase58[0]; ++p)
		r.push_back(0);
	r.resize(r.size()+v.size());
	std::reverse_copy(v.begin(), v.end(), r.end()-v.size());
	if (r.size() < 4)
		Throw(E_FAIL);
	if (bCheckHash) {
		HashValue hash = HasherEng::GetCurrent()->HashForAddress(ConstBuf(&r[0], r.size()-4));
		if (memcmp(hash.data(), &r.end()[-4], 4))
			Throw(HRESULT_FROM_WIN32(ERROR_CRC));
	}
	return Blob(&r[0], r.size()-4);
}
开发者ID:Groestlcoin,项目名称:Groestlcoin-WPF,代码行数:26,代码来源:base58.cpp

示例10: ConvertFromBase58ShaSquare

Blob ConvertFromBase58ShaSquare(RCString s) {
	BigInteger bi = 0;
	for (const char *p=s; *p; ++p) {
		if (const char *q = strchr(s_pszBase58, *p)) {
			bi = bi*58 + BigInteger(q-s_pszBase58);
		} else
			Throw(E_INVALIDARG);
	}
	vector<byte> v((bi.Length+7)/8);
	bi.ToBytes(&v[0], v.size());
	if (v.size()>=2 && v.end()[-1]==0 && v.end()[-1]>=0x80)
		v.resize(v.size()-1);
	vector<byte> r;
	for (const char *p=s; *p==s_pszBase58[0]; ++p)
		r.push_back(0);
	r.resize(r.size()+v.size());
	std::reverse_copy(v.begin(), v.end(), r.end()-v.size());
	if (r.size() < 4)
		Throw(E_FAIL);
	SHA256 sha;
	HashValue hash = HashValue(sha.ComputeHash(sha.ComputeHash(ConstBuf(&r[0], r.size()-4))));
	if (memcmp(hash.data(), &r.end()[-4], 4))
		Throw(HRESULT_FROM_WIN32(ERROR_CRC));
	return Blob(&r[0], r.size()-4);
}
开发者ID:Groestlcoin,项目名称:Groestlcoin-WPF,代码行数:25,代码来源:base58.cpp

示例11: Win32Check

SecurityDescriptor::SecurityDescriptor(RCString s) {
	PSECURITY_DESCRIPTOR pSD;
	ULONG size;
	Win32Check(::ConvertStringSecurityDescriptorToSecurityDescriptor(s, SDDL_REVISION_1, &pSD, &size));
	m_blob = Blob(pSD, size);
	Win32Check(!::LocalFree(pSD));
}
开发者ID:Groestlcoin,项目名称:el,代码行数:7,代码来源:secdesc.cpp

示例12: msg

void Zoo::RegisterNode() {
  MessagePtr msg(new Message());
  msg->set_src(rank());
  msg->set_dst(kController);
  msg->set_type(MsgType::Control_Register);
  msg->Push(Blob(&nodes_[rank()], sizeof(Node)));
  SendTo(actor::kCommunicator, msg);

  // waif for reply
  mailbox_->Pop(msg);
  CHECK(msg->type() == MsgType::Control_Reply_Register);
  CHECK(msg->data().size() == 2);
  Blob info_blob = msg->data()[0];
  Blob count_blob = msg->data()[1];
  num_workers_ = count_blob.As<int>(0);
  num_servers_ = count_blob.As<int>(1);
  worker_id_to_rank_.resize(num_workers_);
  server_id_to_rank_.resize(num_servers_);
  CHECK(info_blob.size() == size() * sizeof(Node));
  memcpy(nodes_.data(), info_blob.data(), info_blob.size());
  for (auto node : nodes_) {
    if (node.worker_id != -1) {
      worker_id_to_rank_[node.worker_id] = node.rank;
    }
    if (node.server_id != -1) {
      server_id_to_rank_[node.server_id] = node.rank;
    }
  }
  Log::Debug("rank %d end register\n", Zoo::Get()->rank());
}
开发者ID:Microsoft,项目名称:multiverso,代码行数:30,代码来源:zoo.cpp

示例13: wireDecode

 /**
  * Decode the input using a particular wire format and update this Data. If wireFormat is the default wire format, also
  * set the defaultWireEncoding field to a copy of the input. (To not copy the input, see wireDecode(Blob).)
  * @param input The input byte array to be decoded.
  * @param inputLength The length of input.
  * @param wireFormat A WireFormat object used to decode the input. If omitted, use WireFormat getDefaultWireFormat().
  */
 void
 wireDecode
   (const uint8_t* input, size_t inputLength,
    WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
 {
   wireDecode(Blob(input, inputLength), wireFormat);
 }
开发者ID:named-data,项目名称:ndn-cpp,代码行数:14,代码来源:data.hpp

示例14: Blob

void BlobDetector::detect()
{

    double sigmaFirst = data->getSigmaFirst();
    double sigmaStep = data->getSigmaStep();
    for (int oID = 0; oID < data->octavs.size(); oID++)
    {
        //data->octavs[oID]->genDOG();
        double sigma = sigmaFirst*(1<<oID);
        double littlesigma = 1;

        for (int layerID = 1; layerID < data->octavs[oID]->dogs.size()-1; layerID++)
        {
            unique_ptr<HarrisDetector> harrisDetector = make_unique<HarrisDetector>(data->octavs[oID]->layers[layerID].get());
            harrisDetector->configure(0.01,0.06,1);
            ImageMap* img =  data->octavs[oID]->dogs[layerID].get();
            for (int x=0;x<img->getWidth();x++)
            {
                for (int y=0;y<img->getHeight();y++)
                {
                    bool isMax = true;
                    bool isMin = true;
                    double val = img->getData(x,y);//* sigma;
                    if(val<0.031 && val>-0.031) continue;
                    //double ds =  sigma/sigmaStep;
                    //int dl = layerID;
                    for (int dl = layerID-1; dl <= layerID+1; dl++)
                    {
                        ImageMap* img1 =  data->octavs[oID]->dogs[dl].get();
                        for(int dx = x-1; dx <= x+1; dx++)
                        {
                            for(int dy = y-1; dy <= y+1; dy++)
                            {
                                double val1 = img1->getData(dx,dy);//*ds;
                                if (dx != x || dy != y || dl != layerID)
                                {
                                    isMax &= (val1 < val);
                                    isMin &= (val1 > val);
                                }

                            }
                        }
                      //  ds*=sigmaStep;
                    }
                    if (isMax || isMin)
                    {
                        Blob b = Blob(x,y,sigma,val);
                        b.scale = (oID);
                        data->blobs.push_back(b);
                        data->blobs[data->blobs.size()-1].isClone = false;
                        data->descriptors.push_back(harrisDetector->calcDescriptor(littlesigma,&(data->blobs[data->blobs.size()-1])));
                    }
               }
          }
            littlesigma*=sigmaStep;
            sigma*=sigmaStep;
       }
    }
}
开发者ID:smart-frogg,项目名称:image_worker,代码行数:59,代码来源:blobdetector.cpp

示例15: buf

UTF8 JSON::generate(Error& error) const
{
	Buffer buf(0);
	HOutputStream out = NewObject(MemoryOutputStream, buf);
	generate(error, out);
	out->twrite(error,'\0');
	return UTF8(Blob(buf));
}
开发者ID:tomazos,项目名称:Folderscope,代码行数:8,代码来源:JSON.cpp


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