CalcPlugin.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef MANDEL_CALCPLUGIN_H
  2. #define MANDEL_CALCPLUGIN_H
  3. #include <string>
  4. #if defined(__GNUC__)
  5. #define MANDEL_EXPORT __attribute__((visibility("default")))
  6. #define MANDEL_IMPORT
  7. #elif defined(_MSC_VER)
  8. #define MANDEL_EXPORT __declspec(dllexport)
  9. #define MANDEL_IMPORT __declspec(dllimport)
  10. #else
  11. #define MANDEL_EXPORT
  12. #define MANDEL_IMPORT
  13. #endif
  14. namespace mnd
  15. {
  16. class CalcPlugin;
  17. class MandelGenerator;
  18. }
  19. class MANDEL_EXPORT mnd::CalcPlugin
  20. {
  21. void* handle;
  22. public:
  23. CalcPlugin(const std::string& path);
  24. CalcPlugin(const CalcPlugin&) = delete;
  25. CalcPlugin(CalcPlugin&&) = default;
  26. ~CalcPlugin(void);
  27. CalcPlugin& operator=(const CalcPlugin&) = delete;
  28. CalcPlugin& operator=(CalcPlugin&&) = default;
  29. ///
  30. /// \brief gets the generators provided by this plugin
  31. /// \return a vector containing the generators provided by this
  32. /// plugin. If no plugin was loaded, the vector is empty.
  33. ///
  34. /// \note The returned generators (vector incl.) have the same lifetime as
  35. /// the plugin i.e. they are no longer valid should the plugin
  36. /// struct be destroyed.
  37. ///
  38. const std::vector<mnd::MandelGenerator*>& getGenerators(void);
  39. inline bool isValid(void) const { return handle != nullptr; }
  40. };
  41. #endif // MANDEL_CALCPLUGIN