Line |
Branch |
Exec |
Source |
1 |
|
|
// Copyright (C) 2016 by Anna Seppala. |
2 |
|
|
// |
3 |
|
|
// This file is part of the hpp-corbaserver. |
4 |
|
|
// |
5 |
|
|
// This software is provided "as is" without warranty of any kind, |
6 |
|
|
// either expressed or implied, including but not limited to the |
7 |
|
|
// implied warranties of fitness for a particular purpose. |
8 |
|
|
// |
9 |
|
|
// See the COPYING file for more information. |
10 |
|
|
|
11 |
|
|
#include "hpp/corbaserver/affordance/server.hh" |
12 |
|
|
|
13 |
|
|
#include <hpp/corbaserver/server.hh> |
14 |
|
|
#include <hpp/util/debug.hh> |
15 |
|
|
#include <hpp/util/exception.hh> |
16 |
|
|
|
17 |
|
|
#include "affordance.impl.hh" |
18 |
|
|
|
19 |
|
|
namespace hpp { |
20 |
|
|
namespace affordanceCorba { |
21 |
|
✗ |
Server::Server(corbaServer::Server* server) |
22 |
|
✗ |
: corbaServer::ServerPlugin(server), impl_(NULL) {} |
23 |
|
|
|
24 |
|
✗ |
Server::~Server() { |
25 |
|
✗ |
if (impl_) delete impl_; |
26 |
|
✗ |
} |
27 |
|
|
|
28 |
|
✗ |
std::string Server::name() const { return "affordance"; } |
29 |
|
|
|
30 |
|
|
/// Start corba server |
31 |
|
✗ |
void Server::startCorbaServer(const std::string& contextId, |
32 |
|
|
const std::string& contextKind) { |
33 |
|
✗ |
initializeTplServer(impl_, contextId, contextKind, name(), "affordance"); |
34 |
|
✗ |
impl_->implementation().setServer(this); |
35 |
|
|
|
36 |
|
|
// TODO this a very fragile. It works because startCorbaServer is called |
37 |
|
|
// after setProblemSolverMap in hpp::corbaServer::Server::getContext |
38 |
|
|
// implementation (file hpp-corbaserver/src/server.cc) |
39 |
|
✗ |
impl_->implementation().resetAffordanceConfig(); |
40 |
|
✗ |
} |
41 |
|
|
|
42 |
|
✗ |
::CORBA::Object_ptr Server::servant(const std::string& name) const { |
43 |
|
✗ |
if (name == "affordance") return impl_->implementation()._this(); |
44 |
|
✗ |
throw std::invalid_argument("No servant " + name); |
45 |
|
|
} |
46 |
|
|
} // namespace affordanceCorba |
47 |
|
|
} // namespace hpp |
48 |
|
|
|
49 |
|
✗ |
HPP_CORBASERVER_DEFINE_PLUGIN(hpp::affordanceCorba::Server) |
50 |
|
|
|