ctkDicomAbstractExchangeCache.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. // CTK includes
  16. #include "ctkDicomAbstractExchangeCache.h"
  17. #include "ctkDicomAppHostingTypesHelper.h"
  18. #include <ctkDicomObjectLocatorCache.h>
  19. class ctkDicomAbstractExchangeCachePrivate
  20. {
  21. public:
  22. ctkDicomAbstractExchangeCachePrivate();
  23. ~ctkDicomAbstractExchangeCachePrivate();
  24. ctkDicomObjectLocatorCache ObjectLocatorCache;
  25. };
  26. //----------------------------------------------------------------------------
  27. // ctkDicomAbstractExchangeCachePrivate methods
  28. //----------------------------------------------------------------------------
  29. ctkDicomAbstractExchangeCachePrivate::ctkDicomAbstractExchangeCachePrivate()
  30. {
  31. }
  32. //----------------------------------------------------------------------------
  33. ctkDicomAbstractExchangeCachePrivate::~ctkDicomAbstractExchangeCachePrivate()
  34. {
  35. }
  36. //----------------------------------------------------------------------------
  37. // ctkDicomAbstractExchangeCache methods
  38. //----------------------------------------------------------------------------
  39. ctkDicomAbstractExchangeCache::ctkDicomAbstractExchangeCache() :
  40. d_ptr(new ctkDicomAbstractExchangeCachePrivate)
  41. {
  42. }
  43. //----------------------------------------------------------------------------
  44. ctkDicomAbstractExchangeCache::~ctkDicomAbstractExchangeCache()
  45. {
  46. }
  47. //----------------------------------------------------------------------------
  48. QList<ctkDicomAppHosting::ObjectLocator> ctkDicomAbstractExchangeCache::getData(
  49. const QList<QUuid>& objectUUIDs,
  50. const QList<QUuid>& acceptableTransferSyntaxUIDs,
  51. bool includeBulkData)
  52. {
  53. Q_UNUSED(acceptableTransferSyntaxUIDs);
  54. Q_UNUSED(includeBulkData);
  55. return this->objectLocatorCache()->getData(objectUUIDs);
  56. }
  57. //----------------------------------------------------------------------------
  58. ctkDicomObjectLocatorCache* ctkDicomAbstractExchangeCache::objectLocatorCache()const
  59. {
  60. Q_D(const ctkDicomAbstractExchangeCache);
  61. return const_cast<ctkDicomObjectLocatorCache*>(&d->ObjectLocatorCache);
  62. }
  63. //----------------------------------------------------------------------------
  64. bool ctkDicomAbstractExchangeCache::publishData(const ctkDicomAppHosting::AvailableData& availableData, bool lastData)
  65. {
  66. if (!this->objectLocatorCache()->isCached(availableData))
  67. {
  68. return false;
  69. }
  70. bool success = this->getOtherSideExchangeService()->notifyDataAvailable(availableData, lastData);
  71. if(!success)
  72. {
  73. return false;
  74. }
  75. return true;
  76. }
  77. //----------------------------------------------------------------------------
  78. void ctkDicomAbstractExchangeCache::releaseData(const QList<QUuid>& objectUUIDs)
  79. {
  80. Q_UNUSED(objectUUIDs)
  81. }