本文整理汇总了C++中Endpoint::event方法的典型用法代码示例。如果您正苦于以下问题:C++ Endpoint::event方法的具体用法?C++ Endpoint::event怎么用?C++ Endpoint::event使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Endpoint
的用法示例。
在下文中一共展示了Endpoint::event方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
// default configuration filename
std::string configFilename = "configs/senderUdpBroadcast.edl";
// parse command line arguments
for (int i = 1; i < argc; i++) {
if ( std::string(argv[i]) == "-f" ) {
configFilename = argv[++i];
}
}
// build an endpoint
Endpoint* endpoint = builder(configFilename);
// send a reset event
std::cout << "Reset event: which will establish the networks." << std::endl;
endpoint->event(oe::base::Component::RESET_EVENT);
// system time of day
const double dt = 1.0 / static_cast<double>(UPDATE_RATE); // Delta time
double simTime = 0.0; // Simulator time reference
double startTime = oe::base::getComputerTime(); // Time of day (sec) run started
// main loop
std::cout << "Starting main loop ..." << std::endl;
for(;;) {
endpoint->updateTC( static_cast<double>(dt) );
endpoint->updateData( static_cast<double>(dt) );
simTime += dt; // time of next frame
double timeNow = oe::base::getComputerTime(); // time now
double elapsedTime = timeNow - startTime;
double nextFrameStart = simTime - elapsedTime;
const auto sleepTime = static_cast<int>(nextFrameStart*1000.0);
// wait for the next frame
if (sleepTime > 0)
oe::base::msleep(sleepTime);
}
return EXIT_SUCCESS;
}