#include <PsnDoubleList.h>
Collaboration diagram for PsnDoubleList:

Public Methods | |
| PsnDoubleList () | |
| contruct an empty list | |
| bool | push_front (PsnReferenceObjectHandle *objectHandle) |
| add a reference handle to the start of the super list. | |
| bool | push_back (PsnReferenceObjectHandle *objectHandle) |
| add a reference handle to the end of the super list. | |
| bool | insert (PsnReferenceObjectHandle *objectHandle) |
| insert a reference handle to the super list at a position that respects the ordering policy (at present defined by the < operator on referenceobjecthandles). | |
| bool | remove (PsnReferenceObjectHandle *objectHandle) |
| remove an object handle from the super list | |
| bool | activate (PsnReferenceObjectHandle *M, PsnDoubleListElement **elemExecPrec=NULL) |
| pour ajouter un module à la liste des modules à compute | |
| bool | suspend (PsnReferenceObjectHandle *M) |
| pour supprimer un module de la liste des modules à compute | |
methods to iterate throught the super list | |
| PsnDoubleListElement * | superListBegin () |
| superListBegin | |
| PsnDoubleListElement * | superListNext (PsnDoubleListElement *currentElement) |
| get the element following the iterator passed as parameter in the super list | |
methods to iterate throught the active list | |
| PsnDoubleListElement * | begin () |
| begin | |
| PsnDoubleListElement * | next (PsnDoubleListElement *pcour) |
| get the element following the iterator passed as parameter in the active list | |
Protected Methods | |
| PsnDoubleListElement * | findInSuperList (PsnReferenceObjectHandle *p) |
| Find an element in the super list. | |
| PsnDoubleListElement * | find (PsnReferenceObjectHandle *p) |
| Find an element in the active list. | |
Protected Attributes | |
| PsnDoubleListElement * | _startOfSuperList |
| first element in super list | |
| PsnDoubleListElement * | _lastOfSuperList |
| last element in super list | |
| PsnDoubleListElement * | _start |
| fisrt element in active liste | |
| PsnDoubleListElement * | _last |
| last element in active list | |
Definition at line 30 of file PsnDoubleList.h.
|
|
contruct an empty list
Definition at line 22 of file PsnDoubleList.cxx. References _last, _lastOfSuperList, _start, and _startOfSuperList.
00022 {
00023 _startOfSuperList=NULL;
00024 _lastOfSuperList=NULL;
00025 _start=NULL;
00026 _last=NULL;
00027 }
|
|
||||||||||||
|
pour ajouter un module à la liste des modules à compute
Definition at line 146 of file PsnDoubleList.cxx. References _last, _start, _startOfSuperList, PsnDoubleListElement::listeElem, PsnDoubleListElement::nextInActiveList, PsnDoubleListElement::nextInSuperList, and PsnDoubleListElement::previousInActiveList.
00147 {
00148 PsnDoubleListElement * pcour=_startOfSuperList;
00149 PsnDoubleListElement * resul=NULL;
00150 PsnDoubleListElement * execSuiv=_start;
00151 PsnDoubleListElement * execPrec=NULL;
00152 //on commence par chercher M dans la liste complète en gardant la trace du dernier élément qui appartient à la liste des exécutables.
00153 while((pcour!=NULL)&&(resul==NULL))
00154 {
00155 if(pcour->listeElem==M)
00156 {
00157 resul=pcour;
00158 }
00159 else
00160 {
00161 if( pcour->nextInActiveList != NULL )
00162 {//l'élément courant est dans la liste des exec
00163 execPrec = pcour ;
00164 execSuiv = pcour->nextInActiveList;
00165 }
00166 else
00167 { // pcour is the last one of the active list
00168 // or is not present in the active list
00169 if ( pcour->previousInActiveList != NULL )
00170 {
00171 // pcour is in active list
00172 execSuiv = NULL;
00173 execPrec = pcour;
00174 }
00175 else
00176 {
00177 // pcour is either the only element in the active list
00178 // or is not in the active list
00179 if ( pcour == _start )
00180 {
00181 //pcour is the only element in the active list
00182 execSuiv = NULL;
00183 execPrec = pcour;
00184 }
00185 else
00186 {
00187 // nothing to do
00188 }
00189 }
00190 }
00191 pcour = pcour->nextInSuperList;
00192 }
00193 }
00194 //rendu ici, pcour contient un pointeur sur l'élément ou NULL si l'élément n'est pas dans la liste
00195 //execPrec, le précédant de pcour dans la liste des exécutables
00196 //execSuiv, le suivant de pcour dans la liste des exécutables
00197 if (pcour==NULL) {
00198 if(elemExecPrec!=NULL) *elemExecPrec=execPrec;
00199 return false;
00200 }
00201 else {
00202 if (execPrec==NULL) {//premier dans la liste des executables
00203 _start=pcour;
00204 }
00205 else {
00206 execPrec->nextInActiveList=pcour;
00207 }
00208 if(execSuiv==NULL) {//dernier dans la liste des executables
00209 _last=pcour;
00210 }
00211 else {
00212 execSuiv->previousInActiveList=pcour;
00213 }
00214 pcour->previousInActiveList=execPrec;
00215 pcour->nextInActiveList=execSuiv;
00216 if(elemExecPrec!=NULL) *elemExecPrec=execPrec;
00217 return true ;
00218 }
00219 }
|
|
|
begin
Definition at line 286 of file PsnDoubleList.cxx. References _start. Referenced by PsnFrameScheduler::runStep(), and PsnBenchScheduler::runStep().
00286 {
00287 return _start;
00288 }
|
|
|
Find an element in the active list.
Definition at line 260 of file PsnDoubleList.cxx. References _start, PsnDoubleListElement::listeElem, and PsnDoubleListElement::nextInActiveList. Referenced by suspend().
00260 {
00261 PsnDoubleListElement * pcour=_start;
00262 PsnDoubleListElement * resul=NULL;
00263 while((pcour!=NULL)&&(resul==NULL)) {
00264 if(pcour->listeElem==p) {
00265 resul=pcour;
00266 }
00267 pcour=pcour->nextInActiveList;
00268 }
00269 return resul;
00270 }
|
|
|
Find an element in the super list.
Definition at line 248 of file PsnDoubleList.cxx. References _startOfSuperList, PsnDoubleListElement::listeElem, and PsnDoubleListElement::nextInSuperList. Referenced by remove().
00248 {
00249 PsnDoubleListElement * pcour=_startOfSuperList;
00250 PsnDoubleListElement * resul=NULL;
00251 while((pcour!=NULL)&&(resul==NULL)) {
00252 if(pcour->listeElem==p) {
00253 resul=pcour;
00254 }
00255 pcour=pcour->nextInSuperList;
00256 }
00257 return resul;
00258 }
|
|
|
insert a reference handle to the super list at a position that respects the ordering policy (at present defined by the < operator on referenceobjecthandles). A call to activate is needed to move the added reference handle to the active list.
Definition at line 66 of file PsnDoubleList.cxx. References _lastOfSuperList, _startOfSuperList, PsnDoubleListElement::listeElem, PsnDoubleListElement::nextInSuperList, and PsnDoubleListElement::previousInSuperList. Referenced by PsnFrameScheduler::addToScheduable().
00066 {
00067 PsnDoubleListElement * elem=new PsnDoubleListElement(M);
00068 PsnDoubleListElement * pcour=_startOfSuperList;
00069 PsnDoubleListElement * prec=NULL;
00070 enum{ON_BOUCLE,FIN_LISTE,PLACE_TROUVEE} etatBoucle;
00071 etatBoucle=ON_BOUCLE;
00072
00073 while(etatBoucle==ON_BOUCLE) {
00074 if (pcour==NULL) {
00075 etatBoucle=FIN_LISTE;
00076 }
00077 else {
00078 if (*pcour->listeElem >= *M)
00079 {
00080 etatBoucle=PLACE_TROUVEE;
00081 }
00082 else
00083 {
00084 prec=pcour;
00085 pcour=pcour->nextInSuperList;
00086 }
00087 }
00088 }
00089 /* ici on sait que
00090 * si prec != NULL , *prec->listeElem < *M
00091 * soit pcour == NULL ou *M <= *pcour->listeElem
00092 * Il faut donc refaire le chainage
00093 */
00094 elem->nextInSuperList=pcour;
00095 elem->previousInSuperList=prec;
00096 if (prec==NULL) {//insertion de l'élément au début
00097 if (pcour!=NULL) {//la liste n'est pas vide
00098 pcour->previousInSuperList=elem;
00099 }
00100 else {
00101 _lastOfSuperList=elem;
00102 }
00103 _startOfSuperList=elem;
00104 }
00105 else {
00106 prec->nextInSuperList=elem;
00107 if (pcour==NULL) {//on ajoute à la fin
00108 _lastOfSuperList=elem;
00109 }
00110 else {
00111 pcour->previousInSuperList=elem;
00112 }
00113 }
00114 return false;
00115 }
|
|
|
get the element following the iterator passed as parameter in the active list
Definition at line 290 of file PsnDoubleList.cxx. References PsnDoubleListElement::nextInActiveList. Referenced by PsnFrameScheduler::runStep(), and PsnBenchScheduler::runStep().
00290 {
00291 if(pcour == NULL) {
00292 cerr<<"PsnDoubleList::next WARNING:Suivant de NULL inexistant"<<endl;
00293 return NULL;
00294 }
00295 else {
00296 return pcour->nextInActiveList;
00297 }
00298 }
|
|
|
add a reference handle to the end of the super list. A call to activate is needed to move the added reference handle to the active list.
Definition at line 48 of file PsnDoubleList.cxx. References _lastOfSuperList, _startOfSuperList, PsnDoubleListElement::nextInSuperList, and PsnDoubleListElement::previousInSuperList.
00048 {
00049 PsnDoubleListElement * elem=new PsnDoubleListElement(M);
00050
00051 //1 Gestion de la liste complète
00052 //chainage dans le sens prec;
00053 elem->previousInSuperList=_lastOfSuperList;
00054 //chainage dans le sens suivant
00055 elem->nextInSuperList=NULL;
00056 if (_lastOfSuperList!=NULL) {//la liste n'est pas vide
00057 _lastOfSuperList->nextInSuperList=elem;
00058 }
00059 else {
00060 _startOfSuperList=elem;
00061 }
00062 _lastOfSuperList=elem;
00063 return false;
00064 }
|
|
|
add a reference handle to the start of the super list. A call to activate is needed to move the added reference handle to the active list.
Definition at line 30 of file PsnDoubleList.cxx. References _lastOfSuperList, _startOfSuperList, PsnDoubleListElement::nextInSuperList, and PsnDoubleListElement::previousInSuperList.
00030 {
00031 PsnDoubleListElement * elem=new PsnDoubleListElement(M);
00032
00033 //1 Gestion de la liste complète
00034 //chainage dans le sens suivant;
00035 elem->nextInSuperList=_startOfSuperList;
00036 //chainage dans le sens précédent
00037 elem->previousInSuperList=NULL;
00038 if (_startOfSuperList!=NULL) {//la liste n'est pas vide
00039 _startOfSuperList->previousInSuperList=elem;
00040 }
00041 else {
00042 _lastOfSuperList=elem;
00043 }
00044 _startOfSuperList=elem;
00045 return false ;
00046 }
|
|
|
remove an object handle from the super list
Definition at line 117 of file PsnDoubleList.cxx. References _lastOfSuperList, _start, _startOfSuperList, findInSuperList(), PsnDoubleListElement::nextInActiveList, PsnDoubleListElement::nextInSuperList, PsnDoubleListElement::previousInActiveList, and PsnDoubleListElement::previousInSuperList.
00117 {
00118 PsnDoubleListElement * elem=findInSuperList(M);
00119 if(elem!=NULL) {//l'objet n'est pas déjà détruit
00120 if(elem->nextInActiveList!=NULL||elem->previousInActiveList!=NULL||_start==elem) {
00121 //l'objet est encore dans la liste des objets à exécuter : on ne le détruit pas
00122 return true;
00123 }
00124 else {
00125 PsnDoubleListElement * prec=elem->previousInSuperList;
00126 PsnDoubleListElement * suiv=elem->nextInSuperList;
00127 if(prec!=NULL) {
00128 prec->nextInSuperList=suiv;
00129 }
00130 else {//l'élément détruit était en tete
00131 _startOfSuperList=suiv;
00132 }
00133 if(suiv!=NULL) {
00134 suiv->previousInSuperList=prec;
00135 }
00136 else {//l'élement détruit était en queue
00137 _lastOfSuperList=prec;
00138 }
00139 delete elem;
00140 }
00141 }
00142 return false;
00143 }
|
|
|
superListBegin
Definition at line 272 of file PsnDoubleList.cxx. References _startOfSuperList.
00272 {
00273 return _startOfSuperList;
00274 }
|
|
|
get the element following the iterator passed as parameter in the super list
Definition at line 276 of file PsnDoubleList.cxx. References PsnDoubleListElement::nextInSuperList.
00276 {
00277 if(pcour == NULL) {
00278 cerr<<"PsnDoubleList::superListNext WARNING:Suivant de NULL inexistant"<<endl;
00279 return NULL;
00280 }
00281 else {
00282 return pcour->nextInSuperList;
00283 }
00284 }
|
|
|
pour supprimer un module de la liste des modules à compute
Definition at line 221 of file PsnDoubleList.cxx. References _last, _start, find(), PsnDoubleListElement::nextInActiveList, and PsnDoubleListElement::previousInActiveList.
00221 {
00222 PsnDoubleListElement * elem=find(M);
00223 if(elem!=NULL) {//l'objet n'est pas déjà détruit ou est un entité
00224 PsnDoubleListElement * prec=elem->previousInActiveList;
00225 PsnDoubleListElement * suiv=elem->nextInActiveList;
00226 if(prec!=NULL) {
00227 prec->nextInActiveList=suiv;
00228 }
00229 else {//l'élément détruit était en tete
00230 _start=suiv;
00231 };
00232 if(suiv!=NULL) {
00233 suiv->previousInActiveList=prec;
00234 }
00235 else {
00236 _last=prec;
00237 };
00238 //l'élément n'appartient plus à la liste des modules à exécuter
00239 elem->previousInActiveList=NULL;
00240 elem->nextInActiveList=NULL;
00241 return false;
00242 }
00243 else {
00244 return true;
00245 }
00246 }
|
|
|
last element in active list
Definition at line 145 of file PsnDoubleList.h. Referenced by activate(), PsnDoubleList(), and suspend(). |
|
|
last element in super list
Definition at line 137 of file PsnDoubleList.h. Referenced by insert(), PsnDoubleList(), push_back(), push_front(), and remove(). |
|
|
fisrt element in active liste
Definition at line 141 of file PsnDoubleList.h. Referenced by activate(), begin(), find(), PsnDoubleList(), remove(), and suspend(). |
|
|
first element in super list
Definition at line 133 of file PsnDoubleList.h. Referenced by activate(), findInSuperList(), insert(), PsnDoubleList(), push_back(), push_front(), remove(), and superListBegin(). |
| Documentation generated on Mon Nov 25 15:25:59 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |