ctkDicomAbstractExchangeCache.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 CTKDICOMABSTRACTEXCHANGECACHE_H
  16. #define CTKDICOMABSTRACTEXCHANGECACHE_H
  17. #include <ctkDicomExchangeInterface.h>
  18. #include <QScopedPointer>
  19. #include <org_commontk_dah_core_Export.h>
  20. class ctkDicomAbstractExchangeCachePrivate;
  21. class ctkDicomObjectLocatorCache;
  22. /**
  23. * @brief Provides a basic convenience methods for the data exchange.
  24. *
  25. * The implementation is based on the ctkDicomObjectLocatorCache.
  26. */
  27. class org_commontk_dah_core_EXPORT ctkDicomAbstractExchangeCache : public QObject, public virtual ctkDicomExchangeInterface
  28. {
  29. Q_OBJECT
  30. Q_INTERFACES(ctkDicomExchangeInterface)
  31. public:
  32. /**
  33. * @brief Construct object.
  34. *
  35. * @param exchangeService the ctkDicomExchangeService of the other side.
  36. */
  37. ctkDicomAbstractExchangeCache();
  38. /**
  39. * @brief Destructor
  40. *
  41. */
  42. virtual ~ctkDicomAbstractExchangeCache();
  43. /**
  44. * @brief Gets the exchange service of the other side.
  45. *
  46. * If we are a host, this must return the exchange service
  47. * of the hosted app and vice versa.
  48. *
  49. * @return ctkDicomExchangeService * of the other side
  50. */
  51. virtual ctkDicomExchangeInterface* getOtherSideExchangeService() const = 0;
  52. /**
  53. * @brief Provide ctkDicomAppHosting::ObjectLocators to the other side.
  54. *
  55. * If we are a host, the other side is the hosted app and vice versa.
  56. *
  57. * @param objectUUIDs
  58. * @param acceptableTransferSyntaxUIDs
  59. * @param includeBulkData
  60. * @return QList<ctkDicomAppHosting::ObjectLocator>
  61. */
  62. virtual QList<ctkDicomAppHosting::ObjectLocator> getData(
  63. const QList<QUuid>& objectUUIDs,
  64. const QList<QString>& acceptableTransferSyntaxUIDs,
  65. bool includeBulkData);
  66. void releaseData(const QList<QUuid>& objectUUIDs);
  67. /**
  68. * @brief Return the cache for outgoing data.
  69. *
  70. * @return ctkDicomObjectLocatorCache *
  71. */
  72. ctkDicomObjectLocatorCache* objectLocatorCache() const;
  73. /**
  74. * @brief Publish data to other side
  75. *
  76. * @param availableData
  77. * @param lastData
  78. * @return bool
  79. */
  80. bool publishData(const ctkDicomAppHosting::AvailableData& availableData, bool lastData);
  81. // Methods to support receiving data
  82. /**
  83. * @brief Return the incoming available data.
  84. *
  85. * @return AvailableData *
  86. */
  87. const ctkDicomAppHosting::AvailableData& getIncomingAvailableData() const;
  88. /**
  89. * @brief Return whether the incoming data was marked as @a lastData.
  90. *
  91. * @return bool value of @a lastData in incoming notifyDataAvailable call
  92. */
  93. bool lastIncomingData() const;
  94. /**
  95. * @brief Receive notification from other side.
  96. *
  97. */
  98. bool notifyDataAvailable(const ctkDicomAppHosting::AvailableData& data, bool lastData);
  99. /**
  100. * @brief Clean internal data stucture that keeps the incoming data.
  101. *
  102. * Called when other side is gone (i.e., usually the other side is a hosted app).
  103. *
  104. */
  105. void cleanIncomingData();
  106. Q_SIGNALS:
  107. void dataAvailable();
  108. private:
  109. Q_SIGNALS:
  110. void internalDataAvailable();
  111. private:
  112. Q_DECLARE_PRIVATE(ctkDicomAbstractExchangeCache)
  113. const QScopedPointer<ctkDicomAbstractExchangeCachePrivate> d_ptr; /**< TODO */
  114. };
  115. #endif // CTKDICOMABSTRACTEXCHANGECACHE_H