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

C++ HANDLE_ERROR函数代码示例

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

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



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

示例1: checkTriggerReady

FlyCaptureError
checkTriggerReady(
                  FlyCaptureContext context )
{
   FlyCaptureError   error;

   unsigned long     ulValue;

   // 
   // Do our check to make sure the camera is ready to be triggered
   // by looking at bits 30-31. Any value other than 1 indicates
   // the camera is not ready to be triggered.
   //
   error = flycaptureGetCameraRegister( 
      context, SOFT_ASYNC_TRIGGER, &ulValue );
   HANDLE_ERROR( "flycaptureGetCameraRegister()", error );

   while( ulValue != 0x80000001 )
   {
      error = flycaptureGetCameraRegister( 
         context, SOFT_ASYNC_TRIGGER, &ulValue );
      HANDLE_ERROR( "flycaptureGetCameraRegister()", error );
   }

   return FLYCAPTURE_OK;
}
开发者ID:PrincetonPAVE,项目名称:old_igvc,代码行数:26,代码来源:main.cpp


示例2: assert

double HackRFSource::set_sample_rate( double rate )
{
  assert(this->m_dev != nullptr);

  int status = HACKRF_SUCCESS;
  double _sample_rates[] = {
    8e6,
    10e6,
    12.5e6,
    16e6,
    20e6};

  bool found_supported_rate = false;
  for( unsigned int i = 0; i < sizeof(_sample_rates)/sizeof(double); i++ ) {
    if(_sample_rates[i] == rate) {
      found_supported_rate = true;
      break;
    }
  }

  if (!found_supported_rate) {
    status = HACKRF_ERROR_OTHER;
    HANDLE_ERROR("Unsupported samplerate: %gMsps", rate/1e6);
  }

  status = hackrf_set_sample_rate( this->m_dev, rate);
  HANDLE_ERROR("Error setting sample rate to %gMsps: %%s\n", rate/1e6);
}
开发者ID:wpats,项目名称:scanner,代码行数:28,代码来源:hackRFSource.cpp


示例3: raise_message

void raise_message(ErrorMode mode,
                   bool skipTop,
                   const std::string &msg) {
  if (mode == ErrorMode::ERROR) {
    HANDLE_ERROR(false, Always, "\nFatal error: ", skipTop);
    not_reached();
  }

  if (mode == ErrorMode::RECOVERABLE_ERROR) {
    HANDLE_ERROR(true, IfUnhandled, "\nCatchable fatal error: ", skipTop);
    return;
  }

  if (!g_context->errorNeedsHandling(static_cast<int>(mode), true,
                                     ExecutionContext::ErrorThrowMode::Never)) {
    return;
  }

  if (mode == ErrorMode::WARNING) {
    if (RuntimeOption::WarningFrequency <= 0 ||
        (g_warning_counter++) % RuntimeOption::WarningFrequency != 0) {
      return;
    }
    HANDLE_ERROR(true, Never, "\nWarning: ", skipTop);
    return;
  }

  if (RuntimeOption::NoticeFrequency <= 0 ||
      (g_notice_counter++) % RuntimeOption::NoticeFrequency != 0) {
    return;
  }

  raise_notice_helper(mode, skipTop, msg);
}
开发者ID:swtaarrs,项目名称:hhvm,代码行数:34,代码来源:runtime-error.cpp


示例4: hackrf_start_rx

bool HackRFSource::Start()
{
  if (this->m_streamingState != Streaming) {
    this->m_streamingState = Streaming;
    int status = hackrf_start_rx(this->m_dev, 
                                 _hackRF_rx_callback, 
                                 (void *)this);
    HANDLE_ERROR("Failed to start RX streaming: %%s\n");

    uint16_t frequencies[2];
    frequencies[0] = this->m_scanStartFrequency;
    frequencies[1] = this->m_scanStopFrequency;

    status = hackrf_init_sweep(this->m_dev, 
                               frequencies, 
                               1, // num_ranges 
                               this->m_scanNumBytes,
                               this->m_scanStepWidth, // TUNE_STEP * FREQ_ONE_MHZ, 
                               this->m_scanOffset, // OFFSET,
                               LINEAR);
    HANDLE_ERROR("Failed to set sweep parameters: %%s\n");
  }

  return true;
}
开发者ID:wpats,项目名称:scanner,代码行数:25,代码来源:hackRFSource.cpp


示例5: HANDLE_ERROR

void glcu::init_cuda()
{
    cudaDeviceProp prop = {0};
    int dev;
    prop.major = 1;
    prop.minor = 0;
    HANDLE_ERROR(cudaChooseDevice(&dev, &prop));
    HANDLE_ERROR(cudaGLSetGLDevice(dev));
}
开发者ID:Answeror,项目名称:cg,代码行数:9,代码来源:glcu.cpp


示例6: HANDLE_ERROR

float gpuNUFFT::GpuNUFFTOperator::stopTiming()
{
  float time;

  HANDLE_ERROR( cudaEventRecord(stop, 0) );
  HANDLE_ERROR( cudaEventSynchronize(stop) );
  HANDLE_ERROR( cudaEventElapsedTime(&time, start, stop) );
  return time;
}
开发者ID:davidssmith,项目名称:TRON,代码行数:9,代码来源:gpuNUFFT_operator.cpp


示例7: get_o_param

void get_o_param(int argc, char **argv, const char *module_getopt_string, const struct option *long_options)
{
   /* backup global variables */
   int bck_optind = optind, bck_optopt = optopt, bck_opterr = opterr;
   char *bck_optarg = optarg;
   signed char opt;

   // Add "i:" to getopt_string
   /* This is necessary because getopt rearragnes arguments in such a way that
      all positional agruments (i.e. not options) are put at the end of argv.
      If it wouldn't know about "-i" and that it requires argument, it would
      move the argument (ifc specifier) to the end of argv (but doesn't move 
      the "-i").
      trap_parse_params (within TRAP_DEFAULT_INITIALIZATION) would than fail.
   */
   char *getopt_string_with_i = malloc(strlen(module_getopt_string) + 3);
   sprintf(getopt_string_with_i, "%s%s", module_getopt_string, "i:");

   opterr = 0;                  /* disable getopt error output */
   while ((opt = TRAP_GETOPT(argc, argv, getopt_string_with_i, long_options)) != -1) {
      switch (opt) {
      case 'o':
         {
            char *endptr;
            long int tmp_interval;

            errno = 0;
            tmp_interval = strtol(optarg, &endptr, 0);
            if (errno) {
               HANDLE_PERROR("-o");
            } else if (*optarg == '\0') {
               HANDLE_ERROR("-o: missing argument");
            } else if (*endptr != '\0') {
               HANDLE_ERROR("-o: bad argument");
            } else if (tmp_interval <= 0 || tmp_interval >= INTERVAL_LIMIT) {
               HANDLE_ERROR("-o: bad interval range");
            }
            send_interval = tmp_interval;
            break;
         }
      default:
         if (optopt == 'o') {
            HANDLE_ERROR("-o: missing argument");
         }
         break;
      }
   }

   free(getopt_string_with_i);

   /* restore global variables */
   optind = bck_optind;
   optopt = bck_optopt;
   opterr = bck_opterr;
   optarg = bck_optarg;
}
开发者ID:Dragonn,项目名称:Nemea-Modules,代码行数:56,代码来源:flowcounter.c


示例8: hackrf_stop_rx

HackRFSource::~HackRFSource()
{
  if (this->m_dev != nullptr) {
    int status = hackrf_stop_rx(this->m_dev);
    double centerFrequency = this->GetCurrentFrequency();
    HANDLE_ERROR("Failed to stop RX streaming at %u: %%s\n", centerFrequency);
    status = hackrf_close(this->m_dev);
    HANDLE_ERROR("Error closing hackrf: %%s\n");
  }
}
开发者ID:wpats,项目名称:scanner,代码行数:10,代码来源:hackRFSource.cpp


示例9: HANDLE_ERROR

/*
 * Initialize an OS timer. The initialization steps are:
 *
 *    create priority queue
 *    install signal handler
 *
 * We also initialize the timer_block_mask if it has not been initialized yet.
 */
ostimer_s *__ostimer_init(timer_s *tp, enum timer_types type)
{
#ifndef NO_POSIX_SIGS
   struct sigaction  sa ;
#else
   struct sigvec     sv ;
#endif
   ostimer_s   		*otp ;
   struct timer_q    *tqp ;

	/*
	 * Find the corresponding ostimer
	 */
	if ( ( otp = ostimer_find( type ) ) == OSTIMER_NULL )
		HANDLE_ERROR( tp->t_flags, OSTIMER_NULL,
			tp->t_errnop, TIMER_ENOTAVAILABLE,
				"TIMER __ostimer_init: requested timer type not available\n" ) ;

	/*
	 * We use the value of ost_timerq to determine if the os_timer
	 * has been initialized.
	 */
   tqp = &otp->ost_timerq ;
	if ( tqp->tq_handle )
		return( otp ) ;

   tqp->tq_handle = pq_create( time_compare,
				tp->t_flags & TIMER_RETURN_ERROR ? PQ_RETURN_ERROR : PQ_NOFLAGS,
										&tqp->tq_errno ) ;
   if ( tqp->tq_handle == NULL )
   {
      *tp->t_errnop = TIMER_ENOMEM ;
      return( OSTIMER_NULL ) ;
   }

   if ( ! timer_block_mask_set )
      set_timer_block_mask() ;

#ifndef NO_POSIX_SIGS
   sa.sa_handler = otp->ost_handler ;
   sa.sa_mask = timer_block_mask ;
   sa.sa_flags = 0 ;
   if ( sigaction( otp->ost_signal, &sa, SIGACTION_NULL ) == -1 )
#else
   sv.sv_handler = otp->ost_handler ;
   sv.sv_mask = timer_block_mask ;
   sv.sv_flags = 0 ;
   if ( sigvec( otp->ost_signal, &sv, SIGVEC_NULL ) == -1 )
#endif
      HANDLE_ERROR( tp->t_flags, OSTIMER_NULL, tp->t_errnop, TIMER_ESIGPROBLEM,
         "TIMER __ostimer_init: signal handler installation failed\n" ) ;
   return( otp ) ;
}
开发者ID:SethRobertson,项目名称:libclc,代码行数:61,代码来源:sysdep.c


示例10: while

void SwiftReader::readResults(QTextStream& stream)
{
    QString line;
    int lineNum = 0;
    while (!stream.atEnd())
    {
        line = stream.readLine();
        ++lineNum;
        if (lineParser.exactMatch(line))
        {
            QStringList decimals = lineParser.capturedTexts();
            Orbit d;
            bool ok = true;
            #define HANDLE_ERROR(index) \
                if (!ok) { \
                std::ostringstream os; \
                os << "Could not decode decimal " << decimals.at(index).toAscii().data(); \
                throw std::runtime_error(os.str()); \
                }
            d.time = decimals.at(1).toDouble(&ok); HANDLE_ERROR(1);
            d.particleID = decimals.at(2).toDouble(&ok); HANDLE_ERROR(2);
            d.axis = decimals.at(3).toDouble(&ok) * 25559; HANDLE_ERROR(3);
            d.e = decimals.at(4).toDouble(&ok); HANDLE_ERROR(4);
            d.i = decimals.at(5).toDouble(&ok); HANDLE_ERROR(5);
            d.Omega = decimals.at(6).toDouble(&ok); HANDLE_ERROR(6);
            d.w = decimals.at(7).toDouble(&ok); HANDLE_ERROR(7);
            d.f = decimals.at(8).toDouble(&ok); HANDLE_ERROR(8);
            d.hasOrbEls = true;
            data[d.particleID].push_back(d);
        }
    }
}
开发者ID:dtamayo,项目名称:OGRE,代码行数:32,代码来源:SwiftReader.cpp


示例11: checkSoftwareTriggerPresence

//=============================================================================
// Function Definitions
//=============================================================================
FlyCaptureError
checkSoftwareTriggerPresence( 
                             FlyCaptureContext  context,
                             unsigned int       uiRegister )
{
   FlyCaptureError   error;

   unsigned long     ulValue;
   
   switch( uiRegister )
   {
      case SOFT_ASYNC_TRIGGER:
         error = flycaptureGetCameraRegister( 
            context, SOFT_ASYNC_TRIGGER, &ulValue );
         HANDLE_ERROR( "flycaptureGetCameraRegister()", error );

         //
         // Check the Presence_Inq field of the register; bit 0 == 1 indicates
         // presence of this feature.
         //
         if( ( ulValue & 0x80000000 ) == 0x80000000 )
         {
            return FLYCAPTURE_OK;
         }
         else
         {
            return FLYCAPTURE_NOT_IMPLEMENTED;
         }
      case SOFTWARE_TRIGGER:
         error = flycaptureGetCameraRegister( 
            context, TRIGGER_INQ, &ulValue );
         HANDLE_ERROR( "flycaptureGetCameraRegister()", error );

         //
         // Check the Software_Trigger_Inq field of the register; bit 15 == 1 
         // indicates presence of this feature.
         //
         if( ( ulValue & 0x10000 ) == 0x10000 )
         {
            return FLYCAPTURE_OK;
         }
         else
         {
            return FLYCAPTURE_NOT_IMPLEMENTED;
         }
      default:
         return FLYCAPTURE_INVALID_ARGUMENT;
   }
}
开发者ID:PrincetonPAVE,项目名称:old_igvc,代码行数:52,代码来源:main.cpp


示例12: while

void HackRFSource::ThreadWorker()
{
  while (true) {
    StreamingState state = this->m_streamingState;
    switch (state) {
    case Streaming:
    case Done:
      break;
    case DoRetune:
      {
        double nextFrequency = this->GetNextFrequency();
        this->Retune(nextFrequency);
        this->m_didRetune = true;
        //struct timeval increment = {0, 5000}, currentTime;
        //gettimeofday(&currentTime, nullptr);
        //timeradd(&currentTime, &increment, &this->m_nextValidStreamTime);
        this->m_dropPacketCount = ceil(this->m_sampleRate * this->m_retuneTime / 131072);
        StreamingState expected = DoRetune;
        while (!this->m_streamingState.compare_exchange_strong(expected, Streaming)) {
        }
      }
      break;
    }
    if (state == Done) {
      break;
    }
  }
  int status = hackrf_stop_rx(this->m_dev);
  HANDLE_ERROR("Failed to stop RX streaming: %%s\n");
}
开发者ID:wpats,项目名称:scanner,代码行数:30,代码来源:hackRFSource.cpp


示例13: main

int main(int argc, char** argv)
    {
    if (Device::isCuda())
	{
	gpu::GLUTImageViewers::init(argc, argv);

	// Device::printAll();
	Device::printAllSimple();

	// Server Cuda1: in [0,5]
	// Server Cuda2: in [0,2]
	int deviceId = 0;

	initCuda(deviceId);

	int isOk = start();

	//cudaDeviceReset causes the driver to clean up all state.
	// While not mandatory in normal operation, it is good practice.
	HANDLE_ERROR(cudaDeviceReset());

	return isOk;
	}
    else
	{
	return EXIT_FAILURE;
	}
    }
开发者ID:Drakesinger,项目名称:CUDA-OMP-GPGPU,代码行数:28,代码来源:main.cpp


示例14: testConnection

int64_t PDOPgSqlConnection::doer(const String& sql){
  testConnection();

  const char* query = sql.data();

  PQ::Result res = m_server->exec(query);

  if(!res){
    // I think this error should be handled in a different way perhaps?
    handleError(nullptr, "XX000", "Invalid result data");
    return -1;
  }

  ExecStatusType status = m_lastExec = res.status();

  int64_t ret;

  if(status == PGRES_COMMAND_OK){
    ret = (int64_t)res.cmdTuples();
  } else if(status == PGRES_TUPLES_OK) {
    ret = 0L;
  } else {
    HANDLE_ERROR(nullptr, res);
    return -1L;
  }

  this->pgoid = res.oidValue();

  return ret;
}
开发者ID:HilayPatel,项目名称:hhvm,代码行数:30,代码来源:pdo_pgsql_connection.cpp


示例15: obs_register_encoder_s

void obs_register_encoder_s(const struct obs_encoder_info *info, size_t size)
{
	if (find_encoder(info->id)) {
		encoder_warn("Encoder id '%s' already exists!  "
		                  "Duplicate library?", info->id);
		goto error;
	}

#define CHECK_REQUIRED_VAL_(info, val, func) \
	CHECK_REQUIRED_VAL(struct obs_encoder_info, info, val, func)
	CHECK_REQUIRED_VAL_(info, get_name, obs_register_encoder);
	CHECK_REQUIRED_VAL_(info, create,   obs_register_encoder);
	CHECK_REQUIRED_VAL_(info, destroy,  obs_register_encoder);
	CHECK_REQUIRED_VAL_(info, encode,   obs_register_encoder);

	if (info->type == OBS_ENCODER_AUDIO)
		CHECK_REQUIRED_VAL_(info, get_frame_size, obs_register_encoder);
#undef CHECK_REQUIRED_VAL_

	REGISTER_OBS_DEF(size, obs_encoder_info, obs->encoder_types, info);
	return;

error:
	HANDLE_ERROR(size, obs_encoder_info, info);
}
开发者ID:AhmedAbdulSalam5,项目名称:obs-studio,代码行数:25,代码来源:obs-module.c


示例16: obs_register_output_s

void obs_register_output_s(const struct obs_output_info *info, size_t size)
{
	if (find_output(info->id)) {
		output_warn("Output id '%s' already exists!  "
		                  "Duplicate library?", info->id);
		goto error;
	}

#define CHECK_REQUIRED_VAL_(info, val, func) \
	CHECK_REQUIRED_VAL(struct obs_output_info, info, val, func)
	CHECK_REQUIRED_VAL_(info, get_name, obs_register_output);
	CHECK_REQUIRED_VAL_(info, create,   obs_register_output);
	CHECK_REQUIRED_VAL_(info, destroy,  obs_register_output);
	CHECK_REQUIRED_VAL_(info, start,    obs_register_output);
	CHECK_REQUIRED_VAL_(info, stop,     obs_register_output);

	if (info->flags & OBS_OUTPUT_ENCODED) {
		CHECK_REQUIRED_VAL_(info, encoded_packet, obs_register_output);
	} else {
		if (info->flags & OBS_OUTPUT_VIDEO)
			CHECK_REQUIRED_VAL_(info, raw_video,
					obs_register_output);

		if (info->flags & OBS_OUTPUT_AUDIO)
			CHECK_REQUIRED_VAL_(info, raw_audio,
					obs_register_output);
	}
#undef CHECK_REQUIRED_VAL_

	REGISTER_OBS_DEF(size, obs_output_info, obs->output_types, info);
	return;

error:
	HANDLE_ERROR(size, obs_output_info, info);
}
开发者ID:AhmedAbdulSalam5,项目名称:obs-studio,代码行数:35,代码来源:obs-module.c


示例17: flap

bool Omegle_client::stop()
{
	if (parent->isOffline())
		return true;

	HANDLE_ENTRY;

	std::string data = "id=" + this->chat_id_;

	http::response resp = flap(OMEGLE_REQUEST_STOP, &data);

	if (hConnection)
		Netlib_CloseHandle(hConnection);
	hConnection = NULL;

	if (hEventsConnection)
		Netlib_CloseHandle(hEventsConnection);
	hEventsConnection = NULL;

	if (resp.data == "win") {
		return HANDLE_SUCCESS;
	}
	else {
		return HANDLE_ERROR(false);
	}

	/*	switch ( resp.code )
		{
		case HTTP_CODE_OK:
		case HTTP_CODE_FOUND:

		default:

		}*/
}
开发者ID:kxepal,项目名称:miranda-ng,代码行数:35,代码来源:communication.cpp


示例18: copyDeviceToDevice

inline void copyDeviceToDevice(TypeName *device_ptr_src,
                               TypeName *device_ptr_dest, IndType num_elements)
{
  HANDLE_ERROR(cudaMemcpy(device_ptr_dest, device_ptr_src,
                          num_elements * sizeof(TypeName),
                          cudaMemcpyDeviceToDevice));
}
开发者ID:andyschwarzl,项目名称:gpuNUFFT,代码行数:7,代码来源:cuda_utils.hpp


示例19: raise_notice_helper

static void raise_notice_helper(ErrorMode mode, bool skipTop,
                                const std::string& msg) {
  switch (mode) {
    case ErrorMode::STRICT:
      HANDLE_ERROR(true, Never, "\nStrict Warning: ", skipTop);
      break;
    case ErrorMode::NOTICE:
      HANDLE_ERROR(true, Never, "\nNotice: ", skipTop);
      break;
    case ErrorMode::PHP_DEPRECATED:
      HANDLE_ERROR(true, Never, "\nDeprecated: ", skipTop);
      break;
    default:
      always_assert(!"Unhandled type of error");
  }
}
开发者ID:swtaarrs,项目名称:hhvm,代码行数:16,代码来源:runtime-error.cpp


示例20: ofp_rt_lookup_init_global

int ofp_rt_lookup_init_global(void)
{
	int i;

	HANDLE_ERROR(ofp_rt_lookup_alloc_shared_memory());

	memset(shm, 0, sizeof(*shm));

	for (i = 0; i < NUM_NODES; i++)
		shm->small_list[i][0].next = (i == NUM_NODES - 1) ?
			NULL : &(shm->small_list[i+1][0]);
	shm->free_small = shm->small_list[0];

	for (i = 0; i < NUM_NODES_LARGE; i++)
		shm->large_list[i][0].next = (i == NUM_NODES_LARGE - 1) ?
			NULL : &(shm->large_list[i+1][0]);
	shm->free_large = shm->large_list[0];

	for (i = 0; i < NUM_NODES_6; i++) {
		shm->node_list6[i].left = (i == 0) ?
			NULL : &(shm->node_list6[i-1]);
		shm->node_list6[i].right = (i == NUM_NODES_6 - 1) ?
			NULL : &(shm->node_list6[i+1]);
	}
	shm->free_nodes6 = &(shm->node_list6[0]);

	return 0;
}
开发者ID:chyyuu,项目名称:ofp,代码行数:28,代码来源:ofp_rt_mtrie_lookup.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ HANDLE_GET_KIND函数代码示例发布时间:2022-05-30
下一篇:
C++ HANDLE_EINTR函数代码示例发布时间: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