2
* Copyright (C) 2013 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Michi Henning <michi.henning@canonical.com>
19
#include <scopes/internal/RuntimeImpl.h>
20
#include <scopes/internal/ScopeLoader.h>
21
#include <scopes/internal/ScopeObject.h>
22
#include <unity/UnityExceptions.h>
27
using namespace unity::api::scopes;
28
using namespace unity::api::scopes::internal;
33
// TODO: the hard-wired strings here need to be read from config.
35
string scope_nameB = string("scope-B");
36
string scope_nameC = string("scope-C");
40
RuntimeImpl::UPtr rtB = RuntimeImpl::create(scope_nameB);
41
MiddlewareBase::SPtr mwB = rtB->factory()->create(rtB->scope_name(), "Zmq", "Zmq.Config");
42
ScopeLoader::SPtr loaderB = ScopeLoader::load(rtB->scope_name(), "lib" + rtB->scope_name() + ".so",
45
ScopeObject::SPtr scopeB(new ScopeObject(rtB.get(), loaderB->scope_base()));
46
mwB->add_scope_object(rtB->scope_name(), scopeB);
48
RuntimeImpl::UPtr rtC = RuntimeImpl::create(scope_nameC);
49
MiddlewareBase::SPtr mwC = rtC->factory()->create(rtC->scope_name(), "Zmq", "Zmq.Config");
50
ScopeLoader::SPtr loaderC = ScopeLoader::load(rtC->scope_name(), "lib" + rtC->scope_name() + ".so",
53
ScopeObject::SPtr scopeC(new ScopeObject(rtC.get(), loaderC->scope_base()));
54
mwC->add_scope_object(rtC->scope_name(), scopeC);
56
mwB->wait_for_shutdown();
57
mwC->wait_for_shutdown();
60
catch (unity::Exception const& e)
62
cerr << e.to_string() << endl;