ctkCmdLineModuleManager.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 CTKCMDLINEMODULEMANAGER_H
  16. #define CTKCMDLINEMODULEMANAGER_H
  17. #include <ctkCommandLineModulesCoreExport.h>
  18. #include <QStringList>
  19. #include <QString>
  20. #include "ctkCmdLineModuleReference.h"
  21. struct ctkCmdLineModuleInstanceFactory;
  22. class ctkCmdLineModuleInstance;
  23. class ctkCmdLineModuleManagerPrivate;
  24. /**
  25. * \ingroup CommandLineModulesCore
  26. */
  27. class CTK_CMDLINEMODULECORE_EXPORT ctkCmdLineModuleManager : public QObject
  28. {
  29. Q_OBJECT
  30. public:
  31. enum ValidationMode {
  32. /** registerModule() will throw an exception if the XML is invalid */
  33. STRICT_VALIDATION,
  34. /** no XML schema validation at all */
  35. SKIP_VALIDATION,
  36. /**
  37. * registerModule() will validate the XML description but proceed with
  38. * registration on validation error.
  39. */
  40. WEAK_VALIDATION
  41. };
  42. ctkCmdLineModuleManager(ctkCmdLineModuleInstanceFactory* descriptionFactory,
  43. ValidationMode = STRICT_VALIDATION);
  44. ~ctkCmdLineModuleManager();
  45. ctkCmdLineModuleReference registerModule(const QString& location);
  46. void unregisterModule(const ctkCmdLineModuleReference& moduleRef);
  47. ctkCmdLineModuleReference moduleReference(const QString& location) const;
  48. QList<ctkCmdLineModuleReference> moduleReferences() const;
  49. ctkCmdLineModuleInstance* createModuleInstance(const ctkCmdLineModuleReference& moduleRef);
  50. QList<ctkCmdLineModuleInstance*> moduleInstances(const ctkCmdLineModuleReference& moduleRef) const;
  51. Q_SIGNALS:
  52. void moduleAdded(const ctkCmdLineModuleReference);
  53. void moduleRemoved(const ctkCmdLineModuleReference);
  54. private:
  55. QScopedPointer<ctkCmdLineModuleManagerPrivate> d;
  56. Q_DISABLE_COPY(ctkCmdLineModuleManager)
  57. };
  58. #endif // CTKCMDLINEMODULEMANAGER_H