• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ params函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ourClipRect

/**
  Paints the actual data area.

  \param painter the QPainter onto which the chart should be painted
  \param data the data that will be displayed as a chart
  \param paint2nd specifies whether the main chart or the additional chart is to be drawn now
  \param regions a pointer to a list of regions that will be filled
  with regions representing the data segments, if not null
  */
void KDChartPiePainter::paintData( QPainter* painter,
        KDChartTableDataBase* data,
        bool paint2nd,
        KDChartDataRegionList* regions )
{
//bHelp=true;
    uint chart = paint2nd ? 1 : 0;

    QRect ourClipRect( _dataRect );
    ourClipRect.addCoords( -1,-1,1,1 );

    const QWMatrix & world = painter->worldMatrix();
    ourClipRect =
#if COMPAT_QT_VERSION >= 0x030000
        world.mapRect( ourClipRect );
#else
    world.map( ourClipRect );
#endif

    painter->setClipRect( ourClipRect );

    // find which dataset to paint
    uint dataset;
    if ( !params()->findDataset( KDChartParams::DataEntry
                ,
                dataset, dataset ) ) {
        return ; // nothing to draw
    }

    if ( dataset == KDCHART_ALL_DATASETS )
        // setChartSourceMode() has not been used (or all datasets have been
        // configured to be used); use the first dataset by
        // default
        dataset = 0;


    // Number of values: If -1, use all values, otherwise use the
    // specified number of values.
    if ( params()->numValues() != -1 )
        _numValues = params()->numValues();
    else
        _numValues = data->usedCols();

    _startAngles.resize( _numValues );
    _angleLens.resize( _numValues );

    // compute position
    _size = QMIN( _dataRect.width(), _dataRect.height() ); // initial size
    // if the pies explode, we need to give them additional space =>
    // make the basic size smaller
    if ( params()->explode() ) {
        double doubleSize = ( double ) _size;
        doubleSize /= ( 1.0 + params()->explodeFactor() * 2 );
        _size = ( int ) doubleSize;
    }

    int sizeFor3DEffect = 0;
    if ( !params()->threeDPies() ) {

        int x = ( _dataRect.width() == _size ) ? 0 : ( ( _dataRect.width() - _size ) / 2 );
        int y = ( _dataRect.height() == _size ) ? 0 : ( ( _dataRect.height() - _size ) / 2 );
        _position = QRect( x, y, _size, _size );
        _position.moveBy( _dataRect.left(), _dataRect.top() );
    } else {
        // threeD: width is the maximum possible width; height is 1/2 of that
        int x = ( _dataRect.width() == _size ) ? 0 : ( ( _dataRect.width() - _size ) / 2 );
        int height = _size;
        // make sure that the height plus the threeDheight is not more than the
        // available size
        if ( params()->threeDPieHeight() >= 0 ) {
            // positive pie height: absolute value
            sizeFor3DEffect = params()->threeDPieHeight();
            height = _size - sizeFor3DEffect;
        } else {
            // negative pie height: relative value
            sizeFor3DEffect = -( int ) ( ( ( double ) params()->threeDPieHeight() / 100.0 ) * ( double ) height );
            height = _size - sizeFor3DEffect;
        }
        int y = ( _dataRect.height() == height ) ? 0 : ( ( _dataRect.height() - height - sizeFor3DEffect ) / 2 );

        _position = QRect( _dataRect.left() + x, _dataRect.top() + y,
                _size, height );
        //  _position.moveBy( _dataRect.left(), _dataRect.top() );
    }

    double sum = data->rowAbsSum( dataset );
    if( sum==0 ) //nothing to draw
        return;
    double sectorsPerValue = 5760.0 / sum; // 5760 == 16*360, number of sections in Qt circle

    int currentValue = params()->pieStart() * 16;
//.........这里部分代码省略.........
开发者ID:sajidji94,项目名称:kmymoney2,代码行数:101,代码来源:KDChartPiePainter.cpp


示例2: LOGV

status_t CedarXRecorder::prepare() 
{
	LOGV("prepare");

	int ret = OK;
	VIDEOINFO_t vInfo;
	AUDIOINFO_t aInfo;

	// Create audio recorder
	if (mRecModeFlag & RECORDER_MODE_AUDIO)
	{
		ret = CreateAudioRecorder();
		if (ret != OK)
		{
			LOGE("CreateAudioRecorder failed");
			return ret;
		}
	}
	
	// set recorder mode to CDX_Recorder
	CDXRecorder_Control(CDX_CMD_SET_REC_MODE, mRecModeFlag, 0);
	
	// create CedarX component
	ret = CDXRecorder_Control(CDX_CMD_PREPARE, 0, 0);
	if( ret == -1)
	{
		printf("CEDARX REPARE ERROR!\n");
		return UNKNOWN_ERROR;
	}

	// register callback
	CDXRecorder_Control(CDX_CMD_REGISTER_CALLBACK, (unsigned int)&CedarXRecorderCallbackWrapper, (unsigned int)this);
	
	// set file handle to CDX_Recorder render component
	ret = CDXRecorder_Control(CDX_CMD_SET_SAVE_FILE, (unsigned int)mOutputFd, 0);
	if(ret != OK)
	{
		LOGE("CedarXRecorder::prepare, CDX_CMD_SET_SAVE_FILE failed\n");
		return ret;
	}

	int64_t token = IPCThreadState::self()->clearCallingIdentity();
	// Set the actual video recording frame size
    CameraParameters params(mCamera->getParameters());
    params.setPreviewSize(mVideoWidth, mVideoHeight);
    String8 s = params.flatten();
    if (OK != mCamera->setParameters(s)) {
        LOGE("Could not change settings."
             " Someone else is using camera %d?", mCameraId);
		IPCThreadState::self()->restoreCallingIdentity(token);
        return -EBUSY;
    }
    CameraParameters newCameraParams(mCamera->getParameters());

    // Check on video frame size
    int srcWidth = 0, srcHeight = 0;
    newCameraParams.getPreviewSize(&srcWidth, &srcHeight);
    if (srcWidth  == 0 || srcHeight == 0) {
        LOGE("Failed to set the video frame size to %dx%d",
                mVideoWidth, mVideoHeight);
		IPCThreadState::self()->restoreCallingIdentity(token);
        return UNKNOWN_ERROR;
    }
	IPCThreadState::self()->restoreCallingIdentity(token);

	LOGV("src: %dx%d, video: %dx%d", srcWidth, srcHeight, mVideoWidth, mVideoHeight);
	
	// set video size and FrameRate to CDX_Recorder
	memset((void *)&vInfo, 0, sizeof(VIDEOINFO_t));
#if 0
	vInfo.src_width		= 176;
	vInfo.src_height	= 144;
	vInfo.width			= 160;			// mVideoWidth;
	vInfo.height		= 120;			// mVideoHeight;
	vInfo.frameRate		= 30*1000;		// mFrameRate;
	vInfo.bitRate		= 200000;		// mVideoBitRate;
	vInfo.profileIdc	= 66;
	vInfo.levelIdc		= 31;
#else
	vInfo.src_width		= srcWidth;
	vInfo.src_height	= srcHeight;
	vInfo.width			= mVideoWidth;
	vInfo.height		= mVideoHeight;
	vInfo.frameRate		= mFrameRate*1000;
	vInfo.bitRate		= mVideoBitRate;
	vInfo.profileIdc	= 66;
	vInfo.levelIdc		= 31;
#endif
	if (mVideoWidth == 0
		|| mVideoHeight == 0
		|| mFrameRate == 0
		|| mVideoBitRate == 0)
	{
		LOGE("error video para");
		return -1;
	}
	
	ret = CDXRecorder_Control(CDX_CMD_SET_VIDEO_INFO, (unsigned int)&vInfo, 0);
	if(ret != OK)
	{
//.........这里部分代码省略.........
开发者ID:allwinner-ics,项目名称:platform_frameworks_base,代码行数:101,代码来源:CedarXRecorder.cpp


示例3: cg_connect

void
cg_connect( ConnectionGeneratorDatum& cg,
  RangeSet& sources,
  std::vector< long >& source_gids,
  RangeSet& targets,
  std::vector< long >& target_gids,
  DictionaryDatum params_map,
  index syn )
{
  cg_set_masks( cg, sources, targets );
  cg->start();

  int source, target, num_parameters = cg->arity();
  if ( num_parameters == 0 )
  {
    // connect source to target
    while ( cg->next( source, target, NULL ) )
    {
      if ( ConnectionGeneratorModule::get_network().is_local_gid( target_gids.at( target ) ) )
      {
        Node* const target_node =
          ConnectionGeneratorModule::get_network().get_node( target_gids.at( target ) );
        const thread target_thread = target_node->get_thread();
        ConnectionGeneratorModule::get_network().connect(
          source_gids.at( source ), target_node, target_thread, syn );
      }
    }
  }
  else if ( num_parameters == 2 )
  {
    if ( !params_map->known( names::weight ) || !params_map->known( names::delay ) )
      throw BadProperty( "The parameter map has to contain the indices of weight and delay." );

    long w_idx = ( *params_map )[ names::weight ];
    long d_idx = ( *params_map )[ names::delay ];
    std::vector< double > params( 2 );

    // connect source to target with weight and delay
    while ( cg->next( source, target, &params[ 0 ] ) )
    {
      if ( ConnectionGeneratorModule::get_network().is_local_gid( target_gids.at( target ) ) )
      {
        Node* const target_node =
          ConnectionGeneratorModule::get_network().get_node( target_gids.at( target ) );
        const thread target_thread = target_node->get_thread();
        ConnectionGeneratorModule::get_network().connect( source_gids.at( source ),
          target_node,
          target_thread,
          syn,
          params[ d_idx ],
          params[ w_idx ] );
      }
    }
  }
  else
  {
    ConnectionGeneratorModule::get_network().message( SLIInterpreter::M_ERROR,
      "Connect",
      "Either two or no parameters in the Connection Set expected." );
    throw DimensionMismatch();
  }
}
开发者ID:JanneM,项目名称:nest-simulator,代码行数:62,代码来源:cg_connect.cpp


示例4: ALOGV

status_t CameraSource::initWithCameraAccess(
        const sp<ICamera>& camera,
        const sp<ICameraRecordingProxy>& proxy,
        int32_t cameraId,
        const String16& clientName,
        uid_t clientUid,
        Size videoSize,
        int32_t frameRate,
        bool storeMetaDataInVideoBuffers) {
    ALOGV("initWithCameraAccess");
    status_t err = OK;

    if ((err = isCameraAvailable(camera, proxy, cameraId,
            clientName, clientUid)) != OK) {
        ALOGE("Camera connection could not be established.");
        return err;
    }
    CameraParameters params(mCamera->getParameters());
    if ((err = isCameraColorFormatSupported(params)) != OK) {
        return err;
    }

    // Set the camera to use the requested video frame size
    // and/or frame rate.
    if ((err = configureCamera(&params,
                    videoSize.width, videoSize.height,
                    frameRate))) {
        return err;
    }

    // Check on video frame size and frame rate.
    CameraParameters newCameraParams(mCamera->getParameters());
    if ((err = checkVideoSize(newCameraParams,
                videoSize.width, videoSize.height)) != OK) {
        return err;
    }
    if ((err = checkFrameRate(newCameraParams, frameRate)) != OK) {
        return err;
    }

    // Set the preview display. Skip this if mSurface is null because
    // applications may already set a surface to the camera.
    if (mSurface != NULL) {
        // This CHECK is good, since we just passed the lock/unlock
        // check earlier by calling mCamera->setParameters().
        CHECK_EQ((status_t)OK, mCamera->setPreviewTarget(mSurface));
    }

    // By default, do not store metadata in video buffers
    mIsMetaDataStoredInVideoBuffers = false;
    mCamera->storeMetaDataInBuffers(false);
    if (storeMetaDataInVideoBuffers) {
        if (OK == mCamera->storeMetaDataInBuffers(true)) {
            mIsMetaDataStoredInVideoBuffers = true;
        }
    }

    int64_t glitchDurationUs = (1000000LL / mVideoFrameRate);
    if (glitchDurationUs > mGlitchDurationThresholdUs) {
        mGlitchDurationThresholdUs = glitchDurationUs;
    }

    // XXX: query camera for the stride and slice height
    // when the capability becomes available.
    mMeta = new MetaData;
    mMeta->setCString(kKeyMIMEType,  MEDIA_MIMETYPE_VIDEO_RAW);
    mMeta->setInt32(kKeyColorFormat, mColorFormat);
    mMeta->setInt32(kKeyWidth,       mVideoSize.width);
    mMeta->setInt32(kKeyHeight,      mVideoSize.height);
    mMeta->setInt32(kKeyStride,      mVideoSize.width);
    mMeta->setInt32(kKeySliceHeight, mVideoSize.height);
    mMeta->setInt32(kKeyFrameRate,   mVideoFrameRate);
    return OK;
}
开发者ID:DARKPOP,项目名称:frameworks_av,代码行数:74,代码来源:CameraSource.cpp


示例5: params

int StructureManager::declareResidence(CreatureObject* player, StructureObject* structureObject) {
	if (!structureObject->isBuildingObject()) {
		player->sendSystemMessage("@player_structure:residence_must_be_building"); //Your declared residence must be a building.
		return 1;
	}

	PlayerObject* ghost = player->getPlayerObject();

	if (!player->checkCooldownRecovery("declare_residence") && !ghost->isPrivileged()) {
		Time* timeremaining = player->getCooldownTime("declare_residence");
		StringIdChatParameter params("player_structure", "change_residence_time"); //You cannot change residence for %NO hours.
		params.setTO(String::valueOf(ceil(timeremaining->miliDifference() / -3600000.f)));

		player->sendSystemMessage(params);
		return 1;
	}

	ManagedReference<BuildingObject*> buildingObject = cast<BuildingObject*>(structureObject);

	if (!buildingObject->isOwnerOf(player)) {
		player->sendSystemMessage("@player_structure:declare_must_be_owner"); //You must be the owner of the building to declare residence.
		return 1;
	}


	uint64 objectid = player->getObjectID();

	uint64 declaredOidResidence = ghost->getDeclaredResidence();

	ManagedReference<BuildingObject*> declaredResidence = server->getObject(declaredOidResidence).castTo<BuildingObject*>();
	ManagedReference<CityRegion*> cityRegion = buildingObject->getCityRegion();

	CityManager* cityManager = server->getCityManager();

	if (declaredResidence != NULL) {
		if (declaredResidence == buildingObject) {
			player->sendSystemMessage("@player_structure:already_residence"); //This building is already your residence.
			return 1;
		}

		ManagedReference<CityRegion*> residentCity = declaredResidence->getCityRegion();

		if (residentCity != NULL) {
			Locker lock(residentCity, player);

			if (residentCity->isMayor(objectid)) {
				player->sendSystemMessage("@city/city:mayor_residence_change"); //As a city Mayor, your residence is always the city hall of the city in which you are mayor.  You cannot declare a new residence.
				return 1;
			}

			cityManager->unregisterCitizen(residentCity, player);
		}

		player->sendSystemMessage("@player_structure:change_residence"); //You change your residence to this building.
	} else {
		player->sendSystemMessage("@player_structure:declared_residency"); //You have declared your residency here.
	}

	if (cityRegion != NULL) {
		Locker lock(cityRegion, player);

		if (cityRegion->isMayor(objectid) && structureObject != cityRegion->getCityHall()) {
			player->sendSystemMessage("@city/city:mayor_residence_change"); //As a city Mayor, your residence is always the city hall of the city in which you are mayor.  You cannot declare a new residence.
			return 1;
		}

		cityManager->registerCitizen(cityRegion, player);
	}

	//Set the characters home location to this structure.
	ghost->setDeclaredResidence(buildingObject);

	if(declaredResidence != NULL) {
		Locker oldLock(declaredResidence, player);
		declaredResidence->setResidence(false);
	}

	Locker newLock(buildingObject,player);
	buildingObject->setResidence(true);

	player->addCooldown("declare_residence", 24 * 3600 * 1000); //1 day

	return 0;
}
开发者ID:Nifdoolb,项目名称:Server,代码行数:84,代码来源:StructureManager.cpp


示例6: MultiTouchPoint

void BasicInteractiveObject::removeMultiTouch(mtRay ray, int touchId) {

  if (isMultiTouchActive(touchId)) {

    // copy that touch in case we need to dispatch it with an event
    MultiTouchPoint *oldMtp = activeMultiTouches[touchId];
    MultiTouchPoint *mtp = new MultiTouchPoint();
    mtp->starttime = oldMtp->starttime;
    mtp->globalmovedist = oldMtp->globalmovedist;
    mtp->screenpos = oldMtp->screenpos;
    mtp->localoffset = oldMtp->localoffset;
    mtp->localstartpos = oldMtp->localstartpos;
    mtp->localpos = oldMtp->localpos;
    mtp->localposbef = oldMtp->localposbef;
    mtp->localspeed = oldMtp->localspeed;
    mtp->localspeeddamped = oldMtp->localspeeddamped;
    mtp->globalstartpos = oldMtp->globalstartpos;
    mtp->globalpos = oldMtp->globalpos;
    mtp->globalposbef = oldMtp->globalposbef;
    mtp->globalspeed = oldMtp->globalspeed;

    activeMultiTouches.erase(activeMultiTouches.find(touchId));

    if (getNumActiveTouches() == 0 && mtcounter > 0) {

      // End of Scope
      mtscoperunning = false;
      mtscopeduration = ofGetElapsedTimeMillis() - mtstarttime;

      if (!isrotating && !isscaling) {
        // check for taps
        if (!isdragging && mtscopeduration < tapThreshold) {
          if (mtcounter == 1) {
            MultiTouchEvent params(this, mtp);
            ofNotifyEvent(tapEvent, params, this);

          } else if (mtcounter == 2) {
            MultiTouchEvent params(this, mtp);
            ofNotifyEvent(doubleTapEvent, params, this);
          }

          // check for swipe
        } else if (mtscopeduration < 1000 && mttranslatespeed.length() > 0.0) {

          MultiTouchEvent params(this, mtp);

          if (abs(mttranslatespeed.x) > abs(mttranslatespeed.y)) {
            if (mttranslatespeed.x < 0) {
              ofNotifyEvent(swipeLeftEvent, params, this);
            } else {
              ofNotifyEvent(swipeRightEvent, params, this);
            }
          } else {
            if (mttranslatespeed.y < 0) {
              ofNotifyEvent(swipeUpEvent, params, this);
            } else {
              ofNotifyEvent(swipeDownEvent, params, this);
            }
          }
        }
      }

      if (isdragging == true) {
        isdragging = false;
        MultiTouchEvent params(this);
        ofNotifyEvent(dragStopEvent, params, this);
      }

      MultiTouchEvent params(this, mtp);
      ofNotifyEvent(lastTouchUpEvent, params, this);

      mtcounter = 0;
    }

    if (getNumActiveTouches() < 2 && mtcounter >= 2) {
      if (isrotating == true) {
        isrotating = false;
        MultiTouchEvent params(this);
        ofNotifyEvent(rotateStopEvent, params, this);
      }
      if (isscaling == true) {
        isscaling = false;
        MultiTouchEvent params(this);
        ofNotifyEvent(scaleStopEvent, params, this);
      }

      MultiTouchEvent params(this);
      ofNotifyEvent(endMultiTouchScopeEvent, params, this);
    }

    resetMTStartValues();
  }
}
开发者ID:kitschpatrol,项目名称:ofxRRScenegraph,代码行数:93,代码来源:BasicInteractiveObject.cpp


示例7: WXUNUSED

void MyApp::DoMIMEDemo(wxCommandEvent& WXUNUSED(event))
{
    static wxString s_defaultExt = _T("xyz");

    wxString ext = wxGetTextFromUser(_T("Enter a file extension: "),
                                     _T("MIME database test"),
                                     s_defaultExt);
    if ( !!ext )
    {
        s_defaultExt = ext;

        // init MIME database if not done yet
        if ( !m_mimeDatabase )
        {
            m_mimeDatabase = new wxMimeTypesManager;

            static const wxFileTypeInfo fallbacks[] =
            {
                wxFileTypeInfo(_T("application/xyz"),
                               _T("XyZ %s"),
                               _T("XyZ -p %s"),
                               _T("The one and only XYZ format file"),
                               _T("xyz"), _T("123"), NULL),
                wxFileTypeInfo(_T("text/html"),
                               _T("lynx %s"),
                               _T("lynx -dump %s | lpr"),
                               _T("HTML document (from fallback)"),
                               _T("htm"), _T("html"), NULL),

                // must terminate the table with this!
                wxFileTypeInfo()
            };

            m_mimeDatabase->AddFallbacks(fallbacks);
        }

        wxTextCtrl& textCtrl = * GetTextCtrl();

        wxFileType *filetype = m_mimeDatabase->GetFileTypeFromExtension(ext);
        if ( !filetype )
        {
            textCtrl << _T("Unknown extension '") << ext << _T("'\n");
        }
        else
        {
            wxString type, desc, open;
            filetype->GetMimeType(&type);
            filetype->GetDescription(&desc);

            wxString filename = _T("filename");
            filename << _T(".") << ext;
            wxFileType::MessageParameters params(filename, type);
            filetype->GetOpenCommand(&open, params);

            textCtrl << _T("MIME information about extension '") << ext << _T('\n')
                     << _T("\tMIME type: ") << ( !type ? wxT("unknown")
                                                   : type.c_str() ) << _T('\n')
                     << _T("\tDescription: ") << ( !desc ? wxEmptyString : desc.c_str() )
                        << _T('\n')
                     << _T("\tCommand to open: ") << ( !open ? wxT("no") : open.c_str() )
                        << _T('\n');

            delete filetype;
        }
    }
    //else: cancelled by user
}
开发者ID:nealey,项目名称:vera,代码行数:67,代码来源:typetest.cpp


示例8: params

//-----------------------------------------------------------------------------------------------//
HRESULT CMyTrackPriceInfoWithNotify::OnQuoteUpdate(CComVariant &varParams, CComVariant &varResults)
{
	_QuoteUpdateParams params(varParams);
	_QuoteUpdateInfo   results(varResults);

	_bstr_t bsFullSymbol  = params->Symbol;
	bsFullSymbol +=_T("_");
	bsFullSymbol += params->Exchange;
	if(params->Type == enOPT)
		bsFullSymbol +=_T("_");

	try
	{
		if(results->LastPrice>0.0001)
		{
			// Update Last, Min, Max prices
			CCriticalSectionWrapper wr(m_csCache);
			if(m_SymbolsCache.find(bsFullSymbol)!=m_SymbolsCache.end())
			{
				_QuoteUpdateInfo cache(m_SymbolsCache[bsFullSymbol]);
				CComVariant vtReq;

				cache->LastPrice = results->LastPrice;

				if(cache->HighPrice < results->HighPrice)
					cache->HighPrice = results->HighPrice;

				if(cache->LowPrice <0.001 || cache->LowPrice > results->LowPrice)
					cache->LowPrice = results->LowPrice;

				results->HighPrice = cache->HighPrice;
				results->LowPrice = cache->LowPrice;

				cache.CopyTo(vtReq);
				m_SymbolsCache[bsFullSymbol] = vtReq;
			}
		}
		else
		{
			CCriticalSectionWrapper wr(m_csCache);
			if(m_SymbolsCache.find(bsFullSymbol)!=m_SymbolsCache.end())
			{
				_QuoteUpdateInfo cache(m_SymbolsCache[bsFullSymbol]);

				results->LastPrice = cache->LastPrice;
				results->HighPrice = cache->HighPrice;
				results->LowPrice = cache->LowPrice;
				results->OpenPrice = cache->OpenPrice;
				results->ClosePrice = cache->ClosePrice;
			}
		}
	}
	catch(...){}

	CComVariant vtUpdate;
	results.CopyTo(vtUpdate);

	{
		CCriticalSectionWrapper d(m_csResponce);

		for(RESPONCE::iterator iter = m_Responce.begin(); iter!=m_Responce.end(); iter++)
		{
			if(iter->m_enType == CResponce::enQuoteUpdate && iter->m_bsFullSymbol == bsFullSymbol)
			{
				iter->m_vtResponce = vtUpdate;
				iter->m_lSkip++;
				return S_OK;
			}
		}

		CResponce resp;

		resp.m_enType = CResponce::enQuoteUpdate;
		resp.m_bsFullSymbol = bsFullSymbol;
		resp.m_vtRequest = varParams;
		resp.m_vtResponce = vtUpdate;

		m_Responce.insert(m_Responce.end(), resp);		

	}
	SetEvent(m_hResponce);

	return S_OK;
}
开发者ID:AlexS2172,项目名称:IVRMstandard,代码行数:85,代码来源:mytrackpriceinfowithnotify.cpp


示例9: params

void Func::show(Ostream& os) const {
	os << "function" << params();
}
开发者ID:apmckinlay,项目名称:csuneido,代码行数:3,代码来源:func.cpp


示例10: GetSupportedDepthFormat

void RenderViewport::AllocateRenderTargets(rhi::GfxSetting & gfxSetting)
{
	if (m_RenderPass)
	{
		VkFormat depthFormat = g_FormatTable[gfxSetting.DepthStencilFormat];
		GetSupportedDepthFormat(GetPhysicalDevice(), &depthFormat);
		VkImage depthImage;
		VkImageCreateInfo image = {};
		image.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
		image.imageType = VK_IMAGE_TYPE_2D;
		image.format = depthFormat;
		// Use example's height and width
		image.extent = { GetWidth(), GetHeight(), 1 };
		image.mipLevels = 1;
		image.arrayLayers = 1;
		image.samples = VK_SAMPLE_COUNT_1_BIT;
		image.tiling = VK_IMAGE_TILING_OPTIMAL;
		image.usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
		image.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
		vkCreateImage(GetRawDevice(), &image, nullptr, &depthImage);


		VkDeviceMemory depthMem;
		// Allocate memory for the image (device local) and bind it to our image
		VkMemoryAllocateInfo memAlloc = {};
		memAlloc.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
		VkMemoryRequirements memReqs;
		vkGetImageMemoryRequirements(GetRawDevice(), depthImage, &memReqs);
		memAlloc.allocationSize = memReqs.size;
		GetDevice()->FindMemoryType(memReqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &memAlloc.memoryTypeIndex);
		vkAllocateMemory(GetRawDevice(), &memAlloc, nullptr, &depthMem);
		vkBindImageMemory(GetRawDevice(), depthImage, depthMem, 0);

		auto layoutCmd = static_cast<CommandContext*>(GetDevice()->NewCommandContext(rhi::ECMD_Graphics));
		ImageMemoryBarrierParams params(depthImage,
			VK_IMAGE_LAYOUT_UNDEFINED,
			VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
			VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
			VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT);
		layoutCmd->Begin();
		params.MipLevelCount(1).AspectMask(VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT).LayerCount(1);
		layoutCmd->PipelineBarrierImageMemory(params);
		layoutCmd->End();
		layoutCmd->Execute(false);

		VkImageView depthView;
		VkImageViewCreateInfo depthStencilView = {};
		depthStencilView.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
		depthStencilView.viewType = VK_IMAGE_VIEW_TYPE_2D;
		depthStencilView.format = depthFormat;
		depthStencilView.subresourceRange = {};
		depthStencilView.subresourceRange.aspectMask = DetermineAspectMask(depthFormat);
		depthStencilView.subresourceRange.baseMipLevel = 0;
		depthStencilView.subresourceRange.levelCount = 1;
		depthStencilView.subresourceRange.baseArrayLayer = 0;
		depthStencilView.subresourceRange.layerCount = 1;
		depthStencilView.image = depthImage;
		vkCreateImageView(GetRawDevice(), &depthStencilView, nullptr, &depthView);

		m_RenderTargets.resize(m_NumBufferCount);
		RenderpassOptions option = m_RenderPass->GetOption();
		VkFormat colorFmt = option.GetAttachments()[0].GetFormat();
		for (uint32_t i = 0; i < m_NumBufferCount; ++i)
		{
			VkImage colorImage = m_pSwapChain->GetBackImage(i);
			auto colorImageInfo = ImageViewInfo::CreateColorImageView(GetRawDevice(), colorFmt, colorImage);
			VKLOG(Info, "swapchain imageView created . (0x%0x).", colorImageInfo.first);
			colorImageInfo.second.components = {
				VK_COMPONENT_SWIZZLE_R,
				VK_COMPONENT_SWIZZLE_G,
				VK_COMPONENT_SWIZZLE_B,
				VK_COMPONENT_SWIZZLE_A
			};
			auto colorTex = Texture::CreateFromSwapChain(colorImage, colorImageInfo.first, colorImageInfo.second, GetDevice());

			FrameBuffer::Attachment colorAttach(colorImageInfo.first);
			FrameBuffer::Attachment depthAttach(depthView);
			FrameBuffer::Option op;
			op.Width = GetWidth();
			op.Height = GetHeight();
			op.Attachments.push_back(colorAttach);
			op.Attachments.push_back(depthAttach);
			auto framebuffer = SpFramebuffer(new FrameBuffer(GetDevice(), m_RenderPass->GetPass(), op));
			m_RenderTargets[i] = std::make_shared<RenderTarget>(GetDevice(), colorTex, framebuffer, m_RenderPass->GetPass());
		}
	}
}
开发者ID:aonorin,项目名称:kaleido3d,代码行数:87,代码来源:VkRenderViewport.cpp


示例11: main

int main(int argc,char *argv[])
{
	int opt;
	PsimagLite::String file("");
	SizeType total=0;
	RealType offset = 0;
	SizeType site3 = 0;

	RealType step = 0;
	while ((opt = getopt(argc, argv, "f:p:t:o:i:")) != -1) {
		switch (opt) {
		case 'f':
			file=optarg;
			break;
		case 'p':
			site3 = atoi(optarg);
			break;
		case 't':
			total = atoi(optarg);
			break;
		case 'i':
			step = atof(optarg);
			break;
		case 'o':
			offset = atof(optarg);
			break;
		default: /* '?' */
			throw std::runtime_error("Wrong usage\n");
		}
	}
	if (file=="") throw std::runtime_error("Wrong usage\n");

	FreeFermions::InputCheck inputCheck;
	InputNgType::Writeable ioWriteable(file,inputCheck);
	InputNgType::Readable io(ioWriteable);

	GeometryParamsType geometryParams(io);
	SizeType electronsUp = GeometryParamsType::readElectrons(io,geometryParams.sites);
	PsimagLite::Vector<SizeType>::Type sites;
	GeometryParamsType::readVector(sites,file,"TSPSites");
	sites.resize(3);
	sites[2] = site3;
	SizeType nthreads = 1;

	try {
		GeometryParamsType::readLabel(nthreads,file,"Threads=");
	} catch (std::exception& e) {}

	assert(nthreads>0);

	typedef PsimagLite::Concurrency ConcurrencyType;
	ConcurrencyType concurrency(&argc,&argv,nthreads);

	SizeType dof = 2; // spin up and down

	GeometryLibraryType geometry(geometryParams);

	std::cerr<<geometry;
	
	EngineType engine(geometry.matrix(),dof,false);

	PsimagLite::Vector<SizeType>::Type ne(dof,electronsUp); // 8 up and 8 down
	bool debug = false;
	bool verbose = false;

	
	RealType sum = 0;
	for (SizeType i=0;i<electronsUp;i++) sum += engine.eigenvalue(i);
	std::cerr<<"Energy="<<dof*sum<<"\n";

	SizeType sigma3 = 0;

	std::cout<<"#sites= ";
	for (SizeType i=0;i<sites.size();i++) std::cout<<sites[i]<<" ";
	std::cout<<"\n";

	typedef FreeFermions::ParallelHolonDoublon<RealType,FieldType,EngineType> ParallelHolonDoublonType;
	typedef PsimagLite::Parallelizer<ParallelHolonDoublonType> ParallelizerType;
	ParallelizerType threadedHolonDoublon(PsimagLite::Concurrency::npthreads,
	                                      PsimagLite::MPI::COMM_WORLD);

	ParallelHolonDoublonType::HolonDoublonParamsType params(ne,
															sites,
															sigma3,
															offset,
															step,
															debug,
															verbose);
	ParallelHolonDoublonType helperHolonDoublon(engine,params);

	FieldType superdensity = helperHolonDoublon.calcSuperDensity(sites[0],sites[1]);
	std::cout<<"#superdensity="<<superdensity<<"\n";

	threadedHolonDoublon.loopCreate(total,helperHolonDoublon);
}
开发者ID:anocera,项目名称:FreeFermions,代码行数:95,代码来源:HolonDoublon.cpp


示例12: GaussianBlur

GrTexture* GaussianBlur(GrContext* context,
                        GrTexture* srcTexture,
                        bool canClobberSrc,
                        const SkRect& dstBounds,
                        const SkRect* srcBounds,
                        float sigmaX,
                        float sigmaY,
                        GrTextureProvider::SizeConstraint constraint) {
    SkASSERT(context);
    SkIRect clearRect;
    int scaleFactorX, radiusX;
    int scaleFactorY, radiusY;
    int maxTextureSize = context->caps()->maxTextureSize();
    sigmaX = adjust_sigma(sigmaX, maxTextureSize, &scaleFactorX, &radiusX);
    sigmaY = adjust_sigma(sigmaY, maxTextureSize, &scaleFactorY, &radiusY);

    SkPoint srcOffset = SkPoint::Make(-dstBounds.x(), -dstBounds.y());
    SkRect localDstBounds = SkRect::MakeWH(dstBounds.width(), dstBounds.height());
    SkRect localSrcBounds;
    SkRect srcRect;
    if (srcBounds) {
        srcRect = localSrcBounds = *srcBounds;
        srcRect.offset(srcOffset);
        srcBounds = &localSrcBounds;
    } else {
        srcRect = localDstBounds;
    }

    scale_rect(&srcRect, 1.0f / scaleFactorX, 1.0f / scaleFactorY);
    srcRect.roundOut(&srcRect);
    scale_rect(&srcRect, static_cast<float>(scaleFactorX),
                         static_cast<float>(scaleFactorY));

    // setup new clip
    GrClip clip(localDstBounds);

    SkASSERT(kBGRA_8888_GrPixelConfig == srcTexture->config() ||
             kRGBA_8888_GrPixelConfig == srcTexture->config() ||
             kAlpha_8_GrPixelConfig == srcTexture->config());

    GrSurfaceDesc desc;
    desc.fFlags = kRenderTarget_GrSurfaceFlag;
    desc.fWidth = SkScalarFloorToInt(dstBounds.width());
    desc.fHeight = SkScalarFloorToInt(dstBounds.height());
    desc.fConfig = srcTexture->config();

    GrTexture* dstTexture;
    GrTexture* tempTexture;
    SkAutoTUnref<GrTexture> temp1, temp2;

    temp1.reset(context->textureProvider()->createTexture(desc, constraint));
    dstTexture = temp1.get();
    if (canClobberSrc) {
        tempTexture = srcTexture;
    } else {
        temp2.reset(context->textureProvider()->createTexture(desc, constraint));
        tempTexture = temp2.get();
    }

    if (nullptr == dstTexture || nullptr == tempTexture) {
        return nullptr;
    }

    SkAutoTUnref<GrDrawContext> srcDrawContext;

    for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) {
        GrPaint paint;
        SkMatrix matrix;
        matrix.setIDiv(srcTexture->width(), srcTexture->height());
        SkRect dstRect(srcRect);
        if (srcBounds && i == 1) {
            SkRect domain;
            matrix.mapRect(&domain, *srcBounds);
            domain.inset((i < scaleFactorX) ? SK_ScalarHalf / srcTexture->width() : 0.0f,
                         (i < scaleFactorY) ? SK_ScalarHalf / srcTexture->height() : 0.0f);
            SkAutoTUnref<const GrFragmentProcessor> fp(GrTextureDomainEffect::Create(
                srcTexture,
                matrix,
                domain,
                GrTextureDomain::kDecal_Mode,
                GrTextureParams::kBilerp_FilterMode));
            paint.addColorFragmentProcessor(fp);
            srcRect.offset(-srcOffset);
            srcOffset.set(0, 0);
        } else {
            GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode);
            paint.addColorTextureProcessor(srcTexture, matrix, params);
        }
        paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
        scale_rect(&dstRect, i < scaleFactorX ? 0.5f : 1.0f,
                             i < scaleFactorY ? 0.5f : 1.0f);

        SkAutoTUnref<GrDrawContext> dstDrawContext(
                                             context->drawContext(dstTexture->asRenderTarget()));
        if (!dstDrawContext) {
            return nullptr;
        }
        dstDrawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);

        srcDrawContext.swap(dstDrawContext);
//.........这里部分代码省略.........
开发者ID:keinvo,项目名称:skia,代码行数:101,代码来源:SkGpuBlurUtils.cpp


示例13: main

int main(int argc, char **argv)
{
	char **files = calloc(2, sizeof(char*)); //0 is input, 1 is output

	if(files == NULL) //allocation failure
	{
		exit(1); //exit failure
	}

	params(argc, argv, files); //handle the parameters

	FILE *input; //the input file
	FILE *output; //the output file

	if(files[0] != NULL) //if there is an input file specified as parameter..
	{
		input = fopen(files[0], "r"); //..then open it for reading
	}

	if(files[1] != NULL) //if there is an output file specified as parameter..
	{
		output = fopen(files[1], "w"); //..then open it for writing
	}

	char foo = READCHAR; //read a char from the input
	node *head = calloc(1, sizeof(node)); //allocate the head node
	node *current = head; //the current node is the head as we haven't made reads yet
	int sentences = 0; //0 sentences so far
	int currSentence = 0; //0 words in the first sentence so far
	int *distArray = calloc(21, sizeof(int)); //the array used for storing word count in sentences
	if(distArray == NULL) //if the allocation failed
		exit(1); //exit failure

	
	while(foo != EOF) //until the end of the file or ^C
	{
		if(foo == '!' || foo == '?' || foo == '.') //if it's the end of a sentence
		{
			if(current != head) //if current = head, the next sentence hasn't begun ("Really?!", "Oh.." and so on)
			{
				sentences = sentences + 1; //Another finished sentence
				(*current).val += 1; //Also the end of the word
				current = head; //move back to the head as we are starting a new word

				if(currSentence > 20) //over 20 words in this sentence
					distArray[20] += 1; //[20] is the "over 20 words" cell
				else
					distArray[currSentence-1] += 1; //note down the amount of words in the last sentence

				currSentence = 1; //grows by 1 each space, n words are separated by n-1 spaces
			}
		}
		else //the sentence is not complete
		{
			if(current != head && (foo == ' ' || foo == '\n')) //if we're at the start of a space.. 
				currSentence += 1; //..add the word that will begin

			if(foo >= 'A' && foo <= 'Z') //if capitalized
			{
				foo = foo + 32; //turn capitals into small letters
			}	

			if(foo > 'z' || foo < 'a') //if not alphabetic
			{
				(*current).val += 1; //the last word is considered ended
				current = head; //prepare for the start of a new word
			}
			else //it's alphabetic
			{
				if((*current).children == NULL)
				{
					(*current).children = calloc(256, sizeof(node*)); //then allocate it
					if((*current).children == NULL) //if the allocation failed
						exit(1); //exit failure
				}
				if((*current).children[(short)foo] == NULL) //if the specific child isn't ready
				{
					(*current).children[(short)foo] = calloc(1, sizeof(node)); //then allocate it
					if((*current).children[(short)foo] == NULL) //if the allocation failed
						exit(1); //exit failure

					(*((*current).children[(short)foo])).val = 0;	
				}
				current = (*current).children[(short)foo]; //move current to the next letter in the trie descent				
			}
		}
		foo = READCHAR; //read in the next char
	} //the read ends here

	if((*head).children != NULL) //if the head node has a child array 
	{
		char *string = calloc(2, sizeof(char)); //make a short array for making a char into a null-terminated array
		string[1] = '\0'; //the null that terminates; this is handy for using string methods

		for(char a='a';a<='z';a++) //for each character of the alphabet
		{
			string[0] = a; //put it into the short array
			if((*head).children[(short)a] != NULL) //if that child exists, then recurse
				recurse((*head).children[(short)a], string, input, output, files);
		}
//.........这里部分代码省略.........
开发者ID:haeroe,项目名称:reader,代码行数:101,代码来源:hreader.c


示例14: parse_env

//针对系统变量中有些集合形式的参数,取出来,存入集合中
void parse_env(string param_name,vector<string>& v,string delims){
	string params(getenv(param_name.c_str()));
	parse_strings(params,v,delims);
}
开发者ID:zhaomasha,项目名称:panda_new,代码行数:5,代码来源:panda_util.cpp


示例15: create

int exception_dtable::create(int dfd, const char * file, const params & config, dtable::iter * source, const ktable * shadow)
{
	int excp_dfd, r;
	memory_dtable alt_mdt;
	reject_iter * handler;
	params base_config, alt_config;
	blob reject_value;
	const dtable_factory * base = dtable_factory::lookup(config, "base");
	const dtable_factory * alt = dtable_factory::lookup(config, "alt");
	if(!base || !alt)
		return -EINVAL;
	if(!config.get("base_config", &base_config, params()))
		return -EINVAL;
	if(!config.get("alt_config", &alt_config, params()))
		return -EINVAL;
	if(!config.get_blob_or_string("reject_value", &reject_value))
		return -EINVAL;
	/* the reject value must exist, because nonexistent values
	 * can get pruned out if the shadow does not require them */
	if(!reject_value.exists())
		return -EINVAL;
	
	if(!source_shadow_ok(source, shadow))
		return -EINVAL;
	
	r = mkdirat(dfd, file, 0755);
	if(r < 0)
		return r;
	excp_dfd = openat(dfd, file, O_RDONLY);
	if(excp_dfd < 0)
		goto fail_open;
	/* we should really save the reject_value in a meta file here */
	
	/* we'll always be appending, but it's faster if we say false here */
	r = alt_mdt.init(source->key_type(), false, true);
	if(r < 0)
		goto fail_mdt;
	if(source->get_blob_cmp())
		alt_mdt.set_blob_cmp(source->get_blob_cmp());
	
	handler = new reject_iter(source, &alt_mdt, reject_value);
	if(!handler)
		goto fail_mdt;
	
	r = base->create(excp_dfd, "base", base_config, handler, shadow);
	if(r < 0)
		goto fail_base;
	
	/* no shadow - this only has exceptions */
	r = alt->create(excp_dfd, "alt", alt_config, &alt_mdt, NULL);
	if(r < 0)
		goto fail_alt;
	
	delete handler;
	close(excp_dfd);
	return 0;
	
fail_alt:
	util::rm_r(excp_dfd, "base");
fail_base:
	delete handler;
fail_mdt:
	close(excp_dfd);
fail_open:
	unlinkat(dfd, file, AT_REMOVEDIR);
	return -1;
}
开发者ID:nathansgreen,项目名称:anvil,代码行数:67,代码来源:exception_dtable.cpp


示例16: main

int main (int argc, char * argv[])
{
  //ofstream fout("/dev/null");
  //cout.rdbuf(fout.rdbuf());
	if (strcmp(argv[ARG_EVAL_MODE], "evalGrad") == 0)
	{
			estimationMode = EVALGRAD;
	}	else if (strcmp(argv[ARG_EVAL_MODE], "oneStep") == 0) {
			estimationMode = ONESTEPPROJECT;
	}	else if (strcmp(argv[ARG_EVAL_MODE], "fullMini") == 0) {
			estimationMode = FULLMINIMIZATION;
	}	else	{
		std::cerr << "incorrect evaluation mode" << std::endl;
		exit(0);
	}


	

  //set the directory with thread information
  /*if (argc > 2 && !strcmp(argv[1], "est"))
  {
    sprintf(opt_info_dir, "%s", argv[2]);
  } else {
    sprintf(opt_info_dir, "config");
  }
  */
  sprintf(opt_info_dir, "config");

  char thread_file[256];
  sprintf(thread_file, "%s/%s", opt_info_dir, argv[ARG_PARAM_FILE]); 
  Trajectory_Reader traj_reader(thread_file);
  traj_reader.read_threads_from_file();
  
  //all_threads.resize(traj_reader.get_all_threads().size());
	all_threads.resize(0);
  scores_each_thread.resize(traj_reader.get_all_threads().size());
  angle_scores_each_thread.resize(traj_reader.get_all_threads().size());
  orig_points.resize(traj_reader.get_all_threads().size());
	orig_twist_angles.resize(traj_reader.get_all_threads().size());
  for (int i=0; i < traj_reader.get_all_threads().size(); i++)
  {
		all_threads.push_back(traj_reader.get_all_threads()[i]);
		all_threads.back().get_thread_data(orig_points[i], orig_twist_angles[i]);
//    all_threads[i] = traj_reader.get_all_threads()[i];
//		all_threads[i].get_thread_data(orig_points[i], orig_twist_angles[i]);
  }
	
	double min_twist = atof(argv[ARG_MIN_TWIST]);
	double iter_twist = atof(argv[ARG_IT 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ params_buffer_bytes函数代码示例发布时间:2022-05-30
下一篇:
C++ parameters_update函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap