ctkModuleDescription.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) 2010 Brigham and Women's Hospital (BWH) All Rights Reserved.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =============================================================================*/
  14. #ifndef __ctkModuleDescription_h
  15. #define __ctkModuleDescription_h
  16. #include <QIcon>
  17. #include "ctkModuleParameterGroup.h"
  18. struct ctkModuleDescriptionPrivate;
  19. /**
  20. * Description of the parameters of a module
  21. *
  22. * The parameters can be used for automated GUI generation or execution
  23. * of the module.
  24. *
  25. * For example:
  26. * - Target: This is the entry point for a shared object module and the full
  27. * command (with path) for an executable.
  28. * - Location: This is path to the executable for the module
  29. */
  30. class CTK_MODULDESC_EXPORT ctkModuleDescription
  31. {
  32. Q_DECLARE_PRIVATE(ctkModuleDescription)
  33. public:
  34. ~ctkModuleDescription();
  35. static ctkModuleDescription* parse(QIODevice* input);
  36. void setCategory(const QString& cat);
  37. QString category() const;
  38. void setIndex(const QString& ind);
  39. QString index() const;
  40. void setTitle(const QString& title);
  41. QString title() const;
  42. void setDescription(const QString& description);
  43. QString description() const;
  44. void setVersion(const QString& version);
  45. QString version() const;
  46. void setDocumentationURL(const QString& documentationURL);
  47. QString documentationURL() const;
  48. void setLicense(const QString& license);
  49. QString license() const;
  50. void setAcknowledgements(const QString& acknowledgements);
  51. QString acknowledgements() const;
  52. void setContributor(const QString& contributor);
  53. QString contributor() const;
  54. /// Set the location for the module. This is path to the file for the module.
  55. void setLocation(const QString& target);
  56. /// Get the location for the module. This is path to the file for the module.
  57. QString location() const;
  58. void setLogo(const QIcon& logo);
  59. QIcon logo() const;
  60. void addParameterGroup(ctkModuleParameterGroup* group);
  61. QList<ctkModuleParameterGroup*> parameterGroups() const;
  62. void setParameterGroups(const QList<ctkModuleParameterGroup*>& groups);
  63. bool hasParameter(const QString& name) const;
  64. ctkModuleParameter* parameter(const QString& name) const;
  65. // Does the module have any simple (primitive) return types?
  66. bool hasReturnParameters() const;
  67. bool setParameterDefaultValue(const QString& name,
  68. const QString& value);
  69. // const ModuleProcessInformation* processInformation() const
  70. // {return &ProcessInformation;}
  71. // ModuleProcessInformation* processInformation()
  72. // {return &ProcessInformation;}
  73. ///
  74. /// Read a parameter file. Syntax of file is "name: value" for each
  75. /// parameter. Returns a bool indicating whether any parameter value
  76. /// was modified.
  77. bool readParameterFile(const QString& filename);
  78. ///
  79. /// Write a parameter file. By default, the method writes out all
  80. /// the parameters. The "withHandlesToBulkParameters" parameter
  81. /// controls whether the handles to the bulk parameters (image,
  82. /// geometry, etc.) are written to the file.
  83. bool writeParameterFile(const QString& filename, bool withHandlesToBulkParameters = true) const;
  84. private:
  85. ctkModuleDescription();
  86. Q_DISABLE_COPY(ctkModuleDescription)
  87. ctkModuleDescriptionPrivate * const d_ptr;
  88. };
  89. CTK_MODULDESC_EXPORT QTextStream & operator<<(QTextStream& os, const ctkModuleDescription& module);
  90. #endif