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


C++ rv函数代码示例

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


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

示例1: f2poly_random

// ----------------------------------------------------------------
f2poly_t f2poly_random(int deg)
{
	if (deg < 0) {
		std::cerr << "f2poly_random:  degree " << deg
			<< " should be non-negative.\n";
		exit(1);
	}

	f2poly_t rv(0);
	rv.set_bit(deg);
	for (int i = deg-1; i >= 0; i--) {
		int bit = (get_random_unsigned() >> 17) & 1;
		if (bit)
			rv.set_bit(i);
	}
	return rv;
}
开发者ID:johnkerl,项目名称:spffl,代码行数:18,代码来源:f2poly_random.cpp

示例2: rv

QoreValue QoreHashMapOperatorNode::mapIterator(AbstractIteratorHelper& h, ExceptionSink* xsink) const {
   ReferenceHolder<QoreHashNode> rv(ref_rv ? new QoreHashNode : 0, xsink);

   qore_size_t i = 0;
   // set offset in thread-local data for "$#"
   while (true) {
      bool has_next = h.next(xsink);
      if (*xsink)
         return QoreValue();
      if (!has_next)
	 break;

      ImplicitElementHelper eh(i++);

      ReferenceHolder<> iv(h.getValue(xsink), xsink);
      if (*xsink)
         return QoreValue();

      // check if value can be mapped
      SingleArgvContextHelper argv_helper(*iv, xsink);

      {
	 ValueEvalRefHolder ekey(e[0], xsink);
	 if (*xsink)
	    return QoreValue();
	 
	 // we have to convert to a string in the default encoding to use a hash key
	 QoreStringValueHelper key(*ekey, QCS_DEFAULT, xsink);
	 if (*xsink)
	    return QoreValue();
	 
	 ValueEvalRefHolder val(e[1], xsink);
	 if (*xsink)
	    return QoreValue();
	 
	 if (ref_rv)
	    rv->setKeyValue(key->getBuffer(), val.getReferencedValue(), xsink);
      }
      // if there is an exception dereferencing one of the evaluted nodes above, then exit the loop
      if (*xsink)
	 return QoreValue();
   }
   
   return rv.release();
}
开发者ID:temnoregg,项目名称:qore,代码行数:45,代码来源:QoreHashMapOperatorNode.cpp

示例3: setProgressText

	SSMProcess* SceneModeler::compute(){
		setProgressText("starting computation");
		setProgressMax(100);
		setProgressValue(1);
		this->captureSceneLimits();
		this->calculateClasses();
		this->computeIndexSequence();
		for(int i = Lb(*this->transitionDataStates); i <= Ub(*this->transitionDataStates); i++){
			(*this->transitionDataStates)[i] += 1;
		}
		
		intvector rv(Lb(*this->transitionDataStates) , Ub(*this->transitionDataStates) );
		for(int i = Lb(rv) ; i <= Ub(rv) ; i++){
			rv[i] = (*this->transitionDataStates)[i];
		}
		setProgressText("creating model");
		return modelFromIndexSequence(rv);
	}
开发者ID:skempken,项目名称:interverdikom,代码行数:18,代码来源:SceneModeler.cpp

示例4: randStr

std::string randStr(int len)
{
	srand(GetTickCount());

	auto randChar = []() {
		char c = '\0';
		do {
			c = rand() % 0xFF;
		} while (!::isalpha(c));
		return c;
	};

	std::string rv(len, '\0');
	for (int i = 0; i < len; ++i)
		rv[i] = randChar();

	return rv;
}
开发者ID:JacobPersi,项目名称:labeless,代码行数:18,代码来源:util.cpp

示例5: evhttp_request_get_input_buffer

std::string HTTPRequest::ReadBody()
{
    struct evbuffer* buf = evhttp_request_get_input_buffer(req);
    if (!buf)
        return "";
    size_t size = evbuffer_get_length(buf);
    /** Trivial implementation: if this is ever a performance bottleneck,
     * internal copying can be avoided in multi-segment buffers by using
     * evbuffer_peek and an awkward loop. Though in that case, it'd be even
     * better to not copy into an intermediate string but use a stream
     * abstraction to consume the evbuffer on the fly in the parsing algorithm.
     */
    const char* data = (const char*)evbuffer_pullup(buf, size);
    if (!data) // returns NULL in case of empty buffer
        return "";
    std::string rv(data, size);
    evbuffer_drain(buf, size);
    return rv;
}
开发者ID:Crinklebine,项目名称:bitcoin,代码行数:19,代码来源:httpserver.cpp

示例6: rv

NS_IMETHODIMP MaemoLocationProvider::Startup()
{
  nsresult rv(NS_OK);

  nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
  if (!prefs)
    return NS_ERROR_FAILURE;

  rv = StartControl();
  NS_ENSURE_SUCCESS(rv, rv);

  rv = StartDevice();
  NS_ENSURE_SUCCESS(rv, rv);

  prefs->GetBoolPref("geo.herror.ignore.big", &mIgnoreBigHErr);

  if (mIgnoreBigHErr)
    prefs->GetIntPref("geo.herror.max.value", &mMaxHErr);

  prefs->GetBoolPref("geo.verror.ignore.big", &mIgnoreBigVErr);

  if (mIgnoreBigVErr)
    prefs->GetIntPref("geo.verror.max.value", &mMaxVErr);

  if (mUpdateTimer)
    return NS_OK;

  PRInt32 update = 0; //0 second no timer created
  prefs->GetIntPref("geo.default.update", &update);

  if (!update)
    return NS_OK;

  mUpdateTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);

  if (NS_FAILED(rv))
    return NS_ERROR_FAILURE;

  if (update)
    mUpdateTimer->InitWithCallback(this, update, nsITimer::TYPE_REPEATING_SLACK);

  return NS_OK;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:43,代码来源:MaemoLocationProvider.cpp

示例7: ImageChange

std::auto_ptr<ImageChange>
    Canvas::getContents() const
{
    std::auto_ptr<ImageChange> rv
        ( new ImageChange() );
    if ( contents.get() == NULL )
        return rv;

    rv->new_image = dStorm::display::Image( mkImgSize(getSize()) );
    unsigned char *d = contents->GetData();
    dStorm::display::Image::iterator i;
    for (i = rv->new_image.begin(); i != rv->new_image.end(); i++) {
        i->red() = *d++;
        i->green() = *d++;
        i->blue() = *d++;
    }

    return rv;
}
开发者ID:stevewolter,项目名称:rapidSTORM,代码行数:19,代码来源:Canvas.cpp

示例8: rv

std::auto_ptr< input::Traits<engine::ImageStack> >
OpenFile::getTraits()
{
    char readsif_error[4096];
    dataSet->error_buffer = readsif_error;

    std::auto_ptr< engine::InputTraits > 
        rv( new engine::InputTraits() );
    /* Read the additional information file from the SIF file
     * and store it in SIF info structure. */
    std::stringstream ss;

    rv->push_back( engine::InputPlane() );
    rv->plane(0).image.size.x() = 
            readsif_imageWidth( dataSet, 0 ) * camera::pixel;
    rv->plane(0).image.size.y() = readsif_imageHeight( dataSet, 0 )
            * camera::pixel;
    if ( dataSet->instaImage.kinetic_cycle_time > 1E-8 ) {
        rv->frame_rate = 1.0f * camera::frame / ( dataSet->instaImage.kinetic_cycle_time
                * boost::units::si::second );
    }
    rv->image_number().range().second =
        (readsif_numberOfImages(dataSet) - 1) * camera::frame;

    boost::units::quantity<boost::units::celsius::temperature,int> temp
        = (int(dataSet->instaImage.temperature) * boost::units::celsius::degrees);
    Reader r(rv->infos[DataSetTraits::CameraTemperature]);
    static_cast<std::ostream&>(r) << temp;

    if ( dataSet->instaImage.OutputAmp == 0 )
        rv->infos[DataSetTraits::OutputAmplifierType] = "Electron multiplication";
    else
        rv->infos[DataSetTraits::OutputAmplifierType] = "Conventional amplification";

    Reader(rv->infos[DataSetTraits::VerticalShiftSpeed]) 
        << dataSet->instaImage.data_v_shift_speed*1E6 << " µs";
    Reader(rv->infos[DataSetTraits::HorizontalShiftSpeed]) 
        << 1E-6/dataSet->instaImage.pixel_readout_time << " MHz";
    Reader(rv->infos[DataSetTraits::PreamplifierGain]) 
        << dataSet->instaImage.PreAmpGain;

    return rv;
}
开发者ID:matoho,项目名称:rapidSTORM,代码行数:43,代码来源:AndorSIF_OpenFile.cpp

示例9: FindIndex

// ****************************************************************************
//  Method: DBOptionsAttributes::GetEnumStrings
//
//  Purpose:
//     Finds the index of a member.
//
//  Programmer: Hank Childs (assumed)
//  Creation:   Unknown
//
//  Modifications:
//    Mark C. Miller, Tue Apr 29 17:39:39 PDT 2008
//    Made it a const method
// ****************************************************************************
std::vector<std::string>
DBOptionsAttributes::GetEnumStrings(const std::string &name) const
{
    int  i;

    int eIndex = FindIndex(name);
    if (eIndex < 0)
        EXCEPTION0(BadDeclareFormatString);

    int start = 0;
    for (i = 0 ; i < eIndex ; i++)
        start += enumStringsSizes[i];

    std::vector<std::string> rv(enumStringsSizes[eIndex]);
    for (i = 0 ; i < enumStringsSizes[eIndex] ; i++)
        rv[i] = enumStrings[start+i];

    return rv;
}
开发者ID:robertmaynard,项目名称:VisIt-Bridge,代码行数:32,代码来源:DBOptionsAttributes.C

示例10: rv

// static
LLSocket::ptr_t LLSocket::create(apr_status_t& status, LLSocket::ptr_t& listen_socket)
{
	if (!listen_socket->getSocket())
	{
		status = APR_ENOSOCKET;
		return LLSocket::ptr_t();
	}
	LLSocket::ptr_t rv(new LLSocket);
	LL_DEBUGS() << "accepting socket" << LL_ENDL;
	status = apr_socket_accept(&rv->mSocket, listen_socket->getSocket(), rv->mPool());
	if (status != APR_SUCCESS)
	{
		rv->mSocket = NULL;
		rv.reset();
		return rv;
	}
	rv->mPort = PORT_EPHEMERAL;
	rv->setNonBlocking();
	return rv;
}
开发者ID:DamianZhaoying,项目名称:SingularityViewer,代码行数:21,代码来源:lliosocket.cpp

示例11: MAX

cv::Mat GoodFrame::getRT(std::vector<cv::Point3f> &modelPoints_min)
{
    cv::Mat img = this->getCapturesImage();
    std::vector<cv::Point2f> imagePoints;
    for (size_t i = 0; i < 68; ++i)
    {
        imagePoints.push_back(cv::Point2f((float)(this->getDetected_landmarks().at<double>(i)),
                                          (float)(this->getDetected_landmarks().at<double>(i+68))));
    }

    /////
    int max_d = MAX(img.rows,img.cols);
    cv::Mat camMatrix = (Mat_<double>(3,3) << max_d, 0,     img.cols/2.0,
                         0,	 max_d, img.rows/2.0,
                         0,	 0,	    1.0);

    cv::Mat ip(imagePoints);
    cv::Mat op(modelPoints_min);
    std::vector<double> rv(3), tv(3);
    cv::Mat rvec(rv),tvec(tv);
    double _dc[] = {0,0,0,0};
    //    std::cout << ip << std::endl << std::endl;
    //    std::cout << op << std::endl << std::endl;
    //    std::cout << camMatrix << std::endl << std::endl;
    solvePnP(op, ip, camMatrix, cv::Mat(1,4,CV_64FC1,_dc), rvec, tvec, false, CV_EPNP);

    double rot[9] = {0};
    cv::Mat rotM(3, 3, CV_64FC1, rot);
    cv::Rodrigues(rvec, rotM);
    double* _r = rotM.ptr<double>();
    //    printf("rotation mat: \n %.3f %.3f %.3f\n%.3f %.3f %.3f\n%.3f %.3f %.3f\n",_r[0],_r[1],_r[2],_r[3],_r[4],_r[5],_r[6],_r[7],_r[8]);

    //    printf("trans vec: \n %.3f %.3f %.3f\n",tv[0],tv[1],tv[2]);

    cv::Mat _pm(3, 4, CV_64FC1);
    _pm.at<double>(0,0) = _r[0]; _pm.at<double>(0,1) = _r[1]; _pm.at<double>(0,2) = _r[2]; _pm.at<double>(0,3) = tv[0];
    _pm.at<double>(1,0) = _r[3]; _pm.at<double>(1,1) = _r[4]; _pm.at<double>(1,2) = _r[5]; _pm.at<double>(1,3) = tv[1];
    _pm.at<double>(2,0) = _r[6]; _pm.at<double>(2,1) = _r[7]; _pm.at<double>(2,2) = _r[8]; _pm.at<double>(2,3) = tv[2];

    return _pm;
}
开发者ID:ClarkWang12,项目名称:FaceAR_HeadPoseEstimation_StaticLib,代码行数:41,代码来源:GetGoodFrame.cpp

示例12: rv

AST_Decl *
ast_visitor_tmpl_module_inst::reify_type (AST_Decl *d)
{
  if (d == 0)
    {
      return 0;
    }

  if (this->ref_only_)
    {
      // If d is a param holder, the lookup will return a heap
      // allocation, which we need since this node's destination
      // owns param holders.
      if (d->node_type () == AST_Decl::NT_param_holder)
        {
          return
            idl_global->scopes ().top ()->lookup_by_name (
              d->name (),
              true);
        }
      else
        {
          return d;
        }
    }

  ast_visitor_reifying rv (this->ctx_);

  if (d->ast_accept (&rv) != 0)
    {
      ACE_ERROR ((LM_ERROR,
                  ACE_TEXT ("ast_visitor_tmpl_module_inst::")
                  ACE_TEXT ("reify_type() - reifying ")
                  ACE_TEXT ("visitor failed on %C\n"),
                  d->full_name ()));

      return 0;
    }

  return rv.reified_node ();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:41,代码来源:ast_visitor_tmpl_module_inst.cpp

示例13: operator

		const Vector operator()(const Vector &v) const
		{
			assert(v.size() == 3u);
			Vector rv(v);

			switch (_axis)
			{
				case X: rv[Y] = v[Y] * cosA - v[Z] * sinA;
					rv[Z] = v[Y] * sinA + v[Z] * cosA;
					break;
				case Y: rv[X] = v[Z] * sinA + v[X] * cosA;
					rv[Z] = v[Z] * cosA - v[X] * sinA;
					break;
				case Z: rv[X] = v[X] * cosA - v[Y] * sinA;
					rv[Y] = v[X] * sinA + v[Y] * cosA;
					break;
				default: assert(false);
			}

			return rv;
		}
开发者ID:PokerN,项目名称:sailfish,代码行数:21,代码来源:Functors.hpp

示例14: f2npoly_random

// ----------------------------------------------------------------
f2npoly_t f2npoly_random(f2poly_t m, int deg)
{
	if (deg < 0) {
		std::cerr << "f2npoly_random:  degree " << deg
			<< " should be non-negative.\n";
		exit(1);
	}

	f2poly_t a0(0);
	f2poly_t a1(1);
	f2polymod_t am0(a0, m);
	f2polymod_t am1(a1, m);
	f2npoly_t rv(am0);
	for (int i = deg; i >= 0; i--) {
		f2polymod_t am = f2polymod_random(m);
		if ((i == deg) && (am == am0))
			am = am1;
		rv.set_coeff(i, am);
	}
	return rv;
}
开发者ID:johnkerl,项目名称:spffl,代码行数:22,代码来源:f2npoly_random.cpp

示例15: rv

  DiracDeterminantBase::GradType 
    DiracDeterminantBase::evalGradSource(ParticleSet& P, ParticleSet& source,
					 int iat)
  {
    Phi->evaluateGradSource (P, FirstIndex, LastIndex,
			     source, iat, grad_source_psiM);
      
//     Phi->evaluate(P, FirstIndex, LastIndex, psiM, dpsiM, d2psiM);
//     LogValue=InvertWithLog(psiM.data(),NumPtcls,NumOrbitals,WorkSpace.data(),Pivot.data(),PhaseValue);

    const ValueType* restrict yptr=psiM[0];
    const GradType* restrict dyptr=grad_source_psiM[0];
    GradType rv(0.0,0.0,0.0);
    for (int i=0; i<NumPtcls; i++)
      for(int j=0; j<NumOrbitals; j++) 
	//rv += (*yptr++) *(*dyptr++);
	rv += grad_source_psiM(i,j) * psiM(i,j);
    // HACK HACK
    //return (grad_source_psiM(1,3));
    return rv;
  }
开发者ID:digideskio,项目名称:qmcpack,代码行数:21,代码来源:DiracDeterminantBase.cpp


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