Mercurial > hg > orthanc-stone
comparison Framework/Deprecated/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp @ 1314:9b126de2cde2 broker
Since the observer system now uses shared_ptr and many registrations are
done in the constructors, and since we cannot called shared_from_this() in
the constructors, it is mandatory to split construction from registration.
This has been done by making many ctors protected and replacing them
by factory methods that directly return shared_ptrs + added PostConstructor
method when base classes perform shared_from_this() calls too.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 16 Mar 2020 11:19:50 +0100 |
parents | 9bea7e15b519 |
children | cbfdba08e039 |
comparison
equal
deleted
inserted
replaced
1313:f30905f5d246 | 1314:9b126de2cde2 |
---|---|
444 , simultaneousDownloads_(4) | 444 , simultaneousDownloads_(4) |
445 , volume_(volume) | 445 , volume_(volume) |
446 , sorter_(new OrthancStone::BasicFetchingItemsSorter::Factory) | 446 , sorter_(new OrthancStone::BasicFetchingItemsSorter::Factory) |
447 , volumeImageReadyInHighQuality_(false) | 447 , volumeImageReadyInHighQuality_(false) |
448 { | 448 { |
449 } | |
450 | |
451 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> | |
452 OrthancSeriesVolumeProgressiveLoader::Create( | |
453 OrthancStone::ILoadersContext& loadersContext, | |
454 const boost::shared_ptr<OrthancStone::DicomVolumeImage>& volume) | |
455 { | |
449 std::auto_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext.Lock()); | 456 std::auto_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext.Lock()); |
450 | 457 |
451 // TODO => Move this out of constructor WHY? | 458 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> obj( |
452 Register<OrthancStone::OrthancRestApiCommand::SuccessMessage>( | 459 new OrthancSeriesVolumeProgressiveLoader(loadersContext,volume)); |
453 lock->GetOracleObservable(), | 460 |
461 obj->Register<OrthancStone::OrthancRestApiCommand::SuccessMessage>( | |
462 lock->GetOracleObservable(), | |
454 &OrthancSeriesVolumeProgressiveLoader::LoadGeometry); | 463 &OrthancSeriesVolumeProgressiveLoader::LoadGeometry); |
455 | 464 |
456 Register<OrthancStone::GetOrthancImageCommand::SuccessMessage>( | 465 obj->Register<OrthancStone::GetOrthancImageCommand::SuccessMessage>( |
457 lock->GetOracleObservable(), | 466 lock->GetOracleObservable(), |
458 &OrthancSeriesVolumeProgressiveLoader::LoadBestQualitySliceContent); | 467 &OrthancSeriesVolumeProgressiveLoader::LoadBestQualitySliceContent); |
459 | 468 |
460 Register<OrthancStone::GetOrthancWebViewerJpegCommand::SuccessMessage>( | 469 obj->Register<OrthancStone::GetOrthancWebViewerJpegCommand::SuccessMessage>( |
461 lock->GetOracleObservable(), | 470 lock->GetOracleObservable(), |
462 &OrthancSeriesVolumeProgressiveLoader::LoadJpegSliceContent); | 471 &OrthancSeriesVolumeProgressiveLoader::LoadJpegSliceContent); |
463 } | 472 |
473 return obj; | |
474 } | |
475 | |
464 | 476 |
465 OrthancSeriesVolumeProgressiveLoader::~OrthancSeriesVolumeProgressiveLoader() | 477 OrthancSeriesVolumeProgressiveLoader::~OrthancSeriesVolumeProgressiveLoader() |
466 { | 478 { |
467 LOG(TRACE) << "OrthancSeriesVolumeProgressiveLoader::~OrthancSeriesVolumeProgressiveLoader()"; | 479 LOG(TRACE) << "OrthancSeriesVolumeProgressiveLoader::~OrthancSeriesVolumeProgressiveLoader()"; |
468 } | 480 } |