ctkCmdLineModuleBackend.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #ifndef CTKCMDLINEMODULEBACKEND_H
  16. #define CTKCMDLINEMODULEBACKEND_H
  17. #include "ctkCommandLineModulesCoreExport.h"
  18. class ctkCmdLineModuleFrontend;
  19. class ctkCmdLineModuleFuture;
  20. template<typename T> class QList;
  21. class QUrl;
  22. /**
  23. * \class ctkCmdLineModuleBackend
  24. * \brief Abstract base class for all back-end command line module
  25. * implementations.
  26. * \ingroup CommandLineModulesCore
  27. * \see ctkCmdLineModuleBackendLocalProcess
  28. * \see ctkCmdLineModuleBackendFunctionPointer
  29. */
  30. struct CTK_CMDLINEMODULECORE_EXPORT ctkCmdLineModuleBackend
  31. {
  32. ~ctkCmdLineModuleBackend();
  33. /**
  34. * @brief Returns the name of the type of the backend, not the name
  35. * of the thing or application that is run.
  36. * @return A QString containing the name.
  37. */
  38. virtual QString name() const = 0;
  39. /**
  40. * @brief Returns a brief description of the type of the backend.
  41. * @return A QString containing a description.
  42. */
  43. virtual QString description() const = 0;
  44. /**
  45. * @brief Returns a list of the capabilities or the types of things
  46. * that this back-end can run.
  47. * @return A list of "schemes", meaning the capabilities.
  48. */
  49. virtual QList<QString> schemes() const = 0;
  50. /**
  51. * @brief Returns a timestap of the backend, which for example in the
  52. * case of the LocalProcess may be the last modified time of the command line
  53. * application.
  54. */
  55. virtual qint64 timeStamp(const QUrl& location) const = 0;
  56. /**
  57. * @brief Get the XML parameter description from the given location.
  58. * @param location The location URL specifying the module.
  59. * @return The raw XML parameter description.
  60. *
  61. * This method may be concurrently called by the ctkCmdLineModuleManager and
  62. * must be thread-safe.
  63. *
  64. */
  65. virtual QByteArray rawXmlDescription(const QUrl& location) = 0;
  66. protected:
  67. friend class ctkCmdLineModuleManager;
  68. /**
  69. * @brief The main method to actually execute the back-end process.
  70. * @param A pointer to a front end implementation.
  71. */
  72. virtual ctkCmdLineModuleFuture run(ctkCmdLineModuleFrontend* frontend) = 0;
  73. };
  74. #endif // CTKCMDLINEMODULEBACKEND_H