Mercurial > hg > orthanc-stone
diff Framework/Deprecated/Loaders/LoaderStateMachine.h @ 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 |
line wrap: on
line diff
--- a/Framework/Deprecated/Loaders/LoaderStateMachine.h Mon Mar 16 11:12:39 2020 +0100 +++ b/Framework/Deprecated/Loaders/LoaderStateMachine.h Mon Mar 16 11:19:50 2020 +0100 @@ -45,10 +45,16 @@ simultaneousDownloads_ of them at the same time, then will schedule the rest once slots become available. It is used, a.o., by the OrtancMultiframeVolumeLoader class. + + To use it, you need to create commands that derive from State. + + You need to initialize them with the object that must be called when + an answer is received. */ + class LoaderStateMachine : public OrthancStone::ObserverBase<LoaderStateMachine> { - protected: + public: class State : public Orthanc::IDynamicObject { private: @@ -105,9 +111,12 @@ PendingCommands pendingCommands_; unsigned int activeCommands_; + public: LoaderStateMachine(OrthancStone::ILoadersContext& loadersContext); + void PostConstructor(); + virtual ~LoaderStateMachine(); bool IsActive() const