Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Loaders/LoaderStateMachine.h @ 1640:52b8b96cb55f
cleaning namespaces
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Nov 2020 16:55:22 +0100 |
parents | 8563ea5d8ae4 |
children | 9ac2a65d4172 |
comparison
equal
deleted
inserted
replaced
1639:5cdc5b98f14d | 1640:52b8b96cb55f |
---|---|
48 | 48 |
49 You need to initialize them with the object that must be called when | 49 You need to initialize them with the object that must be called when |
50 an answer is received. | 50 an answer is received. |
51 */ | 51 */ |
52 | 52 |
53 class LoaderStateMachine : public OrthancStone::ObserverBase<LoaderStateMachine> | 53 class LoaderStateMachine : public ObserverBase<LoaderStateMachine> |
54 { | 54 { |
55 public: | 55 public: |
56 class State : public Orthanc::IDynamicObject | 56 class State : public Orthanc::IDynamicObject |
57 { | 57 { |
58 private: | 58 private: |
67 explicit State(const State& currentState) : | 67 explicit State(const State& currentState) : |
68 that_(currentState.that_) | 68 that_(currentState.that_) |
69 { | 69 { |
70 } | 70 } |
71 | 71 |
72 void Schedule(OrthancStone::OracleCommandBase* command) const | 72 void Schedule(OracleCommandBase* command) const |
73 { | 73 { |
74 that_.Schedule(command); | 74 that_.Schedule(command); |
75 } | 75 } |
76 | 76 |
77 template <typename T> | 77 template <typename T> |
78 T& GetLoader() const | 78 T& GetLoader() const |
79 { | 79 { |
80 return dynamic_cast<T&>(that_); | 80 return dynamic_cast<T&>(that_); |
81 } | 81 } |
82 | 82 |
83 virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message); | 83 virtual void Handle(const OrthancRestApiCommand::SuccessMessage& message); |
84 | 84 |
85 virtual void Handle(const OrthancStone::GetOrthancImageCommand::SuccessMessage& message); | 85 virtual void Handle(const GetOrthancImageCommand::SuccessMessage& message); |
86 | 86 |
87 virtual void Handle(const OrthancStone::GetOrthancWebViewerJpegCommand::SuccessMessage& message); | 87 virtual void Handle(const GetOrthancWebViewerJpegCommand::SuccessMessage& message); |
88 }; | 88 }; |
89 | 89 |
90 void Schedule(OrthancStone::OracleCommandBase* command); | 90 void Schedule(OracleCommandBase* command); |
91 | 91 |
92 void Start(); | 92 void Start(); |
93 | 93 |
94 private: | 94 private: |
95 void Step(); | 95 void Step(); |
96 | 96 |
97 void Clear(); | 97 void Clear(); |
98 | 98 |
99 void HandleExceptionMessage(const OrthancStone::OracleCommandExceptionMessage& message); | 99 void HandleExceptionMessage(const OracleCommandExceptionMessage& message); |
100 | 100 |
101 template <typename T> | 101 template <typename T> |
102 void HandleSuccessMessage(const T& message); | 102 void HandleSuccessMessage(const T& message); |
103 | 103 |
104 typedef std::list<OrthancStone::IOracleCommand*> PendingCommands; | 104 typedef std::list<IOracleCommand*> PendingCommands; |
105 | 105 |
106 OrthancStone::ILoadersContext& loadersContext_; | 106 ILoadersContext& loadersContext_; |
107 bool active_; | 107 bool active_; |
108 unsigned int simultaneousDownloads_; | 108 unsigned int simultaneousDownloads_; |
109 PendingCommands pendingCommands_; | 109 PendingCommands pendingCommands_; |
110 unsigned int activeCommands_; | 110 unsigned int activeCommands_; |
111 | 111 |
112 | 112 |
113 public: | 113 public: |
114 explicit LoaderStateMachine(OrthancStone::ILoadersContext& loadersContext); | 114 explicit LoaderStateMachine(ILoadersContext& loadersContext); |
115 | 115 |
116 void PostConstructor(); | 116 void PostConstructor(); |
117 | 117 |
118 virtual ~LoaderStateMachine(); | 118 virtual ~LoaderStateMachine(); |
119 | 119 |