summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-09-28 01:27:01 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-09-28 01:27:01 +0100
commit3a7a60b618b82416e6774bd8dff4b706d39e6aaa (patch)
tree5d8f52127deeb08b3f9ab92309449771a92a8c50
parentAccess to plugin implementations from the very base class of plugin (diff)
downloadlibadhocutil-3a7a60b618b82416e6774bd8dff4b706d39e6aaa.tar.bz2
libadhocutil-3a7a60b618b82416e6774bd8dff4b706d39e6aaa.tar.xz
libadhocutil-3a7a60b618b82416e6774bd8dff4b706d39e6aaa.zip
No need for plugin implementations to be const
-rw-r--r--libadhocutil/plugins.h12
-rw-r--r--libadhocutil/plugins.impl.h12
2 files changed, 12 insertions, 12 deletions
diff --git a/libadhocutil/plugins.h b/libadhocutil/plugins.h
index d73ffec..69d0182 100644
--- a/libadhocutil/plugins.h
+++ b/libadhocutil/plugins.h
@@ -47,7 +47,7 @@ namespace AdHoc {
virtual const std::type_info & type() const = 0;
/// Get the abstract base plugin implementation.
- virtual const AbstractPluginImplementation * implementation() const = 0;
+ virtual AbstractPluginImplementation * implementation() const = 0;
/// The name the plugin was installed with.
const std::string name;
@@ -84,16 +84,16 @@ namespace AdHoc {
class DLL_PUBLIC PluginOf : public Plugin {
public:
/// Constructor taking an instance and name, filename and line of install for Plugin.
- PluginOf(const T * t, const std::string & n, const std::string & f, int l);
+ PluginOf(T * t, const std::string & n, const std::string & f, int l);
~PluginOf();
/// Get the type of this plugin.
const std::type_info & type() const override;
/// Get the implementation of this plugin.
- const T * implementation() const override;
+ T * implementation() const override;
private:
- const T * impl;
+ T * impl;
};
/// Container for loaded plugins.
@@ -124,7 +124,7 @@ namespace AdHoc {
* @param f Filename of plugin.
* @param l Line number.
*/
- template<typename T> void add(const T * i, const std::string & n, const std::string & f, int l);
+ template<typename T> void add(T * i, const std::string & n, const std::string & f, int l);
/**
* Uninstall a plugin.
@@ -142,7 +142,7 @@ namespace AdHoc {
* Get the implementation from specific plugin.
* @param n Name of plugin.
*/
- template<typename T> const T * getImplementation(const std::string & n) const;
+ template<typename T> T * getImplementation(const std::string & n) const;
/**
* Get all plugins of a given time.
diff --git a/libadhocutil/plugins.impl.h b/libadhocutil/plugins.impl.h
index 9a2a880..1947845 100644
--- a/libadhocutil/plugins.impl.h
+++ b/libadhocutil/plugins.impl.h
@@ -5,7 +5,7 @@
namespace AdHoc {
template <typename T>
- PluginOf<T>::PluginOf(const T * t, const std::string & n, const std::string & f, int l) :
+ PluginOf<T>::PluginOf(T * t, const std::string & n, const std::string & f, int l) :
Plugin(n, f, l),
impl(t)
{
@@ -27,7 +27,7 @@ namespace AdHoc {
/// Get the implementation of this plugin.
template <typename T>
- const T *
+ T *
PluginOf<T>::implementation() const
{
return impl;
@@ -35,7 +35,7 @@ namespace AdHoc {
template <typename T>
void
- PluginManager::add(const T * i, const std::string & n, const std::string & f, int l)
+ PluginManager::add(T * i, const std::string & n, const std::string & f, int l)
{
add(PluginPtr(new PluginOf<T>(i, n, f, l)));
}
@@ -55,7 +55,7 @@ namespace AdHoc {
}
template <typename T>
- const T *
+ T *
PluginManager::getImplementation(const std::string & n) const
{
return get<T>(n)->implementation();
@@ -91,10 +91,10 @@ namespace AdHoc {
#define INSTANTIATEPLUGINOF(T) \
template class AdHoc::PluginOf<T>; \
- template void AdHoc::PluginManager::add<T>(const T *, const std::string &, const std::string &, int); \
+ template void AdHoc::PluginManager::add<T>(T *, const std::string &, const std::string &, int); \
template void AdHoc::PluginManager::remove<T>(const std::string &); \
template boost::shared_ptr<const AdHoc::PluginOf<T>> AdHoc::PluginManager::get<T>(const std::string &) const; \
- template const T * AdHoc::PluginManager::getImplementation<T>(const std::string &) const; \
+ template T * AdHoc::PluginManager::getImplementation<T>(const std::string &) const; \
template std::set<boost::shared_ptr<const AdHoc::PluginOf<T>>> AdHoc::PluginManager::getAll<T>() const; \
template void AdHoc::PluginManager::addResolver<T>(const AdHoc::PluginManager::PluginResolver & f); \
template void AdHoc::PluginManager::removeResolver<T>(); \