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

Function main

examples/plugin-hosts/ConnectionHost.cpp:37–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35#include <exception>
36
37int main(int argc, char *argv[]) {
38 if (argc < 2) {
39 std::cerr << "Must supply a plugin name to load." << std::endl;
40 return 1;
41 }
42 osvr::pluginhost::RegistrationContext ctx;
43 osvr::connection::ConnectionPtr conn =
44 osvr::connection::Connection::createLocalConnection();
45 osvr::connection::Connection::storeConnection(ctx, conn);
46
47 try {
48 std::cout << "Trying to load plugin " << argv[1] << std::endl;
49 ctx.loadPlugin(argv[1]);
50 std::cout << "Successfully loaded plugin, control returned to host "
51 "application!" << std::endl;
52 } catch (std::exception &e) {
53 std::cerr << "Caught exception tring to load " << argv[1] << ": "
54 << e.what() << std::endl;
55 return 1;
56 }
57 int count = 20;
58 std::cout << "Running connection processing " << count << " times"
59 << std::endl;
60 for (int i = 0; i < count; ++i) {
61 conn->process();
62 }
63
64 return 0;
65}

Callers

nothing calls this directly

Calls 2

loadPluginMethod · 0.45
processMethod · 0.45

Tested by

no test coverage detected