本文整理汇总了C++中std::tr1::shared_ptr::getHash方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::getHash方法的具体用法?C++ shared_ptr::getHash怎么用?C++ shared_ptr::getHash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::tr1::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::getHash方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get
void MeerkatChunkHandler::get(std::tr1::shared_ptr<Chunk> chunk, ChunkCallback callback) {
std::tr1::shared_ptr<DenseData> bad;
if (!chunk) {
SILOG(transfer, error, "HttpChunkHandler get called with null chunk parameter");
callback(bad);
return;
}
//Check to see if it's in the cache first
SharedChunkCache::getSingleton().getCache()->getData(chunk->getHash(), chunk->getRange(), std::tr1::bind(
&MeerkatChunkHandler::cache_check_callback, this, _1, URI("meerkat:///"), chunk, callback));
}
示例2: cache_check_callback
void MeerkatChunkHandler::cache_check_callback(const SparseData* data, const URI& uri,
std::tr1::shared_ptr<Chunk> chunk, ChunkCallback callback) {
if (data) {
mStats.downloaded++;
std::tr1::shared_ptr<const DenseData> flattened = data->flatten();
callback(flattened);
} else {
URL url(uri);
assert(!url.empty());
std::string download_uri_prefix = CDN_DOWNLOAD_URI_PREFIX;
std::string host_name = CDN_HOST_NAME;
Network::Address cdn_addr = mCdnAddr;
if (url.host() != "") {
host_name = url.context().hostname();
std::string service = url.context().service();
if (service == "") {
service = CDN_SERVICE;
}
Network::Address given_addr(host_name, service);
cdn_addr = given_addr;
}
HttpManager::Headers headers;
headers["Host"] = host_name;
headers["Accept-Encoding"] = "deflate, gzip";
bool chunkReq = false;
if(!chunk->getRange().goesToEndOfFile() || chunk->getRange().startbyte() != 0) {
chunkReq = true;
headers["Range"] = "bytes=" + boost::lexical_cast<String>(chunk->getRange().startbyte()) +
"-" + boost::lexical_cast<String>(chunk->getRange().endbyte());
}
HttpManager::getSingleton().get(
cdn_addr, download_uri_prefix + "/" + chunk->getHash().convertToHexString(),
std::tr1::bind(&MeerkatChunkHandler::request_finished, this, _1, _2, _3, uri, chunk, chunkReq, callback),
headers
);
}
}