/* Copyright 2015, 2016, Michele Santullo
* This file is part of "dindexer".
*
* "dindexer" is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* "dindexer" 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "dindexer". If not, see .
*/
#ifndef id756A258A98B24B0DB2529BCEEC5137E2
#define id756A258A98B24B0DB2529BCEEC5137E2
#include
#include
#include
#include
namespace YAML {
class Node;
} //namespace YAML
namespace dindb {
class Backend;
using BackendPtr = std::unique_ptr;
class SOLoadException : public std::runtime_error {
public:
explicit SOLoadException (std::string&& parMessage);
};
class BackendPlugin {
public:
BackendPlugin ( void );
BackendPlugin ( BackendPlugin&& ) = default;
BackendPlugin ( const std::string& parSOPath, const YAML::Node* parConfig );
~BackendPlugin ( void ) noexcept;
const boost::string_ref& name ( void ) const;
Backend& backend ( void );
const Backend& backend ( void ) const;
bool is_loaded ( void ) const;
int backend_interface_version ( void ) const;
int max_supported_interface_version ( void ) const;
BackendPlugin& operator= ( BackendPlugin&& ) = default;
private:
using SoHandle = std::unique_ptr;
SoHandle m_lib;
BackendPtr m_backend;
boost::string_ref m_name;
int m_iface_ver;
};
std::string backend_name ( const std::string& parSOPath );
} //namespace dindb
#endif