本文整理汇总了C++中raise_exception函数的典型用法代码示例。如果您正苦于以下问题:C++ raise_exception函数的具体用法?C++ raise_exception怎么用?C++ raise_exception使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了raise_exception函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: check_if_answer_is_complete
MODULE check_if_answer_is_complete (THREAD *thread)
{
Bool
complete;
tcb = thread-> tcb; /* Point to thread's context */
complete = rdns_check_answer_size (tcb-> query, (dbyte)tcb-> readsize);
if (complete == FALSE)
raise_exception (read_more_event);
}
开发者ID:imatix-legacy,项目名称:xitami,代码行数:10,代码来源:smtrdns.c
示例2: helper_boundl
void helper_boundl(CPUX86State *env, target_ulong a0, int v)
{
int low, high;
low = cpu_ldl_data(env, a0);
high = cpu_ldl_data(env, a0 + 4);
if (v < low || v > high) {
raise_exception(env, EXCP05_BOUND);
}
}
开发者ID:AlexWWW,项目名称:qemu-linaro-clone,代码行数:10,代码来源:mem_helper.c
示例3: raise_exception
const InputEventDefinition&
ControllerDescription::get_definition(int id) const
{
std::map<int, InputEventDefinition>::const_iterator i = id_to_event.find(id);
if (i == id_to_event.end())
{
raise_exception(std::runtime_error, "Unknown event id");
}
return i->second;
}
开发者ID:AMDmi3,项目名称:pingus,代码行数:10,代码来源:controller_description.cpp
示例4: Java_org_zeromq_ZMQ_00024Socket_getLongSockopt
/**
* Called by Java's Socket::getLongSockopt(int option).
*/
JNIEXPORT jlong JNICALL Java_org_zeromq_ZMQ_00024Socket_getLongSockopt (JNIEnv *env,
jobject obj,
jint option)
{
switch (option) {
#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(2,1,0)
case ZMQ_TYPE:
case ZMQ_FD:
case ZMQ_EVENTS:
case ZMQ_LINGER:
#endif
case ZMQ_HWM:
case ZMQ_SWAP:
case ZMQ_AFFINITY:
case ZMQ_RATE:
case ZMQ_RECOVERY_IVL:
case ZMQ_MCAST_LOOP:
case ZMQ_SNDBUF:
case ZMQ_RCVBUF:
case ZMQ_RCVMORE:
{
void *s = get_socket (env, obj, 1);
jlong ret = 0;
int rc = 0;
int err = 0;
uint64_t optval = 0;
size_t optvallen = sizeof(optval);
rc = zmq_getsockopt (s, option, &optval, &optvallen);
err = zmq_errno();
ret = (jlong) optval;
if (rc != 0) {
raise_exception (env, err);
return 0L;
}
return ret;
}
default:
raise_exception (env, EINVAL);
return 0L;
}
}
开发者ID:abelaska,项目名称:jzmq,代码行数:46,代码来源:Socket.cpp
示例5: checkError
/** @brief Checks whether an OpenCL error has occured.
*
* Do not use this function directly, use the macro CL_ERROR_CHECK instead.
*/
static void checkError(cl_int err, const std::string & file, const std::string & func, int line)
{
if (err != CL_SUCCESS)
{
#ifdef VIENNACL_DEBUG_ALL
std::cerr << "ViennaCL: Error " << err << " in function " << func << " ( "<< file << ":" << line << " ) " << std::endl;
#endif
raise_exception(err);
}
} //checkError()
开发者ID:eugentorica,项目名称:ViennaCL-Image,代码行数:14,代码来源:error.hpp
示例6: AerospikeScan_Results
PyObject * AerospikeScan_Results(AerospikeScan * self, PyObject * args, PyObject * kwds)
{
PyObject * py_policy = NULL;
as_policy_scan scan_policy;
as_policy_scan * scan_policy_p = NULL;
static char * kwlist[] = {"policy", NULL};
if ( PyArg_ParseTupleAndKeywords(args, kwds, "|O:results", kwlist, &py_policy) == false ) {
return NULL;
}
as_error err;
as_error_init(&err);
if (!self || !self->client->as) {
as_error_update(&err, AEROSPIKE_ERR_PARAM, "Invalid aerospike object");
goto CLEANUP;
}
if (!self->client->is_conn_16) {
as_error_update(&err, AEROSPIKE_ERR_CLUSTER, "No connection to aerospike cluster");
goto CLEANUP;
}
// Convert python policy object to as_policy_scan
pyobject_to_policy_scan(&err, py_policy, &scan_policy, &scan_policy_p,
&self->client->as->config.policies.scan);
if ( err.code != AEROSPIKE_OK ) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}
PyObject * py_results = NULL;
py_results = PyList_New(0);
PyThreadState * _save = PyEval_SaveThread();
aerospike_scan_foreach(self->client->as, &err, scan_policy_p, &self->scan, each_result, py_results);
PyEval_RestoreThread(_save);
CLEANUP:
if ( err.code != AEROSPIKE_OK ) {
PyObject * py_err = NULL;
error_to_pyobject(&err, &py_err);
PyObject *exception_type = raise_exception(&err);
PyErr_SetObject(exception_type, py_err);
Py_DECREF(py_err);
return NULL;
}
return py_results;
}
开发者ID:hirokikana,项目名称:aerospike-client-python,代码行数:55,代码来源:results.c
示例7: find_loader_by_filename
std::vector<std::string>
ArchiveManager::get_filenames(const std::string& zip_filename,
const ArchiveLoader** loader_out) const
{
auto loader = find_loader_by_filename(zip_filename);
if (!loader)
{
raise_exception(std::runtime_error, "failed to find loader for archive file: " << zip_filename);
}
else
{
try
{
if (loader_out) { *loader_out = loader; }
return loader->get_filenames(zip_filename);
}
catch(const std::exception& err)
{
auto new_loader = find_loader_by_magic(zip_filename);
if (!new_loader || new_loader == loader)
{
throw;
return std::vector<std::string>();
}
else
{
loader = new_loader;
if (!loader)
{
raise_exception(std::runtime_error, "failed to find loader for archive file: " << zip_filename);
}
else
{
log_warning << err.what() << std::endl;
if (loader_out) { *loader_out = loader; }
return loader->get_filenames(zip_filename);
}
}
}
}
}
开发者ID:TravisDean,项目名称:galapix,代码行数:42,代码来源:archive_manager.cpp
示例8: log_info
void
System::create_dir(std::string directory)
{
#ifndef WIN32
log_info("System::create_dir: %1%", directory);
if (!exist(directory))
{
if (mkdir(directory.c_str(), S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP) != 0)
{
raise_exception(std::runtime_error, "System::create_dir: " << directory << ": " << strerror(errno));
}
else
{
log_info("Successfully created: %1%", directory);
}
}
#else
if (!CreateDirectory(directory.c_str(), 0))
{
DWORD dwError = GetLastError();
if (dwError == ERROR_ALREADY_EXISTS)
{
}
else if (dwError == ERROR_PATH_NOT_FOUND)
{
raise_exception(std::runtime_error,
"CreateDirectory: " << directory <<
": One or more intermediate directories do not exist; this function will only create the final directory in the path.");
}
else
{
raise_exception(std::runtime_error,
"CreateDirectory: " << directory << ": failed with error " << StringUtil::to_string(dwError));
}
}
else
{
log_info("Successfully created: %1%", directory);
}
#endif
}
开发者ID:Tkachov,项目名称:ceu_pingus,代码行数:42,代码来源:system.cpp
示例9: checkError
/** @brief Checks whether an OpenCL error has occured.
*
* Do not use this function directly, use the macro CL_ERROR_CHECK instead.
*/
static void checkError(cl_int err,
const std::string & file,
const std::string & func,
int line)
{
if (err != CL_SUCCESS)
{
std::cerr << "OpenCL: Error " << err << " in function " << func << " ( "<< file << ":" << line << " ) " << std::endl;
raise_exception(err);
}
} //checkError()
开发者ID:karlrupp,项目名称:phsp2014,代码行数:15,代码来源:ocl-error.hpp
示例10: m_udev
UdevSubsystem::UdevSubsystem() :
m_udev(),
m_monitor(),
m_process_match_cb()
{
m_udev = udev_new();
if (!m_udev)
{
raise_exception(std::runtime_error, "udev init failure");
}
}
开发者ID:brojudd,项目名称:ubuntu,代码行数:11,代码来源:udev_subsystem.cpp
示例11: helper_rdpmc
void helper_rdpmc(CPUX86State *env)
{
if ((env->cr[4] & CR4_PCE_MASK) && ((env->hflags & HF_CPL_MASK) != 0)) {
raise_exception(env, EXCP0D_GPF);
}
cpu_svm_check_intercept_param(env, SVM_EXIT_RDPMC, 0);
/* currently unimplemented */
qemu_log_mask(LOG_UNIMP, "x86: unimplemented rdpmc\n");
raise_exception_err(env, EXCP06_ILLOP, 0);
}
开发者ID:firmadyne,项目名称:qemu-linaro,代码行数:11,代码来源:misc_helper.c
示例12: music_sample
PingusSoundReal::PingusSoundReal() :
music_sample(0),
m_music_volume(1.0f),
m_sound_volume(1.0f),
m_master_volume(1.0f)
{
log_info("Initializing SDL audio");
if (SDL_Init(SDL_INIT_AUDIO) == -1)
{
raise_exception(std::runtime_error, "Unable to initialize SDL: " << SDL_GetError());
}
log_info("Initializing SDL_Mixer");
if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 4096) == -1)
{
raise_exception(std::runtime_error, "Unable to initialize SDL_Mixer: " << Mix_GetError());
}
}
开发者ID:kimlavoie,项目名称:BeepBeepPingus,代码行数:20,代码来源:sound_real.cpp
示例13: mce_irq_ipi
static void mce_irq_ipi(void *info)
{
int cpu = smp_processor_id();
struct mce *m = this_cpu_ptr(&injectm);
if (cpumask_test_cpu(cpu, mce_inject_cpumask) &&
m->inject_flags & MCJ_EXCEPTION) {
cpumask_clear_cpu(cpu, mce_inject_cpumask);
raise_exception(m, NULL);
}
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:11,代码来源:inject.c
示例14: catch
PyObject *EntryIterator_iternext(PyObject *self)
{
EntryIterator *entryIterator = reinterpret_cast<EntryIterator *>(self);
bool notAtEnd;
Py_BEGIN_ALLOW_THREADS
try {
notAtEnd = entryIterator->iter->hasNext();
} catch (ac::IterationInterrupted &e) {
Py_BLOCK_THREADS
PyErr_SetNone(PyExc_GeneratorExit);
return NULL;
} catch (std::runtime_error &e) {
Py_BLOCK_THREADS
raise_exception(e.what());
return NULL;
}
Py_END_ALLOW_THREADS
if (notAtEnd) {
ac::Entry e;
Py_BEGIN_ALLOW_THREADS
try {
e = entryIterator->iter->next(*entryIterator->reader->reader);
} catch (ac::IterationInterrupted &e) {
Py_BLOCK_THREADS
// XXX - throw a specific exception here
PyErr_SetNone(PyExc_GeneratorExit);
return NULL;
} catch (std::runtime_error &e) {
Py_BLOCK_THREADS
raise_exception(e.what());
return NULL;
}
Py_END_ALLOW_THREADS
PyObject *entry = Entry_new(e);
return entry;
} else {
开发者ID:andreasvc,项目名称:alpinocorpus-python,代码行数:41,代码来源:EntryIterator.cpp
示例15: in
std::string
Filesystem::get_magic(const std::string& filename)
{
char buf[512];
std::ifstream in(filename, std::ios::binary);
if (!in)
{
raise_exception(std::runtime_error, filename << ": " << strerror(errno));
}
else
{
if (!in.read(buf, sizeof(buf)))
{
raise_exception(std::runtime_error, filename << ": " << strerror(errno));
}
else
{
return std::string(buf, in.gcount());
}
}
}
开发者ID:TravisDean,项目名称:galapix,代码行数:21,代码来源:filesystem.cpp
示例16: raise_exception
void
ControllerSlotConfig::set_current_config(int num)
{
if (num >= 0 && num < static_cast<int>(m_config.size()))
{
m_current_config = num;
}
else
{
raise_exception(std::runtime_error, "argument out of range");
}
}
开发者ID:qunge12345,项目名称:ubuntu,代码行数:12,代码来源:controller_slot_config.cpp
示例17: raise_exception
Button2AxisModifier*
Button2AxisModifier::from_string(const std::vector<std::string>& args)
{
if (args.size() != 3)
{
raise_exception(std::runtime_error, "BUTTON:BUTTON:AXIS required as argument");
}
else
{
return new Button2AxisModifier(args[0], args[1], args[2]);
}
}
开发者ID:Ape,项目名称:xboxdrv,代码行数:12,代码来源:button2axis_modifier.cpp
示例18: get
/** Returns the id of the given name, throws on lookup failure */
int get(const T& name) const
{
typename std::map<T, int>::const_iterator it = m_name2int.find(name);
if (it == m_name2int.end())
{
raise_exception(std::runtime_error, "lookup failure for: '" << name << "'");
}
else
{
return it->second;
}
}
开发者ID:Ape,项目名称:xboxdrv,代码行数:13,代码来源:symbol_table.hpp
示例19: m_usb_gsource
USBSubsystem::USBSubsystem() :
m_usb_gsource()
{
int ret = libusb_init(NULL);
if (ret != LIBUSB_SUCCESS)
{
raise_exception(std::runtime_error, "libusb_init() failed: " << usb_strerror(ret));
}
m_usb_gsource.reset(new USBGSource);
m_usb_gsource->attach(NULL);
}
开发者ID:brojudd,项目名称:ubuntu,代码行数:12,代码来源:usb_subsystem.cpp
示例20: raise_exception
SplitAxisModifier*
SplitAxisModifier::from_string(const std::vector<std::string>& args)
{
if (args.size() != 3)
{
raise_exception(std::runtime_error, "SplitAxisModifier requires three arguments");
}
else
{
return new SplitAxisModifier(args[0], args[1], args[2]);
}
}
开发者ID:mrj10,项目名称:xboxdrv,代码行数:12,代码来源:split_axis_modifier.cpp
注:本文中的raise_exception函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论