OSVR Framework (Internal Development Docs)
0.6-1962-g59773924
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
ConnectionHost.cpp
Go to the documentation of this file.
1
12
// Copyright 2014 Sensics, Inc.
13
//
14
// Licensed under the Apache License, Version 2.0 (the "License");
15
// you may not use this file except in compliance with the License.
16
// You may obtain a copy of the License at
17
//
18
// http://www.apache.org/licenses/LICENSE-2.0
19
//
20
// Unless required by applicable law or agreed to in writing, software
21
// distributed under the License is distributed on an "AS IS" BASIS,
22
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
// See the License for the specific language governing permissions and
24
// limitations under the License.
25
26
// Internal Includes
27
#include <
osvr/PluginHost/RegistrationContext.h
>
28
#include <
osvr/Connection/Connection.h
>
29
30
// Library/third-party includes
31
// - none
32
33
// Standard includes
34
#include <iostream>
35
#include <exception>
36
37
int
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
}
Connection.h
Header.
osvr::pluginhost::RegistrationContext
Class responsible for hosting plugins, along with their registration and destruction.
Definition:
RegistrationContext.h:53
osvr::connection::ConnectionPtr
shared_ptr< Connection > ConnectionPtr
How one must hold a Connection.
Definition:
ConnectionPtr.h:40
RegistrationContext.h
Header.
osvr::connection::Connection::storeConnection
static void storeConnection(pluginhost::RegistrationContext &ctx, ConnectionPtr conn)
Store a connection pointer in a RegistrationContext.
Definition:
Connection.cpp:79
examples
plugin-hosts
ConnectionHost.cpp
Generated on Tue May 16 2017 15:22:20 for OSVR Framework (Internal Development Docs) by
Doxygen
1.8.8