#ifndef _DEL_H
#define _DEL_H

using namespace std;        

class DelSturct{

public:
     DelSturct(){}

//-----------------------------------------------------------------------------      
//delalokovani STG struktury
void deleteSTG(Stg* stg){
stg->sizeCode = 0;
delete [] stg->initCode;          

for(int i = 0; i < int(stg->place.size()); i++){
if(stg->place[i] == 0) break;
delete stg->place[i];    
stg->place[i] = 0;
}


for(int i = 0;i < int(stg->tran.size()); i++){
if(stg->tran[i] == 0) break;
delete [] stg->tran[i]->indexPlace;
stg->tran[i]->indexPlace = 0;
delete stg->tran[i];
stg->tran[i] = 0;
}

stg->tran.clear();
stg->place.clear();

stg->pocetPlace = 0;           
stg->pocetTran= 0;            
     
delete [] stg->vyP;
stg->pocetVyP = 0;     

stg->nazvy.clear();
stg->nazvyp.clear();

stg->nameFile = "";
delete stg;
stg = 0;
}

//-----------------------------------------------------------------------------      
//delalokovani SG struktury
void deleteSG(SG * sg){

for(int i = 0; i < sg->pocet; i++)   {
delete [] sg->sg[i]->pole;
delete [] sg->sg[i]->code;
delete [] sg->sg[i]->t;
delete [] sg->sg[i]->p;
delete sg->sg[i];
sg->sg[i] = 0;

}

delete sg;
sg = 0;

}

//-----------------------------------------------------------------------------      
//delalokovani region struktury
void deleteRegion(RegStavBuf * rs){

for(int i = 0; i < rs->pocet; i++){

delete [] rs->rs[i].qrm;
delete [] rs->rs[i].qrp;
delete [] rs->rs[i].erp;
delete [] rs->rs[i].erm;

delete [] rs->rs[i].qrms;
delete [] rs->rs[i].qrps;
delete [] rs->rs[i].erps;
delete [] rs->rs[i].erms;

}

delete [] rs;
rs = 0;
}

      
};

#endif








