hpp-core 6.0.0
Implement basic classes for canonical path planning for kinematic chains.
Loading...
Searching...
No Matches
plugin.hh
Go to the documentation of this file.
1// Copyright (c) 2019, Joseph Mirabel
2// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3//
4
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are
7// met:
8//
9// 1. Redistributions of source code must retain the above copyright
10// notice, this list of conditions and the following disclaimer.
11//
12// 2. Redistributions in binary form must reproduce the above copyright
13// notice, this list of conditions and the following disclaimer in the
14// documentation and/or other materials provided with the distribution.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27// DAMAGE.
28
29#ifndef HPP_CORE_PLUGIN_HH
30#define HPP_CORE_PLUGIN_HH
31
32#include <hpp/core/config.hh>
33#include <hpp/core/fwd.hh>
34#include <string>
35
36namespace hpp {
37namespace core {
40
43 public:
44 const std::string& name() const { return name_; }
45
46 const std::string& version() const { return version_; }
47
49 if (initialized_) return true;
50 initialized_ = impl_initialize(ps);
51 return initialized_;
52 }
53
55
56 protected:
57 virtual bool impl_initialize(ProblemSolverPtr_t ps) = 0;
58
59 ProblemSolverPlugin(const std::string& name, const std::string& version)
60 : name_(name), version_(version), initialized_(false) {}
61
62 private:
63 std::string name_, version_;
64 bool initialized_;
65}; // class ProblemSolver
66
75#define HPP_CORE_DEFINE_PLUGIN(PluginClassName) \
76 extern "C" { \
77 ::hpp::core::ProblemSolverPlugin* createProblemSolverPlugin() { \
78 return new PluginClassName(); \
79 } \
80 }
81
82namespace plugin {
91std::string findPluginLibrary(const std::string& name);
92
97bool loadPlugin(const std::string& lib, ProblemSolverPtr_t ps);
98} // namespace plugin
99
101
102} // namespace core
103} // namespace hpp
104
105#endif // HPP_CORE_PLUGIN_HH
Plugin mechanism to declare new features in ProblemSolver class.
Definition plugin.hh:42
bool initialize(ProblemSolverPtr_t ps)
Definition plugin.hh:48
virtual ~ProblemSolverPlugin()
Definition plugin.hh:54
const std::string & name() const
Definition plugin.hh:44
const std::string & version() const
Definition plugin.hh:46
virtual bool impl_initialize(ProblemSolverPtr_t ps)=0
ProblemSolverPlugin(const std::string &name, const std::string &version)
Definition plugin.hh:59
Definition problem-solver.hh:78
Definition bi-rrt-planner.hh:35