server.cc 1.75 KB
Newer Older
Steve Tonneau's avatar
Steve Tonneau committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright (C) 2014 CNRS-LAAS
// Author: Florent Lamiraux.
//
// This file is part of the hpp-manipulation-corba.
//
// hpp-manipulation-corba is free software: you can redistribute
// it and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation, either
// version 3 of the License, or (at your option) any later version.
//
// hpp-manipulation-corba is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with hpp-manipulation-corba.  If not, see
// <http://www.gnu.org/licenses/>.

20
21
#include <hpp/corbaserver/rbprm/server.hh>

Steve Tonneau's avatar
Steve Tonneau committed
22
23
#include <hpp/util/exception.hh>
#include "rbprmbuilder.impl.hh"
24
#include <hpp/corbaserver/server.hh>
Steve Tonneau's avatar
Steve Tonneau committed
25
26

namespace hpp {
Guilhem Saurel's avatar
Format    
Guilhem Saurel committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
namespace rbprm {
Server::Server(corbaServer::Server* server) : corbaServer::ServerPlugin(server), rbprmBuilder_(NULL) {}

Server::~Server() {
  if (rbprmBuilder_) delete rbprmBuilder_;
}

std::string Server::name() const { return "rbprm"; }

/// Start corba server
void Server::startCorbaServer(const std::string& contextId, const std::string& contextKind) {
  bool mThd = parent()->multiThread();
  rbprmBuilder_ = new corba::Server<impl::RbprmBuilder>(0, NULL, mThd, "child");
  rbprmBuilder_->implementation().setServer(this);

  if (rbprmBuilder_->startCorbaServer(contextId, contextKind, "rbprm", "rbprmbuilder") != 0) {
    HPP_THROW_EXCEPTION(hpp::Exception, "Failed to start corba rbprm server.");
  }
}
}  // namespace rbprm
}  // namespace hpp
48
49

HPP_CORBASERVER_DEFINE_PLUGIN(hpp::rbprm::Server)