CalcPlugin.h 1.5 KB

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