ctkDicomAbstractApp.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 CTKDICOMABSTRACTAPP_H
  16. #define CTKDICOMABSTRACTAPP_H
  17. #include <ctkDicomAppInterface.h>
  18. #include <QScopedPointer>
  19. #include <org_commontk_dah_app_Export.h>
  20. class ctkDicomAbstractAppPrivate;
  21. class ctkDicomHostInterface;
  22. class ctkPluginContext;
  23. class ctkDicomObjectLocatorCache;
  24. /**
  25. * Provides a basic implementation for an application app.
  26. *
  27. * TODO: provide helper/convenience methods to ease application development
  28. *
  29. * The methods of the ctkDicomAppInterface have to be implemented for the business logic,
  30. *
  31. */
  32. class org_commontk_dah_app_EXPORT ctkDicomAbstractApp : public QObject, public ctkDicomAppInterface
  33. {
  34. Q_OBJECT
  35. Q_INTERFACES(ctkDicomAppInterface)
  36. public:
  37. ctkDicomAbstractApp(ctkPluginContext* context);
  38. virtual ~ctkDicomAbstractApp();
  39. /**
  40. * Method triggered by the host. Changes the state of the hosted application.
  41. * @return true if state received and not illegal in the transition diagram from the reference, false if illegal or not recognized.
  42. */
  43. virtual bool setState(ctkDicomAppHosting::State newState);
  44. virtual ctkDicomAppHosting::State getState();
  45. virtual QList<ctkDicomAppHosting::ObjectLocator> getData(
  46. const QList<QUuid>& objectUUIDs,
  47. const QList<QString>& acceptableTransferSyntaxUIDs,
  48. bool includeBulkData);
  49. ctkDicomObjectLocatorCache* objectLocatorCache()const;
  50. bool publishData(const ctkDicomAppHosting::AvailableData& availableData, bool lastData);
  51. protected:
  52. virtual ctkDicomHostInterface* getHostInterface() const;
  53. void setInternalState(ctkDicomAppHosting::State state);
  54. signals:
  55. void startProgress();
  56. void resumeProgress();
  57. void suspendProgress();
  58. void cancelProgress();
  59. void exitHostedApp();
  60. void releaseResources();
  61. private:
  62. Q_DECLARE_PRIVATE(ctkDicomAbstractApp)
  63. const QScopedPointer<ctkDicomAbstractAppPrivate> d_ptr;
  64. };
  65. #endif // CTKDICOMABSTRACTAPP_H