本文整理汇总了C++中ITheFramework::AddRunnable方法的典型用法代码示例。如果您正苦于以下问题:C++ ITheFramework::AddRunnable方法的具体用法?C++ ITheFramework::AddRunnable怎么用?C++ ITheFramework::AddRunnable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITheFramework
的用法示例。
在下文中一共展示了ITheFramework::AddRunnable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ex_send_notifications
bool ex_send_notifications(void *arg)
{
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create(Decorator, 0, true);
decorator->getOptions()->setOrigin(CONSOLE_WIDTH, 0);
frame->AddDecorator(decorator);
// start mouse
Mouse *mouse = ssi_create(Mouse, 0, true);
ITransformable *cursor_p = frame->AddProvider(mouse, SSI_MOUSE_CURSOR_PROVIDER_NAME);
frame->AddSensor(mouse);
// sender + receiver
NotifySender *sender = ssi_create_id(NotifySender, 0, "sender");
sender->setLogLevel(SSI_LOG_LEVEL_DEBUG);
sender->getOptions()->setUrl("udp://localhost:1111");
frame->AddRunnable(sender);
NotifyReceiver *receiver = ssi_create_id(NotifyReceiver, 0, "receiver");
receiver->setLogLevel(SSI_LOG_LEVEL_DEBUG);
receiver->getOptions()->setUrl("udp://localhost:1111");
receiver->getOptions()->setId("plot");
frame->AddRunnable((SSI_IRunnableObject*)receiver);
// control (place after sender!)
ControlCheckBox *checkbox = 0;
checkbox = ssi_create_id(ControlCheckBox, 0, "checkbox");
checkbox->getOptions()->setId("sender");
checkbox->getOptions()->setTitle("VISUALIZATION");
checkbox->getOptions()->setLabel("SHOW");
checkbox->getOptions()->value = false;
frame->AddRunnable(checkbox);
// plot
SignalPainter *plot;
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->size = 10;
plot->getOptions()->setTitle("cursor");
frame->AddConsumer(cursor_p, plot, "0.2s");
decorator->add("plot*", 0, 0, 400, CONSOLE_HEIGHT - 200);
decorator->add("checkbox*", 0, CONSOLE_HEIGHT - 200, 400, 200);
frame->Start();
frame->Wait();
frame->Stop();
frame->Clear();
return true;
}
示例2: ex_events_string
bool ex_events_string(void *arg) {
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create (Decorator, 0, true);
frame->AddDecorator(decorator);
ITheEventBoard *board = Factory::GetEventBoard();
ClockEventSender *eclock = ssi_create(ClockEventSender, 0, true);
eclock->getOptions()->clock = 1000;
eclock->getOptions()->empty = false;
eclock->getOptions()->setString("test");
board->RegisterSender(*eclock);
frame->AddRunnable(eclock);
Websocket *websocket = ssi_create(Websocket, 0, true);
board->RegisterSender(*websocket);
board->RegisterListener(*websocket);
EventMonitor *monitor = ssi_create_id (EventMonitor, 0, "monitor");
board->RegisterListener(*monitor);
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
frame->Clear();
return true;
}