|
@@ -17,8 +17,8 @@
|
|
|
namespace robotics::v3 {
|
|
|
class application_base {
|
|
|
public:
|
|
|
- virtual int run() = 0;
|
|
|
- virtual int debug() = 0;
|
|
|
+ virtual void run() = 0;
|
|
|
+ virtual void stop() = 0;
|
|
|
};
|
|
|
template<typename _Type>
|
|
|
class application {
|
|
@@ -31,10 +31,19 @@ namespace robotics::v3 {
|
|
|
}
|
|
|
else if (0 == strcmp(argv[argc - 1], "run")) {
|
|
|
LOG_INSTALL;
|
|
|
- result = app_->run();
|
|
|
+ instance()->app_->run();
|
|
|
+ std::this_thread::sleep_for(std::chrono::seconds(0xffffff));
|
|
|
+ instance()->app_->stop();
|
|
|
+ result = 0;
|
|
|
}
|
|
|
else if (0 == strcmp(argv[argc - 1], "debug") || 0 == strcmp(argv[argc - 1], "cmakedebug")) {
|
|
|
- result = app_->debug();
|
|
|
+ if (argc >= 3 && 0 == strcmp(argv[argc - 1], "cmakedebug")) {
|
|
|
+ std::filesystem::current_path(argv[argc - 2]);
|
|
|
+ }
|
|
|
+ instance()->app_->run();
|
|
|
+ getchar();
|
|
|
+ instance()->app_->stop();
|
|
|
+ result = 0;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@@ -44,7 +53,7 @@ namespace robotics::v3 {
|
|
|
}
|
|
|
static application* instance() {
|
|
|
static application g_application;
|
|
|
- return &application;
|
|
|
+ return &g_application;
|
|
|
}
|
|
|
private:
|
|
|
std::shared_ptr<application_base> app_;
|