diff --git a/Hazard/Hazard/Hazard.cpp b/Hazard/Hazard/Hazard.cpp index 69af299..5d84d3d 100644 --- a/Hazard/Hazard/Hazard.cpp +++ b/Hazard/Hazard/Hazard.cpp @@ -1,4 +1,4 @@ -// Hazard.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung. +// Hazard.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung. // #include "stdafx.h" @@ -97,9 +97,9 @@ int _tmain(int argc, _TCHAR* argv[]) // find hazards if (numOnes > numElements / 2) // we have more 1 than 0 --> checkerboard --> 50% of cells are checked { + cout << "\nSchachbrettmuster\n"; for (uint i = 0; i < numElements; i++) { - cout << "\nSchachbrettmuster\n"; uint grayI = i ^ (i/2); // transform to gray code vector hazardousNeighbors = cells[grayI]->GetHazards(); @@ -115,9 +115,9 @@ int _tmain(int argc, _TCHAR* argv[]) } else // less 1 than 0 --> only check every 1 --> less than 50% (numOnes/numElements) of cells are checked { + cout << "\nÃœberspringe Nullen\n"; for (uint i = 0; i < numElements; i++) { - cout << "\nÜberspringe Nullen\n"; if (!cells[i]->value) continue; vector hazardousNeighbors = cells[i]->GetHazards(); @@ -133,5 +133,7 @@ int _tmain(int argc, _TCHAR* argv[]) } } system("pause"); + + globalPIC->Dispose(); return 0; } \ No newline at end of file diff --git a/Hazard/Hazard/PrimImplikantCollection.cpp b/Hazard/Hazard/PrimImplikantCollection.cpp index c1d3e4d..911c607 100644 --- a/Hazard/Hazard/PrimImplikantCollection.cpp +++ b/Hazard/Hazard/PrimImplikantCollection.cpp @@ -68,4 +68,11 @@ PrimImplikant* PrimImplikantCollection::operator[](uint &index){ return this->PIVector.at(index); return 0; +} + + +void PrimImplikantCollection::Dispose() +{ + for (uint i = 0; i < this->size(); i++) + delete this->at(i); } \ No newline at end of file diff --git a/Hazard/Hazard/PrimImplikantCollection.h b/Hazard/Hazard/PrimImplikantCollection.h index b1f9733..77a5dd4 100644 --- a/Hazard/Hazard/PrimImplikantCollection.h +++ b/Hazard/Hazard/PrimImplikantCollection.h @@ -18,17 +18,13 @@ public: bool valueAt(uint position); PrimImplikantCollection primImplikantenAt(uint position); + void Dispose(); + uint size(); PrimImplikant* back(); PrimImplikant* front(); PrimImplikant* at(uint &index); PrimImplikant* operator[](uint &index); - - ~PrimImplikantCollection() // destructor - { - for (uint i = 0; i < this->size(); i++) - delete this->at(i); - } private: vector PIVector; };