int main(int argc, char **argv) { if (argc != 2) { printf("\n" " Usage :\n" " ./ktartest /path/to/existing_file.tar.gz tests listing an existing tar.gz\n"); return 1; } KRcc rcc(argv[1]); if (!rcc.open(QIODevice::ReadOnly)) { printf("Could not open %s for reading\n", argv[1]); return 1; } const KArchiveDirectory *dir = rcc.directory(); //printf("calling recursive_print\n"); recursive_print(dir, ""); //printf("recursive_print called\n"); rcc.close(); return 0; }
int IndexedPointInAreaLocator::locate( const geom::Coordinate * /*const*/ p) { algorithm::RayCrossingCounter rcc(*p); IndexedPointInAreaLocator::SegmentVisitor visitor( &rcc); index->query( p->y, p->y, &visitor); return rcc.getLocation(); }
/*static*/ int RayCrossingCounterDD::locatePointInRing(const geom::Coordinate& point, const std::vector<const geom::Coordinate*>& ring) { RayCrossingCounterDD rcc(point); for (std::size_t i = 1, ni = ring.size(); i < ni; i++) { const geom::Coordinate & p1 = *ring[ i - 1 ]; const geom::Coordinate & p2 = *ring[ i ]; rcc.countSegment(p1, p2); if (rcc.isOnSegment()) return rcc.getLocation(); } return rcc.getLocation(); }
void KArchiveTest::testRcc() { const QString rccFile = QFINDTESTDATA("runtime_resource.rcc"); // was copied from qtbase/tests/auto/corelib/io/qresourceengine QVERIFY(!rccFile.isEmpty()); KRcc rcc(rccFile); QVERIFY(rcc.open(QIODevice::ReadOnly)); const KArchiveDirectory *rootDir = rcc.directory(); QVERIFY(rootDir != nullptr); const KArchiveEntry *rrEntry = rootDir->entry(QStringLiteral("runtime_resource")); QVERIFY(rrEntry && rrEntry->isDirectory()); const KArchiveDirectory *rrDir = static_cast<const KArchiveDirectory *>(rrEntry); const KArchiveEntry *fileEntry = rrDir->entry(QStringLiteral("search_file.txt")); QVERIFY(fileEntry && fileEntry->isFile()); const KArchiveFile *searchFile = static_cast<const KArchiveFile *>(fileEntry); const QByteArray fileData = searchFile->data(); QCOMPARE(QString::fromLatin1(fileData), QString::fromLatin1("root\n")); }
// // public: // /*static*/ int RayCrossingCounter::locatePointInRing(const geom::Coordinate& point, const geom::CoordinateSequence& ring) { RayCrossingCounter rcc(point); for (int i = 1, ni = ring.size(); i < ni; i++) { const geom::Coordinate & p1 = ring[ i ]; const geom::Coordinate & p2 = ring[ i - 1 ]; rcc.countSegment(p1, p2); if ( rcc.isOnSegment() ) return rcc.getLocation(); } return rcc.getLocation(); }
RedisCacheClientPtr ClientFactory::GetRedisCacheClient(const std::string& zk_address) { MCE_INFO("ClientFactory::GetRedisCacheClient() zk_address:" + zk_address); std::map<std::string, RedisCacheClientPtr>::iterator find_it; { boost::shared_lock<boost::shared_mutex> lock(redis_cache_client_map_lock_); find_it = redis_cache_client_map_.find(zk_address); if( find_it != redis_cache_client_map_.end() ){ return find_it->second; } } { boost::upgrade_lock<boost::shared_mutex> lock(redis_cache_client_map_lock_); boost::upgrade_to_unique_lock<boost::shared_mutex> uniqueLock1(lock); find_it = redis_cache_client_map_.find(zk_address); if( find_it != redis_cache_client_map_.end() ){ return find_it->second; } RedisCacheClientPtr rcc(new RedisCacheClient(zk_address)); redis_cache_client_map_.insert(std::make_pair(zk_address, rcc)); MCE_INFO("ClientFactory::getRedisCacheClient init new RedisCacheClient for zk_address " << zk_address); return rcc; } }