MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / main

Function main

apps/BasicServer.cpp:49–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49int main(int argc, char *argv[]) {
50 if (argc < 2) {
51 cerr << "Must supply at least one plugin name to load." << endl;
52 return 1;
53 }
54 cout << "Creating server..." << endl;
55
56 server = osvr::server::Server::createLocal();
57
58 cout << "Registering shutdown handler..." << endl;
59 osvr::server::registerShutdownHandler<&handleShutdown>();
60
61 cout << "Loading plugins..." << endl;
62 for (int i = 1; i < argc; ++i) {
63 try {
64 cout << "Loading plugin '" << argv[i] << "'..." << endl;
65 server->loadPlugin(argv[i]);
66 cout << "Plugin '" << argv[i] << "' loaded!\n" << endl;
67 } catch (std::exception &e) {
68 std::cerr << "Caught exception tring to load " << argv[i] << ": "
69 << e.what() << std::endl;
70 return 1;
71 }
72 }
73
74 cout << "Triggering a hardware detection..." << endl;
75 server->triggerHardwareDetect();
76
77 cout << "Starting server mainloop..." << endl;
78 server->startAndAwaitShutdown();
79
80 cout << "Server mainloop exited." << endl;
81
82 return 0;
83}

Callers

nothing calls this directly

Calls 3

loadPluginMethod · 0.45
triggerHardwareDetectMethod · 0.45
startAndAwaitShutdownMethod · 0.45

Tested by

no test coverage detected