本文整理汇总了C++中std::tr1::shared_ptr::getFingerprint方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::getFingerprint方法的具体用法?C++ shared_ptr::getFingerprint怎么用?C++ shared_ptr::getFingerprint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::tr1::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::getFingerprint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get
void MeerkatChunkHandler::get(std::tr1::shared_ptr<RemoteFileMetadata> file,
std::tr1::shared_ptr<Chunk> chunk, ChunkCallback callback) {
//Check for null arguments
std::tr1::shared_ptr<DenseData> bad;
if (!file) {
SILOG(transfer, error, "HttpChunkHandler get called with null file parameter");
callback(bad);
return;
}
if (!chunk) {
SILOG(transfer, error, "HttpChunkHandler get called with null chunk parameter");
callback(bad);
return;
}
//Make sure chunk given is part of file
bool foundIt = false;
const ChunkList & chunks = file->getChunkList();
for (ChunkList::const_iterator it = chunks.begin(); it != chunks.end(); it++) {
if(*chunk == *it) {
foundIt = true;
}
}
if(!foundIt) {
SILOG(transfer, error, "HttpChunkHandler get called with chunk not present in file metadata");
callback(bad);
return;
}
//Check to see if it's in the cache first
SharedChunkCache::getSingleton().getCache()->getData(file->getFingerprint(), chunk->getRange(), std::tr1::bind(
&MeerkatChunkHandler::cache_check_callback, this, _1, file->getURI(), chunk, callback));
}
示例2: onReadFinished
void FileChunkHandler::onReadFinished(std::tr1::shared_ptr<DenseData> fileContents, std::tr1::shared_ptr<RemoteFileMetadata> file,
std::tr1::shared_ptr<Chunk> chunk, ChunkCallback callback) {
mStats.downloaded++;
std::tr1::shared_ptr<DenseData> bad;
if (!fileContents) {
SILOG(transfer, error, "FileChunkHandler couldn't find file '" << file->getURI() << "'");
callback(bad);
return;
}
SharedChunkCache::getSingleton().getCache()->addToCache(file->getFingerprint(), fileContents);
callback(fileContents);
}