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


C++ Extent类代码示例

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


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

示例1: while

string Namespace::getData()
{
	string data = "{\"docs\":[";
	DiskLoc nextExtentLoc = firstExtentLoc;
	while (!nextExtentLoc.isNull())
	{
		Extent* extent = db->getExtent(nextExtentLoc);
		int nextRecordOffset = extent->firstRecord;
		while (nextRecordOffset != -1)
		{
			Record* record = extent->getRecord(nextRecordOffset);
			//LOGI(record->data);
			data.append(record->data);

			nextRecordOffset = record->nextRecLoc;

			if (nextRecordOffset != -1)
				data.append(",");
		}

		nextExtentLoc = extent->nextExtent;
	}
	data.append("]}");
	return data;
}
开发者ID:vamitrou,项目名称:JSONDroid,代码行数:25,代码来源:Namespace.cpp

示例2: getCachedExtent

void BSplineSelection::getExtent (float& l, float& b, float& cx, float& cy,
float& tol, Graphic* gs) {
    Extent e;
    if (extentCached()) {
	getCachedExtent(e.left, e.bottom, e.cx, e.cy, e.tol);
    } else {
	FullGraphic gstmp;
	concatGSGraphic(ifillbspline, this, gs, &gstmp);
	getExtentGraphic(
            ifillbspline, e.left, e.bottom, e.cx, e.cy, e.tol, &gstmp
        );
	Extent te;
	concatGSGraphic(bspline, this, gs, &gstmp);
	getExtentGraphic(
            bspline, te.left, te.bottom, te.cx, te.cy, te.tol, &gstmp
        );
	e.Merge(te);
	cacheExtent(e.left, e.bottom, e.cx, e.cy, e.tol);
    }
    float right = 2*e.cx - e.left;
    float top = 2*e.cy - e.bottom;
    float dummy = 0;
    transformRect(e.left, e.bottom, right, top, l, b, dummy, dummy, gs);
    transform(e.cx, e.cy, cx, cy, gs);
    tol = MergeArrowHeadTol(e.tol, gs);
}
开发者ID:axelmuhr,项目名称:Helios-NG,代码行数:26,代码来源:slsplines.c

示例3: getextent_gs

void PolyGraphic::getextent_gs (
    Coord& l, Coord& b, Coord& cx, Coord& cy, float& tol, Graphic31* gs
) {
    Extent e;
    l = b = cx = cy = tol = 0.0;
        
    Graphic31 gstemp;
    Transformer ttemp;
    Extent te;
    gstemp.transformer(&ttemp);

    GlyphIndex count = _body->count();
    for (GlyphIndex i = 0; i < count; i++) {
        Graphic31* gr = (Graphic31*) _body->component(i);
        
        concatgs_(gr, gr, gs, &gstemp);
        concatXform_(gr, nil, gr->transformer(), &ttemp);
        getextent_(gr, te._left, te._bottom, te._cx, te._cy, te._tol, &gstemp);
        e.Merge(te);
    }
    gstemp.transformer(nil); // to avoid deleting ttemp explicitly
    l = e._left; b = e._bottom; cx = l+(e._cx-l)*2.0; cy = b+(e._cy-b)*2.0;
    tol = e._tol;

    Transformer* tx = gs->transformer();
    if (tx != nil) {
        corners(l, b, cx, cy, *tx);
    }
    cx = (cx + l)/2.0;
    cy = (cy + b)/2.0;
}
开发者ID:jmzaleski,项目名称:ivtools-1.2,代码行数:31,代码来源:figure.c

示例4: isCapped

    void RecordStoreV1Base::increaseStorageSize( TransactionExperiment* txn,
                                                 int size,
                                                 int quotaMax ) {
        DiskLoc eloc = _extentManager->allocateExtent( txn,
                                                       _ns,
                                                       isCapped(),
                                                       size,
                                                       quotaMax );

        Extent *e = _extentManager->getExtent( eloc, false );

        invariant( e );

        DiskLoc emptyLoc = e->reuse(txn,  _ns, isCapped() );

        if ( _details->lastExtent().isNull() ) {
            verify( _details->firstExtent().isNull() );
            _details->setFirstExtent( txn, eloc );
            _details->setLastExtent( txn, eloc );
            _details->setCapExtent( txn, eloc );
            verify( e->xprev.isNull() );
            verify( e->xnext.isNull() );
        }
        else {
            verify( !_details->firstExtent().isNull() );
            *txn->writing(&e->xprev) = _details->lastExtent();
            *txn->writing(&_extentManager->getExtent(_details->lastExtent())->xnext) = eloc;
            _details->setLastExtent( txn, eloc );
        }

        _details->setLastExtentSize( txn, e->length );

        addDeletedRec(txn, emptyLoc);
    }
开发者ID:CICCIOSGAMINO,项目名称:mongo,代码行数:34,代码来源:record_store_v1_base.cpp

示例5: forward

    /* get a table scan cursor, but can be forward or reverse direction.
       order.$natural - if set, > 0 means forward (asc), < 0 backward (desc).
    */
    shared_ptr<Cursor> findTableScan(const char *ns, const BSONObj& order, const DiskLoc &startLoc) {
        BSONElement el = order.getField("$natural"); // e.g., { $natural : -1 }

        if ( el.number() >= 0 )
            return DataFileMgr::findAll(ns, startLoc);

        // "reverse natural order"
        NamespaceDetails *d = nsdetails(ns);

        if ( !d )
            return shared_ptr<Cursor>(new BasicCursor(DiskLoc()));

        if ( !d->isCapped() ) {
            if ( !startLoc.isNull() )
                return shared_ptr<Cursor>(new ReverseCursor( startLoc ));
            Extent *e = d->lastExtent().ext();
            while ( e->lastRecord.isNull() && !e->xprev.isNull() ) {
                OCCASIONALLY out() << "  findTableScan: extent empty, skipping ahead" << endl;
                e = e->getPrevExtent();
            }
            return shared_ptr<Cursor>(new ReverseCursor( e->lastRecord ));
        }
        else {
            return shared_ptr<Cursor>( new ReverseCappedCursor( d, startLoc ) );
        }
    }
开发者ID:ChrisKozak,项目名称:mongo,代码行数:29,代码来源:pdfile.cpp

示例6: _getOpenFile

 Extent* MmapV1ExtentManager::getExtent( const DiskLoc& loc, bool doSanityCheck ) const {
     loc.assertOk();
     Extent* e = reinterpret_cast<Extent*>( _getOpenFile( loc.a() )->p() + loc.getOfs() );
     if ( doSanityCheck )
         e->assertOk();
     return e;
 }
开发者ID:vigneshncc,项目名称:mongo,代码行数:7,代码来源:mmap_v1_extent_manager.cpp

示例7: _repairExtent

    DiskLoc _repairExtent( Database* db , string ns, bool forward , DiskLoc eLoc ){
        LogIndentLevel lil;
        
        if ( eLoc.getOfs() <= 0 ){
            error() << "invalid extent ofs: " << eLoc.getOfs() << endl;
            return DiskLoc();
        }
        

        MongoDataFile * mdf = db->getFile( eLoc.a() );

        Extent * e = mdf->debug_getExtent( eLoc );
        if ( ! e->isOk() ){
            warning() << "Extent not ok magic: " << e->magic << " going to try to continue" << endl;
        }
        
        log() << "length:" << e->length << endl;
        
        LogIndentLevel lil2;
        
        DiskLoc loc = forward ? e->firstRecord : e->lastRecord;
        while ( ! loc.isNull() ){
            if ( loc.getOfs() <= 0 ){
                error() << "offset is 0 for record which should be impossible" << endl;
                break;
            }
            log() << loc << endl;
            Record* rec = loc.rec();
            log() << loc.obj() << endl;
            loc = forward ? rec->getNext( loc ) : rec->getPrev( loc );
        }
        return forward ? e->xnext : e->xprev;
        
    }
开发者ID:BendustiK,项目名称:mongo,代码行数:34,代码来源:dump.cpp

示例8: json_to_bson

void Namespace::insert(const char* str)
{

	int count = 0;

	bson** bs = json_to_bson(str, count);

	Extent* lastExtent = getLastExtent();
	int success = 0;
	for (int i(0); i < count; i++)
	{
		success = lastExtent->addRecord(bs[i]);

		while (success != 0)
		{
			db->attachExtent(this);

			lastExtent = getLastExtent();
			success = lastExtent->addRecord(bs[i]);
		}

		free(bs[i]);
	}
	free(bs);
}
开发者ID:vamitrou,项目名称:JSONDroid,代码行数:25,代码来源:Namespace.cpp

示例9: Extent

Extent *Extent::create(Iff & iff)
{
	Extent * extent = new Extent();

	extent->load(iff);

	return extent;
}
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:8,代码来源:Extent.cpp

示例10: Nothing

Sawyer::Optional<rose_addr_t>
MemoryMap::findAny(const Extent &limits, const std::vector<uint8_t> &bytesToFind,
                   unsigned requiredPerms, unsigned prohibitedPerms) const {
    if (limits.empty() || bytesToFind.empty())
        return Sawyer::Nothing();
    AddressInterval interval = AddressInterval::hull(limits.first(), limits.last());
    return findAny(interval, bytesToFind, requiredPerms, prohibitedPerms);
}
开发者ID:cuviper,项目名称:dyninst,代码行数:8,代码来源:MemoryMap.C

示例11: dumpExtents

 void NamespaceDetails::dumpExtents() {
     cout << "dumpExtents:" << endl;
     for ( DiskLoc i = _firstExtent; !i.isNull(); i = i.ext()->xnext ) {
         Extent *e = i.ext();
         stringstream ss;
         e->dump(ss);
         cout << ss.str() << endl;
     }
 }
开发者ID:4commerce-technologies-AG,项目名称:mongo,代码行数:9,代码来源:cap.cpp

示例12: invariant

 Extent* DummyExtentManager::getExtent( const DiskLoc& loc, bool doSanityCheck ) const {
     invariant( !loc.isNull() );
     invariant( static_cast<size_t>( loc.a() ) < _extents.size() );
     invariant( loc.getOfs() == 0 );
     Extent* ext = reinterpret_cast<Extent*>( _extents[loc.a()].data );
     if (doSanityCheck)
         ext->assertOk();
     return ext;
 }
开发者ID:DesignByOnyx,项目名称:mongo,代码行数:9,代码来源:record_store_v1_test_help.cpp

示例13: LOGI

char* Namespace::getNextRecordData(int &recordSize)
{
	Record *rec;

	if (extentCursor.isNull()) // the first time after connection the extent cursor will be null
	{
		extentCursor = firstExtentLoc; // so, get the first extent of the colection
		if (_DEBUG)
			LOGI("getting first extent");
	}

	if (extentCursor.isNull()) // if first extent is null, then no extents exist
		return NULL;  // no extents

	Extent* extent = db->getExtent(extentCursor);

	if (recordCursor == -1)	// the first time the record cursor will be null as well
	{
		recordCursor = extent->firstRecord;	// get the first record of the extent

		if (recordCursor == -1)	// if first record is null, then no records exist
			return NULL;  // no records

		rec = extent->getRecord(recordCursor);
	}
	else // else, the cursor shows the previous record, should take the next one and return its data
	{
		rec = extent->getRecord(recordCursor);

		if (rec->nextRecLoc == -1) // if its next record is null, then go to next extent
		{
			if (extent->nextExtent.isNull()) // if the next extent is null, then no more extents
			{
				return NULL;  // no more records
			}
			else							// proceed with the next extent
			{
				extentCursor = extent->nextExtent;
				recordCursor = -1;
				return getNextRecordData(recordSize);
			}
		}
		else
		{
			recordCursor = rec->nextRecLoc;	// next record exists, so put the cursor on it
			if (_DEBUG)
				LOGI("getting next record");
			rec = extent->getRecord(recordCursor);
		}
	}

	int bsonSize = 0;
	bson_little_endian32( &bsonSize, rec->data);
	char *val = (char*) malloc((bsonSize + 128) * sizeof(char));
	int cur = 0;
	return bson_to_json(val, rec->data, 0, true, 0, recordSize, cur);
}
开发者ID:vamitrou,项目名称:JSONDroid,代码行数:57,代码来源:Namespace.cpp

示例14: firstExtent

 virtual void firstExtent(const Extent &e) {
     series.setType(e.getTypePtr());
     const ExtentType::Ptr extent_type(e.getTypePtr());
     fields.reserve(extent_type->getNFields());
     for (uint32_t i = 0; i < extent_type->getNFields(); ++i) {
         string field_name(extent_type->getFieldName(i));
         fields.push_back(GeneralField::make(series, field_name));
         into.columns.push_back(TableColumn(field_name, 
                                            extent_type->getFieldTypeStr(field_name)));
     }
     into.__isset.columns = true;
 }
开发者ID:dataseries,项目名称:DataSeries,代码行数:12,代码来源:TableDataModule.cpp

示例15: mandelbrot_cpu_seq

void mandelbrot_cpu_seq(Extent ext, int* dest, const int max_iter, Rectangle mi)
{
	for (int y = 0; y < ext.get_height(); y++)
	{
		for (int x = 0; x < ext.get_width(); x++)
		{
			const int i = ext.checked_index(x, y);
			const float x0 = scale(x, ext.get_width(), mi.x0, mi.x1);
			const float y0 = scale(y, ext.get_height(), mi.y0, mi.y1);
			dest[i] = mandelbrot(x0, y0, max_iter);
		}
	}
}
开发者ID:jdinkla,项目名称:parallel2014_gpucomputing,代码行数:13,代码来源:MandelbrotCPU.cpp


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