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


C++ Flag::check方法代码示例

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


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

示例1: Stream

void ImperxStream::Stream(unsigned char *frame, Semaphore &frame_semaphore, Flag &stream_flag)
{
    // The pipeline is already "armed", we just have to tell the device
    // to start sending us images
    printf( "Sending StartAcquisition command to device\n" );
    lDeviceParams->ExecuteCommand( "AcquisitionStart" );

    char lDoodle[] = "|\\-|-/";
    int lDoodleIndex = 0;
    PvInt64 lImageCountVal = 0;
    double lFrameRateVal = 0.0;
    double lBandwidthVal = 0.0;

    // Acquire images until the user instructs us to stop
    printf( "\n<press a key to stop streaming>\n" );
    while ( stream_flag.check() )
    {
	std::cout << "here\n";
	// Retrieve next buffer		
	PvBuffer *lBuffer = NULL;
	PvResult  lOperationResult;
	PvResult lResult = lPipeline.RetrieveNextBuffer( &lBuffer, 1000, &lOperationResult );
        
	if ( lResult.IsOK() )
        {
	    if ( lOperationResult.IsOK() )
            {
		// Process Buffer
		lStreamParams->GetIntegerValue( "ImagesCount", lImageCountVal );
		lStreamParams->GetFloatValue( "AcquisitionRateAverage", lFrameRateVal );
		lStreamParams->GetFloatValue( "BandwidthAverage", lBandwidthVal );
            
		// If the buffer contains an image, display width and height
		PvUInt32 lWidth = 0, lHeight = 0;
		if ( lBuffer->GetPayloadType() == PvPayloadTypeImage )
		{
		    // Get image specific buffer interface
		    PvImage *lImage = lBuffer->GetImage();

		    // Read width, height
		    lWidth = lBuffer->GetImage()->GetWidth();
		    lHeight = lBuffer->GetImage()->GetHeight();
		    stream_flag.raise();	    

		}

		std::cout << lWidth << " " << lHeight << "\n";
	    
            }
	    // We have an image - do some processing (...) and VERY IMPORTANT,
	    // release the buffer back to the pipeline
	    //semaphore thing
	    //get all in there.
	    //a semaphore thing
    	
	    lPipeline.ReleaseBuffer( lBuffer );
        }
	else
        {
	    // Timeout
	    printf( "%c Timeout\r", lDoodle[ lDoodleIndex ] );
        }

	++lDoodleIndex %= 6;

    }
}
开发者ID:cello623,项目名称:SAS,代码行数:67,代码来源:ImperxStream.cpp

示例2: printf

void *ImageProcessThread(void *threadargs)
{
    long tid = (long)((struct Thread_data *)threadargs)->thread_id;
    printf("ImageProcess thread #%ld!\n", tid);

    CoordList localLimbs, localPixelFiducials, localScreenFiducials;
    IndexList localIds;
    uint8_t localMin, localMax;
    std::vector<float> localMapping;
    cv::Point2f localPixelCenter, localScreenCenter, localError;
    timespec waittime;

    waittime.tv_sec = frameRate.tv_sec/10;
    waittime.tv_nsec = frameRate.tv_nsec/10;
    
    while(1)
    {
        if (stop_message[tid] == 1)
        {
            printf("ImageProcess thread #%ld exiting\n", tid);
            started[tid] = false;
            pthread_exit( NULL );
        }
        
        if (cameraReady)
        {
            while(1)
            {
                if(procReady.check())
                {
                    procReady.lower();
                    break;
                }
                else
                {
                    nanosleep(&waittime, NULL);
                }
            }
    
            //printf("ImageProcessThread: trying to lock\n");
            if (pthread_mutex_trylock(&mutexImage) == 0)
            {
                //printf("ImageProcessThread: got lock\n");
                if(!frame.empty())
                {
                    aspect.LoadFrame(frame);

                    pthread_mutex_unlock(&mutexImage);

                    runResult = aspect.Run();
                    
                    switch(GeneralizeError(runResult))
                    {
                        case NO_ERROR:
                            aspect.GetScreenFiducials(localScreenFiducials);
                            aspect.GetScreenCenter(localScreenCenter);
                            aspect.GetMapping(localMapping);

                        case MAPPING_ERROR:
                            aspect.GetFiducialIDs(localIds);

                        case ID_ERROR:
                            aspect.GetPixelFiducials(localPixelFiducials);

                        case FIDUCIAL_ERROR:
                            aspect.GetPixelCenter(localPixelCenter);
                            aspect.GetPixelError(localError);

                        case CENTER_ERROR:
                            aspect.GetPixelCrossings(localLimbs);
                            if (REPORT_FOCUS) aspect.ReportFocus();

                        case LIMB_ERROR:
                        case RANGE_ERROR:
                            aspect.GetPixelMinMax(localMin, localMax);
                            break;
                        default:
                            std::cout << "Nothing worked\n";
                    }

                    pthread_mutex_lock(&mutexProcess);
                    switch(GeneralizeError(runResult))
                    {
                        case NO_ERROR:
                            screenFiducials = localScreenFiducials;
                            screenCenter = localScreenCenter;
                            mapping = localMapping;
                        case MAPPING_ERROR:
                            ids = localIds;

                        case ID_ERROR:
                            pixelFiducials = localPixelFiducials;

                        case FIDUCIAL_ERROR:
                            pixelCenter = localPixelCenter;  
                            error = localError;

                        case CENTER_ERROR:
                            limbs = localLimbs;

//.........这里部分代码省略.........
开发者ID:kjgregory,项目名称:SAS,代码行数:101,代码来源:sunDemo.cpp


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