这篇教程C++ Blob函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Blob函数的典型用法代码示例。如果您正苦于以下问题:C++ Blob函数的具体用法?C++ Blob怎么用?C++ Blob使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Blob函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CHECKvoid 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,
示例2: whilebool 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,
示例3: BlobBlob Object::toBlob() const{ if(isBlob()) return Blob(*this); else return Blob();}
开发者ID:balooloo,项目名称:libgit2pp,代码行数:7,
示例4: Blobvoid 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,
示例5: FamilySizeBlob 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,
示例6: ThrowBlob 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,
示例7: ASSERTBlob 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,
示例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,
示例9: ConvertFromBase58Blob 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,
示例10: ConvertFromBase58ShaSquareBlob 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,
示例11: Win32CheckSecurityDescriptor::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,
示例12: msgvoid 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,
示例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,
示例14: Blobvoid 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,
示例15: bufUTF8 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,
示例16: BlobBlobs::Blobs(int howMany) { total = howMany; blobs = (Blob*)malloc(sizeof(Blob) * howMany); for (int i = 0; i < howMany; i++) { blobs[i] = Blob(); } init();}
开发者ID:WangHanbin,项目名称:nbites,代码行数:8,
示例17: mainint main( int argc, char **argv){ OPEN_LOG("check_signature", LOG_USER); if (argc != 3) FATAL(MSG_USAGE); struct Certificate locert, hicert; struct CertificateRevocationList crl; Certificate(&locert, (ushort) 0); Certificate(&hicert, (ushort) 0); CertificateRevocationList(&crl, (ushort) 0); struct Blob blob; Blob(&blob, (ushort) 0); struct casn *tbsp, *sigp; struct AlgorithmIdentifier *algp; char *sfx = strchr(argv[1], (int)'.'); int ansr; if (!strcmp(sfx, ".cer")) { tbsp = &locert.toBeSigned.self; algp = &locert.algorithm; sigp = &locert.signature; ansr = get_casn_file(&locert.self, argv[1], 0); } else if (!strcmp(sfx, ".crl")) { tbsp = &crl.toBeSigned.self; algp = &crl.algorithm; sigp = &crl.signature; ansr = get_casn_file(&crl.self, argv[1], 0); } else if (!strcmp(sfx, ".blb")) { tbsp = &blob.toBeSigned; algp = &blob.algorithm; sigp = &blob.signature; ansr = get_casn_file(&blob.self, argv[1], 0); } else FATAL(MSG_TYPE, argv[1]); if (ansr < 0) FATAL(MSG_GET, argv[1]); if (get_casn_file(&hicert.self, argv[2], 0) < 0) FATAL(MSG_GET, argv[2]); if (diff_objid(&algp->algorithm, id_sha_256WithRSAEncryption)) { char oidbuf[80]; read_objid(&algp->algorithm, oidbuf); FATAL(MSG_ALG, oidbuf); } if (!check_signature(tbsp, &hicert, sigp)) fprintf(stderr, "Signature failed/n"); fprintf(stderr, "Signature succeeded/n"); return 0;}
开发者ID:dseomn,项目名称:rpstir,代码行数:58,
示例18: runtime_errorvoidDigestSha256Signature::set(const struct ndn_Signature& signatureStruct){ // The caller should already have checked the type, but check again. if (signatureStruct.type != ndn_SignatureType_DigestSha256Signature) throw runtime_error("signatureStruct is not the expected type DigestSha256Signature"); setSignature(Blob(signatureStruct.signature));}
开发者ID:susmit85,项目名称:ndn-cpp,代码行数:9,
示例19: Sec256CheckBlob Sec256Dsa::DecompressPubKey(RCSpan cbuf) { uint8_t buf[65]; size_t pubkeylen = 65; secp256k1_ge Q; Sec256Check(::secp256k1_eckey_pubkey_parse(&Q, cbuf.data(), cbuf.size()) && ::secp256k1_eckey_pubkey_serialize(&Q, buf, &pubkeylen, false)); return Blob(buf, pubkeylen);}
开发者ID:ufasoft,项目名称:coin,代码行数:9,
示例20: strUnHexstd::pair<Blob, bool> strUnHex (std::string const& strSrc){ std::string strTmp; if (strUnHex (strTmp, strSrc) == -1) return std::make_pair (Blob (), false); return std::make_pair(strCopy (strTmp), true);}
开发者ID:CFQuantum,项目名称:CFQuantumd,代码行数:9,
示例21: THROW_EXCEPTION/** * @internal * @brief Find the blobs in the received image. * What it looks for in an image is bright areas, so typically * the image result of a background subtraction is a good input. * * @param[in] inImage image where the blobs will be searched */void BlobFinder::update( const Image& inImage ){ // Check valid if ( !isValid() ) THROW_EXCEPTION( "Trying to compute blobs, with the BlobFinder not initialized. Init method should be called" ); // Check blob area... and if it has not been set, set it to the max and min (no lower than 10, to avoid opencv issues) if ( (m_minBlobArea < 0) || (m_maxBlobArea < 0) ) { m_minBlobArea = 10; m_maxBlobArea = (float)inImage.getWidth() * (float)inImage.getHeight(); } // Check both images have same size and it is the same than the filter size if( (inImage.getNChannels() != 1) && (inImage.getNChannels() != 3) ) THROW_EXCEPTION( "Trying to compute blobs on images with non supporte format -> only RGB or GRAYSCALE images supported" ); // Request temp image to work with IplImage* cvTempImage = ImageResourceManager::getSingleton().getImage( inImage.getWidth(), inImage.getHeight(), 1 ); // If they have different number of channels -> convert them if ( inImage.getNChannels() == 3 ) cvConvertImage( &inImage.getCVImage(), cvTempImage ); // just one channel -> Copy the input image else cvCopy( &inImage.getCVImage(), cvTempImage ); // Find blobs (openCV contours) int retrivalMode = CV_RETR_EXTERNAL; // CV_RETR_CCOMP cvFindContours( cvTempImage, m_findContoursStorage, &m_contour, sizeof(CvContour), retrivalMode, CV_CHAIN_APPROX_SIMPLE ); // Extract found contours // Iterate through found contours and store them.. m_blobs.clear(); for( ; m_contour != 0; m_contour = m_contour->h_next ) { // Get contour area double area = fabs( cvContourArea( m_contour, CV_WHOLE_SEQ ) ); // If it has a good size (between min and max) if ( ( area > m_maxBlobArea ) || ( area < m_minBlobArea ) ) continue; // Store new Blob m_blobs.push_back( Blob( area, m_contour ) ); } // Release temp image ImageResourceManager::getSingleton().releaseImage( cvTempImage ); // Extract information of found blobs extractBlobsInformation(); // Clear OpenCV contours storage cvClearMemStorage( m_findContoursStorage );}
开发者ID:space150,项目名称:space150-Cing,代码行数:65,
示例22: Blob/*- FUNCTION: GetNthBlob- FUNCTIONALITY: Gets the n-th blob ordering first the blobs with some criteria- PARAMETERS: - criteri: criteria to order the blob array - nBlob: index of the returned blob in the ordered blob array - dst: where to store the result- RESULT:- RESTRICTIONS:- AUTHOR: Ricard Borr C++ BlockMoveData函数代码示例 C++ Bloaded函数代码示例
|