30 using namespace YACS::ENGINE;
32 DeploymentTreeOnHeap::DeploymentTreeOnHeap():_cnt(1)
55 DEBTRACE(
"DeploymentTreeOnHeap::appendTask: " << task );
62 DEBTRACE(
"DeploymentTreeOnHeap::appendTask component: " << ci );
63 DEBTRACE(
"DeploymentTreeOnHeap::appendTask container: " << cont );
69 DEBTRACE(
"DeploymentTreeOnHeap::appendTask container: " << cont );
72 vector< vector< vector< pair<Task *, Scheduler *> > > >::iterator iter1;
74 vector< vector< pair<Task *, Scheduler * > > >::iterator iter2;
76 vector< pair<Task *, Scheduler *> >::iterator iter3;
79 for(iter1=
_tree.begin();iter1!=
_tree.end();iter1++)
81 Task* task=(*iter1)[0][0].first;
85 if(iter1==
_tree.end())
88 DEBTRACE(
"create a vector of vector of tasks for container " << cont);
89 _tree.push_back(vector< vector< pair< Task *, Scheduler *> > >());
95 for(iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
96 if(((*iter2)[0]).first->getComponent()==ci)
98 if(iter2==(*iter1).end())
101 DEBTRACE(
"create a vector of tasks for component instance " << ci);
102 (*iter1).push_back(vector< pair< Task *, Scheduler *> >());
103 iter2=(*iter1).end();
108 for(iter3=(*iter2).begin();iter3!=(*iter2).end();iter3++)
109 if((*iter3).first==task)
112 DEBTRACE(
"add task to vector of tasks " << task);
113 (*iter2).push_back(pair<Task *,Scheduler *>(task,cloner));
119 DEBTRACE(
"getNumberOfCTDefContainer ");
120 vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
121 vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
122 vector< pair<Task *, Scheduler *> >::const_iterator iter3;
124 for(iter1=
_tree.begin();iter1!=
_tree.end();iter1++)
126 bool isCTDefSurely1=
true;
127 for(iter2=(*iter1).begin();iter2!=(*iter1).end() && isCTDefSurely1;iter2++)
129 bool isCTDefSurely2=
true;
130 for(iter3=(*iter2).begin();iter3!=(*iter2).end() && isCTDefSurely2;iter3++)
131 if((*iter3).second!=0)
132 isCTDefSurely2=
false;
135 else if(((*iter2)[0].first)->getComponent())
136 isCTDefSurely1=(((*iter2)[0].first)->getComponent()->isAttachedOnCloning());
138 isCTDefSurely1=
false;
140 Container *cont=((*iter1)[0][0].first)->getContainer();
153 if((*iter1)[0][0].second->isMultiplicitySpecified(val))
162 DEBTRACE(
"getNumberOfRTODefContainer");
163 vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
164 vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
165 vector< pair<Task *, Scheduler *> >::const_iterator iter3;
167 for(iter1=
_tree.begin();iter1!=
_tree.end();iter1++)
169 bool isRTODefSurely1=
true;
170 for(iter2=(*iter1).begin();iter2!=(*iter1).end() && isRTODefSurely1;iter2++)
172 bool isRTODefSurely2=
true;
173 for(iter3=(*iter2).begin();iter3!=(*iter2).end() && isRTODefSurely2;iter3++)
174 if((*iter3).second==0)
175 isRTODefSurely2=
false;
177 if(((*iter2)[0].first)->getComponent())
178 isRTODefSurely1=!(((*iter2)[0].first)->getComponent()->isAttachedOnCloning());
180 isRTODefSurely1=
false;
182 isRTODefSurely1=
false;
185 if(((*iter1)[0][0].first)->getContainer())
186 if(!((*iter1)[0][0].first)->getContainer()->isAttachedOnCloning())
194 DEBTRACE(
"getNumberOfCTDefComponentInstances");
195 vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
196 vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
197 vector< pair<Task *, Scheduler *> >::const_iterator iter3;
199 for(iter1=
_tree.begin();iter1!=
_tree.end();iter1++)
200 for(iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
202 bool isCTDefSurely=
true;
203 for(iter3=(*iter2).begin();iter3!=(*iter2).end() && isCTDefSurely;iter3++)
204 if((*iter3).second!=0)
209 if(((*iter2)[0].first)->getComponent() && ((*iter2)[0].first)->getComponent()->isAttachedOnCloning())
217 DEBTRACE(
"getNumberOfRTODefComponentInstances");
218 vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
219 vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
220 vector< pair<Task *, Scheduler *> >::const_iterator iter3;
222 for(iter1=
_tree.begin();iter1!=
_tree.end();iter1++)
223 for(iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
226 for(iter3=(*iter2).begin();iter3!=(*iter2).end() && !isRTODef;iter3++)
227 if((*iter3).second!=0)
229 if(isRTODef && ((*iter2)[0].first)->getComponent() && !((*iter2)[0].first)->getComponent()->isAttachedOnCloning())
237 vector<Container *>
ret;
238 vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
239 for(iter1=
_tree.begin();iter1!=
_tree.end();iter1++)
241 Task* task=(*iter1)[0][0].first;
250 vector<Container *>
ret;
251 vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
252 vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
253 vector< pair<Task *, Scheduler *> >::const_iterator iter3;
254 for(iter1=
_tree.begin();iter1!=
_tree.end();iter1++)
256 bool isCTDefSurely1=
true;
257 for(iter2=(*iter1).begin();iter2!=(*iter1).end() && isCTDefSurely1;iter2++)
259 bool isCTDefSurely2=
true;
260 for(iter3=(*iter2).begin();iter3!=(*iter2).end() && isCTDefSurely2;iter3++)
261 if((*iter3).second!=0)
262 isCTDefSurely2=
false;
265 else if(((*iter2)[0].first)->getComponent())
266 isCTDefSurely1=(((*iter2)[0].first)->getComponent()->isAttachedOnCloning());
268 isCTDefSurely1=
false;
270 Container *cont=((*iter1)[0][0].first)->getContainer();
287 vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
288 vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
289 vector< pair<Task *, Scheduler *> >::const_iterator iter3;
290 vector<Container *>
ret;
291 for(iter1=
_tree.begin();iter1!=
_tree.end();iter1++)
293 bool isRTODefSurely1=
true;
294 for(iter2=(*iter1).begin();iter2!=(*iter1).end() && isRTODefSurely1;iter2++)
296 bool isRTODefSurely2=
true;
297 for(iter3=(*iter2).begin();iter3!=(*iter2).end() && isRTODefSurely2;iter3++)
298 if((*iter3).second==0)
299 isRTODefSurely2=
false;
302 if(((*iter2)[0].first)->getComponent())
303 isRTODefSurely1=!(((*iter2)[0].first)->getComponent()->isAttachedOnCloning());
305 isRTODefSurely1=
false;
308 isRTODefSurely1=
false;
312 Container* cont= (*iter1)[0][0].first->getContainer();
323 vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
324 vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
325 vector< pair<Task *, Scheduler *> >::const_iterator iter3;
327 std::vector<Task *>
ret;
328 for(iter1=
_tree.begin();iter1!=
_tree.end();iter1++)
330 if(((*iter1)[0][0].first)->getContainer()==cont)
331 for(iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
332 if(((*iter2)[0].first)->getComponent()==0)
333 for(iter3=(*iter2).begin();iter3!=(*iter2).end();iter3++)
334 ret.push_back((*iter3).first);
341 vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
342 vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
343 vector< pair<Task *, Scheduler *> >::const_iterator iter3;
345 std::vector<Task *>
ret;
346 for(iter1=
_tree.begin();iter1!=
_tree.end();iter1++)
347 for(iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
348 if(((*iter2)[0].first)->getComponent()==
comp)
349 for(iter3=(*iter2).begin();iter3!=(*iter2).end();iter3++)
350 ret.push_back((*iter3).first);
356 DEBTRACE(
"DeploymentTreeOnHeap::getComponentsLinkedToContainer ");
357 vector<ComponentInstance *>
ret;
358 vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
359 vector< vector< pair<Task *, Scheduler * > > >::const_iterator iter2;
361 for(iter1=
_tree.begin();iter1!=
_tree.end();++iter1)
364 for(iter2=(*iter1).begin();iter2!=(*iter1).end();++iter2)
371 ret.push_back(compo);
383 DEBTRACE(
"presenceOfDefaultContainer");
384 vector< vector< vector< pair<Task *, Scheduler *> > > >::const_iterator iter1;
385 for(iter1=
_tree.begin();iter1!=
_tree.end();iter1++)
386 if(!((*iter1)[0][0].first)->getContainer())
395 ret.push_back((*iter).first);
479 return vector<Container *>();
489 return vector<Container *>();
499 return vector<Container *>();
506 return vector<Task *>();
513 return vector<Task *>();
520 return vector<ComponentInstance *>();
539 return vector<Task *>();