Mercurial > hg > orthanc
comparison OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.h @ 4300:b30a8de92ad9
abi continued
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 05 Nov 2020 19:33:18 +0100 |
parents | 2007ab69ac16 |
children | 44b53a2c0a13 |
comparison
equal
deleted
inserted
replaced
4299:3f85db78c441 | 4300:b30a8de92ad9 |
---|---|
34 { | 34 { |
35 public: | 35 public: |
36 class ICommand : public boost::noncopyable | 36 class ICommand : public boost::noncopyable |
37 { | 37 { |
38 public: | 38 public: |
39 virtual ~ICommand() | 39 virtual ~ICommand(); |
40 { | |
41 } | |
42 | 40 |
43 virtual bool Execute(const std::string& jobId) = 0; | 41 virtual bool Execute(const std::string& jobId) = 0; |
44 | 42 |
45 virtual void Serialize(Json::Value& target) const = 0; | 43 virtual void Serialize(Json::Value& target) const = 0; |
46 }; | 44 }; |
47 | 45 |
48 class ICommandUnserializer : public boost::noncopyable | 46 class ICommandUnserializer : public boost::noncopyable |
49 { | 47 { |
50 public: | 48 public: |
51 virtual ~ICommandUnserializer() | 49 virtual ~ICommandUnserializer(); |
52 { | |
53 } | |
54 | 50 |
55 virtual ICommand* Unserialize(const Json::Value& source) const = 0; | 51 virtual ICommand* Unserialize(const Json::Value& source) const = 0; |
56 }; | 52 }; |
57 | 53 |
58 private: | 54 private: |
68 SetOfCommandsJob(ICommandUnserializer* unserializer /* takes ownership */, | 64 SetOfCommandsJob(ICommandUnserializer* unserializer /* takes ownership */, |
69 const Json::Value& source); | 65 const Json::Value& source); |
70 | 66 |
71 virtual ~SetOfCommandsJob(); | 67 virtual ~SetOfCommandsJob(); |
72 | 68 |
73 size_t GetPosition() const | 69 size_t GetPosition() const; |
74 { | |
75 return position_; | |
76 } | |
77 | 70 |
78 void SetDescription(const std::string& description) | 71 void SetDescription(const std::string& description); |
79 { | |
80 description_ = description; | |
81 } | |
82 | 72 |
83 const std::string& GetDescription() const | 73 const std::string& GetDescription() const |
84 { | 74 { |
85 return description_; | 75 return description_; |
86 } | 76 } |
87 | 77 |
88 void Reserve(size_t size); | 78 void Reserve(size_t size); |
89 | 79 |
90 size_t GetCommandsCount() const | 80 size_t GetCommandsCount() const; |
91 { | |
92 return commands_.size(); | |
93 } | |
94 | 81 |
95 void AddCommand(ICommand* command); // Takes ownership | 82 void AddCommand(ICommand* command); // Takes ownership |
96 | 83 |
97 bool IsPermissive() const | 84 bool IsPermissive() const; |
98 { | |
99 return permissive_; | |
100 } | |
101 | 85 |
102 void SetPermissive(bool permissive); | 86 void SetPermissive(bool permissive); |
103 | 87 |
104 virtual void Reset() ORTHANC_OVERRIDE; | 88 virtual void Reset() ORTHANC_OVERRIDE; |
105 | 89 |
106 virtual void Start() ORTHANC_OVERRIDE | 90 virtual void Start() ORTHANC_OVERRIDE; |
107 { | |
108 started_ = true; | |
109 } | |
110 | 91 |
111 virtual float GetProgress() ORTHANC_OVERRIDE; | 92 virtual float GetProgress() ORTHANC_OVERRIDE; |
112 | 93 |
113 bool IsStarted() const | 94 bool IsStarted() const; |
114 { | |
115 return started_; | |
116 } | |
117 | 95 |
118 const ICommand& GetCommand(size_t index) const; | 96 const ICommand& GetCommand(size_t index) const; |
119 | 97 |
120 virtual JobStepResult Step(const std::string& jobId) ORTHANC_OVERRIDE; | 98 virtual JobStepResult Step(const std::string& jobId) ORTHANC_OVERRIDE; |
121 | 99 |
123 | 101 |
124 virtual bool Serialize(Json::Value& target) ORTHANC_OVERRIDE; | 102 virtual bool Serialize(Json::Value& target) ORTHANC_OVERRIDE; |
125 | 103 |
126 virtual bool GetOutput(std::string& output, | 104 virtual bool GetOutput(std::string& output, |
127 MimeType& mime, | 105 MimeType& mime, |
128 const std::string& key) ORTHANC_OVERRIDE | 106 const std::string& key) ORTHANC_OVERRIDE; |
129 { | |
130 return false; | |
131 } | |
132 }; | 107 }; |
133 } | 108 } |