| 713 | } |
| 714 | |
| 715 | int cComponentManager::ciFinaliseComps(int _dm, int *_n) |
| 716 | { |
| 717 | #ifdef DEBUG |
| 718 | if (_dm == 0) { |
| 719 | SMILE_DBG(2,"==> createInstances: FINALISE PHASE (components) <=="); |
| 720 | } else { |
| 721 | SMILE_DBG(2,"==> createInstances: FINALISE PHASE (dataMemories) <=="); |
| 722 | } |
| 723 | SMILE_DBG(2," %i instances in total (max. %i iterations)", nComponents, MAX_FIN_ITER ); |
| 724 | #endif |
| 725 | |
| 726 | int it,i; |
| 727 | int nDone = 0; |
| 728 | int nDef = 0; |
| 729 | int nIgn = 0; |
| 730 | |
| 731 | //for (it=0; it<MAX_FIN_ITER; it++) { |
| 732 | for (it=0; it<(nComponents-1); it++) { // was: it < MAX_FIN_ITER , however we need to use nComponents - 1 !! |
| 733 | nDone = 0; |
| 734 | nDef = 0; |
| 735 | nIgn = 0; |
| 736 | |
| 737 | // finalise components |
| 738 | for (i=0; i<lastComponent; i++) { |
| 739 | if (component[i]!=NULL) { |
| 740 | if (compIsDm(component[i]->getTypeName()) == _dm) { |
| 741 | |
| 742 | if (component[i]->finaliseInstance()) { |
| 743 | nDone++; |
| 744 | SMILE_MSG(3,"finalised component instance '%s' (type '%s'), index %i",component[i]->getInstName(),component[i]->getTypeName(),i); |
| 745 | } else { |
| 746 | nDef++; |
| 747 | SMILE_DBG(3,"component instance '%s' (type '%s'), index %i, could not be finalised",component[i]->getInstName(),component[i]->getTypeName(),i); |
| 748 | } |
| 749 | |
| 750 | if ( (_dm)&&(printLevelStats) ) { |
| 751 | ((cDataMemory *)component[i])->printDmLevelStats(printLevelStats); |
| 752 | } |
| 753 | } else { |
| 754 | nIgn++; |
| 755 | } |
| 756 | } |
| 757 | } |
| 758 | |
| 759 | if (nDef == 0) { |
| 760 | if (_dm == 0) { |
| 761 | SMILE_MSG(3,"successfully finalised %i of %i component instances (non dataMemory type)", nDone, nComponents-nIgn ); |
| 762 | } else { |
| 763 | SMILE_MSG(3,"successfully finalised %i of %i dataMemory instances", nDone, nComponents-nIgn ); |
| 764 | } |
| 765 | break; // else: continue configuration process for MAX_FIN_ITER |
| 766 | } else { |
| 767 | SMILE_DBG(2,"need to re-finalise %i components after iteration %i",nDef,it); |
| 768 | } |
| 769 | } |
| 770 | |
| 771 | if (_n != NULL) *_n = nDone; |
| 772 | return (nDef); |
nothing calls this directly
no test coverage detected