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


C++ reference函数代码示例

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


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

示例1: QwtDoubleInterval

/*!
   \brief Calculate a scale division

   \param x1 First interval limit 
   \param x2 Second interval limit 
   \param maxMajSteps Maximum for the number of major steps
   \param maxMinSteps Maximum number of minor steps
   \param stepSize Step size. If stepSize == 0, the scaleEngine
                   calculates one.

   \sa QwtScaleEngine::stepSize, QwtLog10ScaleEngine::subDivide
*/
QwtScaleDiv QwtLog10ScaleEngine::divideScale(double x1, double x2,
    int maxMajSteps, int maxMinSteps, double stepSize) const
{
    QwtDoubleInterval interval = QwtDoubleInterval(x1, x2).normalized();
    interval = interval.limited(LOG_MIN, LOG_MAX);

    if (interval.width() <= 0 )
        return QwtScaleDiv();

    if (interval.maxValue() / interval.minValue() < 10.0)
    {
        // scale width is less than one decade -> build linear scale
    
        QwtLinearScaleEngine linearScaler;
        linearScaler.setAttributes(attributes());
        linearScaler.setReference(reference());
        linearScaler.setMargins(loMargin(), hiMargin());

        return linearScaler.divideScale(x1, x2, 
            maxMajSteps, maxMinSteps, stepSize);
    }

    stepSize = qwtAbs(stepSize);
    if ( stepSize == 0.0 )
    {
        if ( maxMajSteps < 1 )
            maxMajSteps = 1;

        stepSize = divideInterval(log10(interval).width(), maxMajSteps);
        if ( stepSize < 1.0 )
            stepSize = 1.0; // major step must be >= 1 decade
    }

    QwtScaleDiv scaleDiv;
    if ( stepSize != 0.0 )
    {
        QwtValueList ticks[QwtScaleDiv::NTickTypes];
        buildTicks(interval, stepSize, maxMinSteps, ticks);

        scaleDiv = QwtScaleDiv(interval, ticks);
    }

    if ( x1 > x2 )
        scaleDiv.invert();

    return scaleDiv;
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:59,代码来源:qwt_scale_engine.cpp

示例2: labellingErrors

	void labellingErrors(CArrayF& activs, CArrayI& seqLengths, int idx, CArrayI& labellings, ArrayI& lev)
	{
		nLabelsInclBlank_ = activs.dim(2);
        blankIdx_ = nLabelsInclBlank_ - 1;
		T_ = seqLengths(idx);
		int len = calcLen(labellings, idx);
				        
	    std::vector<int> labelling = label(activs, idx);        
	    std::vector<int> reference(len);
	    for(int i = 0; i < len; ++i)
	    {
	        reference[i] = labellings(idx, i);
	    }
	    
	    int dist = levenshteinDist(labelling, reference);
	    lev(idx) = dist;
	}
开发者ID:atuxhe,项目名称:returnn,代码行数:17,代码来源:BestPathDecoder.cpp

示例3: jamEntry

void 
Cmvmi::execREAD_CONFIG_REQ(Signal* signal)
{
  jamEntry();

  const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr();

  Uint32 ref = req->senderRef;
  Uint32 senderData = req->senderData;

  const ndb_mgm_configuration_iterator * p = 
    m_ctx.m_config.getOwnConfigIterator();
  ndbrequire(p != 0);

  Uint64 page_buffer = 64*1024*1024;
  ndb_mgm_get_int64_parameter(p, CFG_DB_DISK_PAGE_BUFFER_MEMORY, &page_buffer);
  
  Uint32 pages = 0;
  pages += page_buffer / GLOBAL_PAGE_SIZE; // in pages
  pages += LCP_RESTORE_BUFFER;
  m_global_page_pool.setSize(pages + 64, true);
  
  Uint64 shared_mem = 8*1024*1024;
  ndb_mgm_get_int64_parameter(p, CFG_DB_SGA, &shared_mem);
  shared_mem /= GLOBAL_PAGE_SIZE;
  if (shared_mem)
  {
    Resource_limit rl;
    rl.m_min = 0;
    rl.m_max = shared_mem;
    rl.m_resource_id = 0;
    m_ctx.m_mm.set_resource_limit(rl);
  }
  
  ndbrequire(m_ctx.m_mm.init());
  {
    void* ptr = m_ctx.m_mm.get_memroot();
    m_shared_page_pool.set((GlobalPage*)ptr, ~0);
  }
  
  ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
  conf->senderRef = reference();
  conf->senderData = senderData;
  sendSignal(ref, GSN_READ_CONFIG_CONF, signal, 
	     ReadConfigConf::SignalLength, JBB);
}
开发者ID:Abner-Sun,项目名称:mysql5.1-vx-pre1,代码行数:46,代码来源:Cmvmi.cpp

示例4: main

int main(int argc, char *argv[])
{
    myName = argv[0];

    if (argc <= 1) {
        printUsage();
        exit(-1);
    }

    if (strcmp("diff", argv[1]) == 0 || strcmp("diffSigned", argv[1]) == 0) {
        diffFlow(argc, argv);
    } else if (strcmp("ref", argv[1]) == 0) {
        reference().save("reference.png");
    } else {
        colourizeFlow(argc, argv);
    }
}
开发者ID:Eric013,项目名称:slowmoVideo,代码行数:17,代码来源:visualizeFlow.cpp

示例5: testAddHeaderAndTagToFile

void testAddHeaderAndTagToFile(const char* inputName, const char* outputName)
{
    SamFile inSam, outSam;
    assert(inSam.OpenForRead(inputName));
    assert(outSam.OpenForWrite(outputName));

    // Read the SAM Header.
    SamFileHeader samHeader;
    assert(inSam.ReadHeader(samHeader));

    // Add a header line.
    assert(samHeader.addHeaderLine("@RG\tID:myID\tSM:mySM") == false);
    assert(samHeader.addHeaderLine("@RG\tID:myID3\tSM:mySM") == true);

    // Write Header
    assert(outSam.WriteHeader(samHeader));

    SamRecord samRecord;
    assert(inSam.ReadRecord(samHeader, samRecord));
    //   validateRead1(samRecord);
    // Add two tags.
    assert(samRecord.addIntTag("XA", 123));
    assert(samRecord.addIntTag("XA", 456));
    assert(samRecord.addTag("RR", 'Z', "myID1"));
    assert(samRecord.addTag("RR", 'Z', "myID2"));

    // Write as Sam.
    assert(outSam.WriteRecord(samHeader, samRecord));

    // TODO, add test to verify it was written correctly.

    // Read a couple of records to make sure it properly can read them even
    // if they are bigger than the original.
    assert(inSam.ReadRecord(samHeader, samRecord));
    assert(inSam.ReadRecord(samHeader, samRecord));

    //  Check the MD tag, which requires the reference.
    GenomeSequence reference("testFiles/chr1_partial.fa");
    assert(SamTags::isMDTagCorrect(samRecord, reference) == false);
    String newMDTag;
    SamTags::createMDTag(newMDTag, samRecord, reference);
    assert(newMDTag == "2T1N0");
    assert(SamTags::updateMDTag(samRecord, reference));
    // Write as Sam.
    assert(outSam.WriteRecord(samHeader, samRecord));
}
开发者ID:narisu,项目名称:gotcloud,代码行数:46,代码来源:ReadFiles.cpp

示例6: dolock

void *DL_PREFIX(dlopen)(const char *path, int mode)
{
	const struct stat *sbuf;
	struct dlstatus *dls;
	const char *fullPath;

	dolock();
	resetdlerror();
	if (!path)
	{
		dls = &mainStatus;
		goto dlopenok;
	}
	if (!(sbuf = findFile(path, &fullPath)))
	{
		error("file \"%s\" not found", path);
		goto dlopenerror;
	}
	/* Now checks that it hasn't been closed already */
	if ((dls = lookupStatus(sbuf)) && (dls->refs > 0))
	{
		/* debug("status found"); */
		dls = reference(dls, mode);
		goto dlopenok;
	}
#ifdef 	RTLD_NOLOAD
	if (isFlagSet(mode, RTLD_NOLOAD))
	{
		error("no existing handle and RTLD_NOLOAD specified");
		goto dlopenerror;
	}
#endif
	if (isFlagSet(mode, RTLD_LAZY) && isFlagSet(mode, RTLD_NOW))
	{
		error("how can I load something both RTLD_LAZY and RTLD_NOW?");
		goto dlopenerror;
	}
	dls = loadModule(fullPath, sbuf, mode);
	
  dlopenok:
	dounlock();
	return (void *)dls;
  dlopenerror:
	dounlock();
	return NULL;
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:46,代码来源:dlfcn.c

示例7: reference

void
DbgdmProxy::sendTC_SCHVERCONF(Signal* signal, Uint32 ssId)
{
  Ss_TC_SCHVERREQ& ss = ssFind<Ss_TC_SCHVERREQ>(ssId);
  BlockReference dictRef = ss.m_req.senderRef;

  if (!lastReply(ss))
    return;

  TcSchVerConf* conf = (TcSchVerConf*)signal->getDataPtrSend();
  conf->senderRef = reference();
  conf->senderData = ss.m_req.senderData;
  sendSignal(dictRef, GSN_TC_SCHVERCONF,
             signal, TcSchVerConf::SignalLength, JBB);

  ssRelease<Ss_TC_SCHVERREQ>(ssId);
}
开发者ID:ForcerKing,项目名称:ShaoqunXu-mysql5.7,代码行数:17,代码来源:DbgdmProxy.cpp

示例8: getPropertiesFromCIMServer

void getPropertiesFromCIMServer(
    CIMClient& client,
    const CIMName& propName,
    Array <String>& propValues)
{
    CIMProperty prop;

    Array<CIMKeyBinding> kbArray;
    CIMKeyBinding        kb;
    String               _hostName;

    kb.setName(PROPERTY_NAME);
    kb.setValue(propName.getString());
    kb.setType(CIMKeyBinding::STRING);

    _hostName.assign(System::getHostName());

    kbArray.append(kb);

    CIMObjectPath reference(_hostName, PEGASUS_NAMESPACENAME_CONFIG,
                            PEGASUS_CLASSNAME_CONFIGSETTING, kbArray);

    CIMInstance cimInstance = client.getInstance(PEGASUS_NAMESPACENAME_CONFIG,
                                                 reference);

    Uint32 pos = cimInstance.findProperty(PROPERTY_NAME);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

    pos = cimInstance.findProperty(DEFAULT_VALUE);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

    pos = cimInstance.findProperty(CURRENT_VALUE);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

    pos = cimInstance.findProperty(PLANNED_VALUE);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

    pos = cimInstance.findProperty(DYNAMIC_PROPERTY);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

}
开发者ID:rdobson,项目名称:openpegasus,代码行数:46,代码来源:TestAggregationOutputClient.cpp

示例9: main

int
main(void) {

	value();
	printf("\n\n");
	reference();

	printf("\n\n");

	char array[] = "oitate";
	call_by_array(array);
	call_by_array_refer(array);

	struct structure str = {99, "oitate"};
	
	return 0;

}
开发者ID:EdwardYuan,项目名称:linux,代码行数:18,代码来源:method.c

示例10: dense_storage_copy

void dense_storage_copy()
{
  static const int Size = ((Rows==Dynamic || Cols==Dynamic) ? Dynamic : Rows*Cols);
  typedef DenseStorage<T,Size, Rows,Cols, 0> DenseStorageType;
  
  const int rows = (Rows==Dynamic) ? 4 : Rows;
  const int cols = (Cols==Dynamic) ? 3 : Cols;
  const int size = rows*cols;
  DenseStorageType reference(size, rows, cols);
  T* raw_reference = reference.data();
  for (int i=0; i<size; ++i)
    raw_reference[i] = static_cast<T>(i);
    
  DenseStorageType copied_reference(reference);
  const T* raw_copied_reference = copied_reference.data();
  for (int i=0; i<size; ++i)
    VERIFY_IS_EQUAL(raw_reference[i], raw_copied_reference[i]);
}
开发者ID:muhammedabdelnasser,项目名称:Vehicle-Steering-Using-Model-Predictive-Control,代码行数:18,代码来源:dense_storage.cpp

示例11: readprog

obj*
readprog(void) {
	char *token = NULL;
	int c;
	size_t tokensize = 0;
	
	c = getchar();
	while(c >=0 && isspace(c))
		c = getchar();
	
	if(c == '`') {
		obj *lambda, *argument;
		lambda = readprog();
		argument = readprog();
		return apply(lambda, argument);
	} else if(c == '\\') {
		return lambda(readprog());
	}
	
	for(;;) {
		if(c<0)
			raiseerror("unexpected EOF");
		
		if(isspace(c))
			break;
		if(c == '`' || c == '\\') {
			ungetc(c, stdin);
			break;
		}
		
		token = xrealloc(token, ++tokensize);
		token[tokensize - 1] = c;
		
		c = getchar();
	}
	token = xrealloc(token, ++tokensize);
	token[tokensize - 1] = 0;
	
	if(isnum(token)) {
		return reference(strtoul(token, NULL, 10));
	} else {
		return symbol(token);
	}
}
开发者ID:JuEeHa,项目名称:lambdacalc,代码行数:44,代码来源:lambdacalc.c

示例12: model

      void TestModel::testObjectReferenceToDestroyedObject()
      {
        /// create a model
        std::auto_ptr<Model> model(new Model("TestModel::testObjectReferenceToDestroyedObject")) ;

        //// fill the model
        Object* object = model->createObject() ;
        ObjectReference reference(object) ;
        
        model->destroyObject(object) ;
        
        CPPUNIT_ASSERT(!reference) ;
        
        {
          Object* object2 = reference ;
          CPPUNIT_ASSERT(!object2) ;
        }

      }
开发者ID:BackupTheBerlios,项目名称:projet-univers-svn,代码行数:19,代码来源:test_model.cpp

示例13: unreference

bool Reference::init_ref() {

	if (reference()) {

		// this may fail in the scenario of two threads assigning the pointer for the FIRST TIME
		// at the same time, which is never likely to happen (would be crazy to do)
		// so don't do it.

		if (refcount_init.get() > 0) {
			refcount_init.unref();
			unreference(); // first referencing is already 1, so compensate for the ref above
		}

		return true;
	} else {

		return false;
	}
}
开发者ID:KellyThomas,项目名称:godot,代码行数:19,代码来源:reference.cpp

示例14: saver

void DefinitionDownloader::saveData(QNetworkReply *reply)
{
    const QString &urlPath = m_url.path();
    const QString &fileName =
        urlPath.right(urlPath.length() - urlPath.lastIndexOf(QLatin1Char('/')) - 1);
    Utils::FileSaver saver(m_localPath + fileName, QIODevice::Text);
    const QByteArray data = reply->readAll();
    saver.write(data);
    m_status = saver.finalize() ? Ok: WriteError;
    QString content = QString::fromUtf8(data);
    QRegExp reference(QLatin1String("context\\s*=\\s*\"[^\"]*##([^\"]+)\""));
    int index = -1;
    forever {
        index = reference.indexIn(content, index + 1);
        if (index == -1)
            break;
        emit foundReferencedDefinition(reference.cap(1));
    }
}
开发者ID:AgnosticPope,项目名称:qt-creator,代码行数:19,代码来源:definitiondownloader.cpp

示例15: QFETCH

void tst_QOpenGL::fboTextureOwnership()
{
    QFETCH(int, surfaceClass);
    QScopedPointer<QSurface> surface(createSurface(surfaceClass));

    QOpenGLContext ctx;
    QVERIFY(ctx.create());

    ctx.makeCurrent(surface.data());

    if (!QOpenGLFramebufferObject::hasOpenGLFramebufferObjects())
        QSKIP("QOpenGLFramebufferObject not supported on this platform");

    QOpenGLFramebufferObjectFormat fboFormat;
    fboFormat.setAttachment(QOpenGLFramebufferObject::NoAttachment);

    QOpenGLFramebufferObject *fbo = new QOpenGLFramebufferObject(200, 100, fboFormat);
    QVERIFY(fbo->texture() != 0);
    fbo->bind();

    // pull out the texture
    GLuint texture = fbo->takeTexture();
    QVERIFY(texture != 0);
    QVERIFY(fbo->texture() == 0);

    // verify that the next bind() creates a new texture
    fbo->bind();
    QVERIFY(fbo->texture() != 0 && fbo->texture() != texture);

    glClearColor(1.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glFinish();

    QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32);
    QImage reference(fb.size(), QImage::Format_RGB32);
    reference.fill(0xffff0000);

    QFUZZY_COMPARE_IMAGES(fb, reference);

    glDeleteTextures(1, &texture);
    delete fbo;
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:42,代码来源:tst_qopengl.cpp


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