本文整理汇总了C++中dispatch函数的典型用法代码示例。如果您正苦于以下问题:C++ dispatch函数的具体用法?C++ dispatch怎么用?C++ dispatch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dispatch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dispatch
Future<Option<Entry>> InMemoryStorage::get(const string& name)
{
return dispatch(process, &InMemoryStorageProcess::get, name);
}
示例2: cons_close
long
cons_close(long dev)
{
return dispatch(CCB_CLOSE, dev);
}
示例3: cons_close_console
void cons_close_console(void)
{
dispatch(CCB_CLOSE_CONSOLE);
}
示例4: dispatch
void Dialog::updateDialog() const
{
dispatch(FuncRequest(LFUN_DIALOG_UPDATE, fromqstr(name_)));
}
示例5: dispatch
void Output::pause()
{
pause_ = !pause_;
PlayerUtils::State state = pause_ ? PlayerUtils::Paused : PlayerUtils::Playing;
dispatch(state);
}
示例6: handle_user_page_fault
/*
* Try to find out what address generated page fault, and then tell the dispatcher what
* happened. Some faults will not be recoverable (e.g. stack faults), because the
* context has already been lost
*/
void handle_user_page_fault(arch_registers_state_t* save_area)
{
lvaddr_t fault_address;//not passed as argument, because there is not just one place to look
/*
//print out registers for debugging
printf("page fault. registers:\n");
for(uint32_t i = 0; i<NUM_REGS; i++){
printf("0x%x\n", save_area->regs[i]);
}
uint32_t regval;
__asm volatile ("mrs %[regval], xpsr" : [regval] "=r"(regval));
printf("current XPSR register: 0x%x\n", regval);
printf("M3 MMU address: 0x%x\n", *((uint32_t*) &mmu));
printf("M3 MMU_FAULT_AD register: 0x%x\n", omap44xx_mmu_fault_ad_rd(&mmu));
printf("M3 MMU_FAULT_STATUS register: 0x%x\n", omap44xx_mmu_fault_status_rd(&mmu));
printf("M3 MMU_FAULT_PC register: 0x%x\n", omap44xx_mmu_fault_pc_rd(&mmu));
printf("M3 MMU_IRQSTATUS register: 0x%x\n", omap44xx_mmu_irqstatus_rd(&mmu));
printf("ICTR: 0x%x\n", omap44xx_cortex_m3_nvic_ICTR_rd(&nvic));
printf("CPUID_BASE: 0x%x\n", omap44xx_cortex_m3_nvic_CPUID_BASE_rd(&nvic));
printf("ICSR: 0x%x\n", omap44xx_cortex_m3_nvic_ICSR_rd(&nvic));
printf("VTOR: 0x%x\n", omap44xx_cortex_m3_nvic_VTOR_rd(&nvic));
printf("AIRCR: 0x%x\n", omap44xx_cortex_m3_nvic_AIRCR_rd(&nvic));
printf("CCR: 0x%x\n", omap44xx_cortex_m3_nvic_CCR_rd(&nvic));
printf("SHCSR: 0x%x\n", omap44xx_cortex_m3_nvic_SHCSR_rd(&nvic));
printf("CFSR: 0x%x\n", omap44xx_cortex_m3_nvic_CFSR_rd(&nvic));
printf("BFAR: 0x%x\n", omap44xx_cortex_m3_nvic_BFAR_rd(&nvic));
printf("SYSTICK_CTRL: 0x%x\n", omap44xx_cortex_m3_nvic_SYSTICK_CTRL_rd(&nvic));
printf("SYSTICK_CALV: 0x%x\n", omap44xx_cortex_m3_nvic_SYSTICK_CALV_rd(&nvic));
*/
if (omap44xx_cortex_m3_nvic_SHCSR_busfaultact_rdf(&nvic)){
//triggered by bus fault
if (omap44xx_mmu_irqstatus_rd(&mmu)){
//L2 MMU triggered fault: either no valid mapping, or two mappings in TLB
//XXX: cachemarker: once we have chaching enabled, this is the place to
//look at table entry for special permission bits.
//XXX: MMU_FAULT_ADDR register seems to just contain the last address that was
//requested. By this time this is probably just a kernelspace address.
//I am not sure if the M3 can actually find out what the faulting address really was
fault_address = omap44xx_mmu_fault_ad_rd(&mmu);
}
else{
//"regular" bus fault -> look in NVIC entries
if (omap44xx_cortex_m3_nvic_CFSR_bfarvalid_rdf(&nvic)){
//bus fault address register valid
fault_address = omap44xx_cortex_m3_nvic_BFAR_rd(&nvic);
}
else{
//one of the bus faults that do not write the BFAR -> faulting address
//literally unknown to system
printk(LOG_WARN, "user bus fault with unknown faulting address\n");
fault_address = (lvaddr_t) NULL;
}
}
}
else{
//memory management fault (probably access violation)
if (omap44xx_cortex_m3_nvic_CFSR_mmarvalid_rdf(&nvic)){
//MMAR contains faulting address
fault_address = omap44xx_cortex_m3_nvic_MMAR_rd(&nvic);
}
else{
//MMAR not written. probably executing in noexecute region
assert(omap44xx_cortex_m3_nvic_CFSR_iaccviol_rdf(&nvic));
//so we can assume the pc caused the fault
fault_address = save_area->named.pc;
}
}
lvaddr_t handler;
struct dispatcher_shared_arm *disp = get_dispatcher_shared_arm(dcb_current->disp);
uintptr_t saved_pc = save_area->named.pc;
disp->d.disabled = dispatcher_is_disabled_ip(dcb_current->disp, saved_pc);
bool disabled = (disp->d.disabled != 0);
assert(dcb_current->disp_cte.cap.type == ObjType_Frame);
printk(LOG_WARN, "user page fault%s in '%.*s': addr %"PRIxLVADDR
" IP %"PRIxPTR"\n",
disabled ? " WHILE DISABLED" : "", DISP_NAME_LEN,
disp->d.name, fault_address, saved_pc);
if (disabled) {
assert(save_area == &disp->trap_save_area);
handler = disp->d.dispatcher_pagefault_disabled;
dcb_current->faults_taken++;
}
else {
assert(save_area == &disp->enabled_save_area);
handler = disp->d.dispatcher_pagefault;
}
//.........这里部分代码省略.........
示例7: setAndSendState
void
setAndSendState(EntityStates state)
{
m_state = state;
dispatch(m_states[m_state]);
}
示例8: type_dir___inode
void type_dir___inode (char *command_line)
{
dispatch ("settype ext2_inode");
}
示例9: publish
void publish(const proton::message &m) {
messages.push_back(m);
dispatch(0);
}
示例10: consume
void
consume(const IMC::SimulatedState* msg)
{
if (m_args.activation_control)
{
if (!isActive())
return;
}
if (!isActive())
{
m_vel[0] = msg->u;
m_vel[1] = msg->v;
m_vel[2] = msg->w;
requestActivation();
}
// Compute time delta.
double tstep = m_delta.getDelta();
// Check if we have a valid time delta.
if (tstep <= 0)
return;
// Define Euler Angles variables and add gaussian noise component.
if (m_args.euler)
{
m_euler.phi = Angles::normalizeRadian(msg->phi + m_prng->gaussian() * Angles::radians(m_args.stdev_euler));
m_euler.theta = Angles::normalizeRadian(msg->theta + m_prng->gaussian() * Angles::radians(m_args.stdev_euler));
m_euler.psi_magnetic = Angles::normalizeRadian(msg->psi + m_prng->gaussian() * Angles::radians(m_args.stdev_euler));
m_euler.psi = Angles::normalizeRadian(m_euler.psi_magnetic + m_heading_offset);
// Heading offset will increment through time according with gyro rate bias.
m_heading_offset += Angles::radians(m_args.gyro_bias / 3600) * tstep;
m_euler.setTimeStamp(msg->getTimeStamp());
dispatch(m_euler, DF_KEEP_TIME);
}
// Define Angular Velocity variables and add gaussian noise component.
m_agvel.x = Angles::normalizeRadian(msg->p + m_prng->gaussian() * Angles::radians(m_args.stdev_agvel));
m_agvel.y = Angles::normalizeRadian(msg->q + m_prng->gaussian() * Angles::radians(m_args.stdev_agvel));
m_agvel.z = Angles::normalizeRadian(msg->r + m_prng->gaussian() * Angles::radians(m_args.stdev_agvel));
// Compute acceleration values using simulated state velocity fields.
m_accel.x = (msg->u - m_vel[0]) / tstep;
m_accel.y = (msg->v - m_vel[1]) / tstep;
m_accel.z = (msg->w - m_vel[2]) / tstep;
double macc = DUNE::Navigation::c_max_accel;
m_accel.x = DUNE::Math::trimValue(m_accel.x, -macc, macc);
m_accel.y = DUNE::Math::trimValue(m_accel.y, -macc, macc);
m_accel.z = DUNE::Math::trimValue(m_accel.z, -macc, macc);
// Store velocity for next iteration.
m_vel[0] = msg->u;
m_vel[1] = msg->v;
m_vel[2] = msg->w;
// Define messages timestamp and dispatch them to the bus.
m_agvel.setTimeStamp(msg->getTimeStamp());
m_accel.setTimeStamp(msg->getTimeStamp());
dispatch(m_agvel, DF_KEEP_TIME);
dispatch(m_accel, DF_KEEP_TIME);
setEntityState(IMC::EntityState::ESTA_NORMAL, Status::CODE_ACTIVE);
}
示例11: type_dir___cd
void type_dir___cd (char *command_line)
{
int status;
char *ptr,full_dir_name [500],dir_name [500],temp [500],temp2 [500];
struct struct_file_info info;
struct ext2_dir_entry_2 *dir_entry_ptr;
dir_entry_ptr=(struct ext2_dir_entry_2 *) (file_info.buffer+file_info.dir_entry_offset);
ptr=parse_word (command_line,dir_name);
if (*ptr==0) { /* cd alone will enter the highlighted directory */
strncpy (full_dir_name,dir_entry_ptr->name,dir_entry_ptr->name_len);
full_dir_name [dir_entry_ptr->name_len]=0;
}
else
ptr=parse_word (ptr,full_dir_name);
ptr=strchr (full_dir_name,'/');
if (ptr==full_dir_name) { /* Pathname is from root - Let the general cd do the job */
sprintf (temp,"cd %s",full_dir_name);type_ext2___cd (temp);return;
}
if (ptr==NULL) {
strcpy (dir_name,full_dir_name);
full_dir_name [0]=0;
}
else {
strncpy (dir_name,full_dir_name,ptr-full_dir_name);
dir_name [ptr-full_dir_name]=0;
strcpy (full_dir_name,++ptr);
}
/* dir_name contains the current entry, while */
/* full_dir_name contains the rest */
strcpy (name_search,dir_name); /* name_search is used to hold the required entry name */
if (dir_entry_ptr->name_len != strlen (dir_name) ||
strncmp (dir_name,dir_entry_ptr->name,dir_entry_ptr->name_len)!=0)
info=search_dir_entries (&action_name,&status); /* Search for the entry. Answer in info. */
else {
status=FOUND;info=file_info;
}
if (status==FOUND) { /* If found */
file_info=info; /* Switch to it, by setting the global file_info */
dispatch ("remember internal_variable"); /* Move the inode into the objects memory */
dispatch ("followinode"); /* Go to the inode pointed by this directory entry */
if (S_ISLNK (type_data.u.t_ext2_inode.i_mode)) {/* Symbolic link ? */
if (type_data.u.t_ext2_inode.i_size > 60) { /* I'm lazy, I guess :-) */
wprintw (command_win,"Error - Sorry, Only fast symbolic link following is currently supported\n");
refresh_command_win ();
return;
}
/* Get the pointed name and append the previous path */
strcpy (temp2,(unsigned char *) &type_data.u.t_ext2_inode.i_block);
strcat (temp2,"/");
strcat (temp2,full_dir_name);
dispatch ("recall internal_variable"); /* Return to the original inode */
dispatch ("dir"); /* and to the directory */
sprintf (temp,"cd %s",temp2); /* And continue from there by dispatching a cd command */
dispatch (temp); /* (which can call ourself or the general cd) */
return;
}
if (S_ISDIR (type_data.u.t_ext2_inode.i_mode)) { /* Is it an inode of a directory ? */
dispatch ("dir"); /* Yes - Pass to the pointed directory */
if (full_dir_name [0] != 0) { /* And call ourself with the rest of the pathname */
sprintf (temp,"cd %s",full_dir_name);
dispatch (temp);
}
return;
}
else { /* If we can't continue from here, we'll just stop */
wprintw (command_win,"Can\'t continue - Stopping at last inode\n");refresh_command_win ();
return;
}
}
wprintw (command_win,"Error - Directory entry %s not found.\n",dir_name); /* Hmm, an invalid path somewhere */
refresh_command_win ();
}
示例12: autorun
//------------------------------------------------------------------------------
int autorun(int argc, char** argv)
{
// Parse command line arguments.
struct option options[] = {
{ "help", no_argument, nullptr, 'h' },
{ "allusers", no_argument, nullptr, 'a' },
{}
};
str<MAX_PATH> clink_path;
int i;
int ret = 0;
while ((i = getopt_long(argc, argv, "ha", options, nullptr)) != -1)
{
switch (i)
{
case 'a':
g_all_users = 1;
break;
case 'h':
print_help();
return 0;
default:
return 0;
}
}
dispatch_func_t* function = nullptr;
// Find out what to do by parsing the verb.
if (optind < argc)
{
if (!strcmp(argv[optind], "install"))
function = install_autorun;
else if (!strcmp(argv[optind], "uninstall"))
function = uninstall_autorun;
else if (!strcmp(argv[optind], "set"))
function = set_autorun_value;
else if (!strcmp(argv[optind], "show"))
return show_autorun();
}
// Get path where clink is installed (assumed to be where this executable is)
if (function == install_autorun)
{
clink_path << _pgmptr;
clink_path.truncate(clink_path.last_of('\\'));
}
// Collect the remainder of the command line.
if (function == install_autorun || function == set_autorun_value)
{
for (i = optind + 1; i < argc; ++i)
{
g_clink_args << argv[i];
if (i < argc - 1)
g_clink_args << " ";
}
}
// If we can't continue any further then warn the user.
if (function == nullptr)
{
puts("ERROR: Invalid arguments. Run 'clink autorun --help' for info.");
return 0;
}
// Do the magic.
if (!check_registry_access())
{
puts("You must have administator rights to access cmd.exe's autorun");
return 0;
}
const char* arg = clink_path.c_str();
arg = *arg ? arg : g_clink_args.c_str();
ret = dispatch(function, arg);
// Provide the user with some feedback.
if (ret == 1)
{
const char* msg = nullptr;
if (function == install_autorun)
msg = "Clink successfully installed to run when cmd.exe starts";
else if (function == uninstall_autorun)
msg = "Clink's autorun entry has been removed";
else if (function == set_autorun_value)
msg = "Cmd.exe's AutoRun registry key set successfully";
if (msg != nullptr)
success_message(msg);
}
return ret;
}
示例13: env
void server::handle_request(const http::request& req, http::reply& rep)
{
string action;
try
{
xml::element* response;
if (req.method == "POST") // must be a SOAP call
{
xml::document doc;
doc.read(req.payload);
envelope env(doc);
xml::element* request = env.request();
action = request->name();
log() << action << ' ';
response = make_envelope(dispatch(action, env.request()));
}
else if (req.method == "GET")
{
// start by sanitizing the request's URI
string uri = req.uri;
// strip off the http part including hostname and such
if (ba::starts_with(uri, "http://"))
{
string::size_type s = uri.find_first_of('/', 7);
if (s != string::npos)
uri.erase(0, s);
}
// now make the path relative to the root
while (uri.length() > 0 and uri[0] == '/')
uri.erase(uri.begin());
fs::path path(uri);
fs::path::iterator p = path.begin();
if (p == path.end())
throw http::bad_request;
string root = (*p++).string();
if (root == "rest")
{
action = (*p++).string();
xml::element* request(new xml::element(action));
while (p != path.end())
{
string name = http::decode_url((*p++).string());
if (p == path.end())
break;
xml::element* param(new xml::element(name));
string value = http::decode_url((*p++).string());
param->content(value);
request->append(param);
}
log() << action << ' ';
response = make_envelope(dispatch(action, request));
}
else if (root == "wsdl")
{
log() << "wsdl";
response = make_wsdl(m_location);
}
else
{
log() << req.uri;
throw http::not_found;
}
}
else
throw http::bad_request;
rep.set_content(response);
}
catch (std::exception& e)
{
rep.set_content(make_fault(e));
}
catch (http::status_type& s)
{
rep = http::reply::stock_reply(s);
}
}
示例14: spin1_start
uint spin1_start (sync_bool sync)
{
sark_cpu_state (CPU_STATE_RUN);
// Initialise hardware
configure_communications_controller();
configure_dma_controller();
configure_timer1 (timer_tick);
configure_vic();
#if (API_WARN == TRUE) || (API_DIAGNOSTICS == TRUE)
warnings = NO_ERROR;
dfull = 0;
fullq = 0;
pfull = 0;
#if USE_WRITE_BUFFER == TRUE
wberrors = 0;
#endif
#endif
// synchronise with other application cores
if (sync == SYNC_WAIT)
event_wait ();
// initialise counter and ticks for simulation
// 32-bit, periodic counter, interrupts enabled
if (timer_tick)
tc[T1_CONTROL] = 0xe2;
ticks = 0;
run = 1;
// simulate!
dispatch ();
// simulation finished - clean up before returning to c_main
clean_up ();
// re-enable interrupts for sark
// only CPU_INT enabled in the VIC
spin1_int_enable ();
// provide diagnostics data to application
#if (API_DIAGNOSTICS == TRUE)
diagnostics.exit_code = exit_val;
diagnostics.warnings = warnings;
diagnostics.total_mc_packets = rtr[RTR_DGC0] + rtr[RTR_DGC1];
diagnostics.dumped_mc_packets = rtr[RTR_DGC8];
diagnostics.discarded_mc_packets = thrown;
diagnostics.dma_transfers = dma_id - 1;
diagnostics.dma_bursts = dma[DMA_STAT0];
diagnostics.dma_queue_full = dfull;
diagnostics.task_queue_full = fullq;
diagnostics.tx_packet_queue_full = pfull;
#if USE_WRITE_BUFFER == TRUE
diagnostics.writeBack_errors = wberrors;
#endif
#endif
// report problems if requested!
#if (API_DEBUG == TRUE) || (API_WARN == TRUE)
// avoid sending output at the same time as other chips!
io_delay (10000 * my_chip);
#if API_DEBUG == TRUE // report debug information
report_debug();
#endif
#if API_WARN == TRUE // report warnings
report_warns ();
#endif
#endif
return exit_val;
}
示例15: throw
void UserConnection::on(BufferedSocketListener::Line, const string& aLine) throw () {
if(aLine.length() < 2)
return;
if(aLine[0] == 'C' && !isSet(FLAG_NMDC)) {
dispatch(aLine);
return;
} else if(aLine[0] == '$') {
setFlag(FLAG_NMDC);
} else {
// We shouldn't be here?
dcdebug("Unknown UserConnection command: %.50s\n", aLine.c_str());
return;
}
string cmd;
string param;
string::size_type x;
if( (x = aLine.find(' ')) == string::npos) {
cmd = aLine;
} else {
cmd = aLine.substr(0, x);
param = aLine.substr(x+1);
}
if(cmd == "$MyNick") {
if(!param.empty())
fire(UserConnectionListener::MyNick(), this, Text::acpToUtf8(param));
} else if(cmd == "$Direction") {
x = param.find(" ");
if(x != string::npos) {
fire(UserConnectionListener::Direction(), this, param.substr(0, x), param.substr(x+1));
}
} else if(cmd == "$Error") {
if(Util::stricmp(param.c_str(), FILE_NOT_AVAILABLE) == 0 ||
param.rfind(/*path/file*/" no more exists") != string::npos) {
fire(UserConnectionListener::FileNotAvailable(), this);
} else {
fire(UserConnectionListener::Failed(), this, param);
}
} else if(cmd == "$FileLength") {
if(!param.empty())
fire(UserConnectionListener::FileLength(), this, Util::toInt64(param));
} else if(cmd == "$GetListLen") {
fire(UserConnectionListener::GetListLength(), this);
} else if(cmd == "$Get") {
notSupported();
disconnect();
StringMap params;
params["user"] = getUser()->getNick();
params["hub"] = getUser()->getClientUrl();
params["ip"] = getRemoteIp();
string tmp = Util::formatParams(STRING(OLD_CLIENT), params, false);
LogManager::getInstance()->message(tmp);
} else if(cmd == "$GetZBlock" || cmd == "$UGetZBlock" || cmd == "$UGetBlock") {
notSupported();
disconnect();
StringMap params;
params["user"] = getUser()->getNick();
params["hub"] = getUser()->getClientUrl();
params["ip"] = getRemoteIp();
string tmp = Util::formatParams(STRING(OLD_CLIENT), params, false);
LogManager::getInstance()->message(tmp);
} else if(cmd == "$Key") {
if(!param.empty())
fire(UserConnectionListener::Key(), this, param);
} else if(cmd == "$Lock") {
if(!param.empty()) {
x = param.find(" Pk=");
if(x != string::npos) {
fire(UserConnectionListener::CLock(), this, param.substr(0, x), param.substr(x + 4));
} else {
// Workaround for faulty linux clients...
x = param.find(' ');
if(x != string::npos) {
setFlag(FLAG_INVALIDKEY);
fire(UserConnectionListener::CLock(), this, param.substr(0, x), Util::emptyString);
} else {
fire(UserConnectionListener::CLock(), this, param, Util::emptyString);
}
}
}
} else if(cmd == "$Send") {
fire(UserConnectionListener::Send(), this);
} else if(cmd == "$Sending") {
int64_t bytes = -1;
if(!param.empty())
bytes = Util::toInt64(param);
fire(UserConnectionListener::Sending(), this, bytes);
} else if(cmd == "$MaxedOut") {
fire(UserConnectionListener::MaxedOut(), this);
} else if(cmd == "$Supports") {
if(!param.empty()) {
fire(UserConnectionListener::Supports(), this, StringTokenizer<string>(param, ' ').getTokens());
}
} else if(cmd.compare(0, 4, "$ADC") == 0) {
dispatch(aLine, true);
} else {
//.........这里部分代码省略.........