Mercurial > hg > orthanc
comparison OrthancServer/Scheduler/ServerJob.cpp @ 1304:7b6925b0890d
cppcheck
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Feb 2015 17:03:17 +0100 |
parents | 6e7e5ed91c2d |
children | bd1889029cbb |
comparison
equal
deleted
inserted
replaced
1303:bba8a47922d1 | 1304:7b6925b0890d |
---|---|
42 { | 42 { |
43 std::map<ServerCommandInstance*, unsigned int> index; | 43 std::map<ServerCommandInstance*, unsigned int> index; |
44 | 44 |
45 unsigned int count = 0; | 45 unsigned int count = 0; |
46 for (std::list<ServerCommandInstance*>::const_iterator | 46 for (std::list<ServerCommandInstance*>::const_iterator |
47 it = filters_.begin(); it != filters_.end(); it++) | 47 it = filters_.begin(); it != filters_.end(); ++it) |
48 { | 48 { |
49 index[*it] = count++; | 49 index[*it] = count++; |
50 } | 50 } |
51 | 51 |
52 for (std::list<ServerCommandInstance*>::const_iterator | 52 for (std::list<ServerCommandInstance*>::const_iterator |
53 it = filters_.begin(); it != filters_.end(); it++) | 53 it = filters_.begin(); it != filters_.end(); ++it) |
54 { | 54 { |
55 const std::list<ServerCommandInstance*>& nextCommands = (*it)->GetNextCommands(); | 55 const std::list<ServerCommandInstance*>& nextCommands = (*it)->GetNextCommands(); |
56 | 56 |
57 for (std::list<ServerCommandInstance*>::const_iterator | 57 for (std::list<ServerCommandInstance*>::const_iterator |
58 next = nextCommands.begin(); next != nextCommands.end(); next++) | 58 next = nextCommands.begin(); next != nextCommands.end(); ++next) |
59 { | 59 { |
60 if (index.find(*next) == index.end() || | 60 if (index.find(*next) == index.end() || |
61 index[*next] <= index[*it]) | 61 index[*next] <= index[*it]) |
62 { | 62 { |
63 // You must reorder your calls to "ServerJob::AddCommand" | 63 // You must reorder your calls to "ServerJob::AddCommand" |
80 CheckOrdering(); | 80 CheckOrdering(); |
81 | 81 |
82 size_t size = filters_.size(); | 82 size_t size = filters_.size(); |
83 | 83 |
84 for (std::list<ServerCommandInstance*>::iterator | 84 for (std::list<ServerCommandInstance*>::iterator |
85 it = filters_.begin(); it != filters_.end(); it++) | 85 it = filters_.begin(); it != filters_.end(); ++it) |
86 { | 86 { |
87 target.Enqueue(*it); | 87 target.Enqueue(*it); |
88 } | 88 } |
89 | 89 |
90 filters_.clear(); | 90 filters_.clear(); |
92 | 92 |
93 return size; | 93 return size; |
94 } | 94 } |
95 | 95 |
96 | 96 |
97 ServerJob::ServerJob() | 97 ServerJob::ServerJob() : |
98 jobId_(Toolbox::GenerateUuid()), | |
99 submitted_(false), | |
100 description_("no description") | |
98 { | 101 { |
99 jobId_ = Toolbox::GenerateUuid(); | |
100 submitted_ = false; | |
101 description_ = "no description"; | |
102 } | 102 } |
103 | 103 |
104 | 104 |
105 ServerJob::~ServerJob() | 105 ServerJob::~ServerJob() |
106 { | 106 { |
107 for (std::list<ServerCommandInstance*>::iterator | 107 for (std::list<ServerCommandInstance*>::iterator |
108 it = filters_.begin(); it != filters_.end(); it++) | 108 it = filters_.begin(); it != filters_.end(); ++it) |
109 { | 109 { |
110 delete *it; | 110 delete *it; |
111 } | 111 } |
112 | 112 |
113 for (std::list<IDynamicObject*>::iterator | 113 for (std::list<IDynamicObject*>::iterator |
114 it = payloads_.begin(); it != payloads_.end(); it++) | 114 it = payloads_.begin(); it != payloads_.end(); ++it) |
115 { | 115 { |
116 delete *it; | 116 delete *it; |
117 } | 117 } |
118 } | 118 } |
119 | 119 |