From d68257270249a128c0bc0854e0d306e98304124d Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sat, 15 Oct 2016 10:06:51 +0000 Subject: [PATCH] =?UTF-8?q?EgtMachKernel=201.6v7=20:=20-=20modifiche=20per?= =?UTF-8?q?=20bloccaggi=20su=20pi=C3=B9=20fasi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Disposition.cpp | 131 ++++++++++++++++------------------ Disposition.h | 4 -- EgtMachKernel.rc | Bin 11782 -> 11782 bytes EgtMachKernel.vcxproj | 1 + EgtMachKernel.vcxproj.filters | 3 + MachConst.h | 2 + MachMgr.h | 6 +- MachMgrFixtures.cpp | 59 +++++++++++++++ MachMgrOperations.cpp | 7 ++ MachMgrPhases.cpp | 14 +++- MachMgrRawParts.cpp | 14 ++-- SetTempPhase.h | 37 ++++++++++ 12 files changed, 198 insertions(+), 80 deletions(-) create mode 100644 SetTempPhase.h diff --git a/Disposition.cpp b/Disposition.cpp index 3535485..e7de983 100644 --- a/Disposition.cpp +++ b/Disposition.cpp @@ -421,22 +421,46 @@ Disposition::AddFixture( const string& sName, const Point3d& ptPos, double dAngD // verifico che la posizione sia nell'area della tavola if ( ! m_b3Area1.EnclosesXY( m_ptRef1 + ptPos)) return GDB_ID_NULL ; - // recupero il gruppo delle fixtures nella macchinata corrente - int nFixtGrpId = m_pMchMgr->GetCurrFixtGroupId() ; - if ( nFixtGrpId == GDB_ID_NULL) - return GDB_ID_NULL ; - // verifico esistenza file sottopezzo - string sFixtFile = m_pMchMgr->GetCurrFixtDir() + "\\" + sName + ".Nge" ; - if ( ! ExistsFile( sFixtFile)) - return GDB_ID_NULL ; - // inserisco il sottopezzo nel gruppo - if ( ! m_pGeomDB->Load( sFixtFile, nFixtGrpId)) - return GDB_ID_NULL ; - int nFixtId = m_pGeomDB->GetLastGroupInGroup( nFixtGrpId) ; - if ( nFixtId == GDB_ID_NULL) - return GDB_ID_NULL ; - // imposto il livello a temporaneo - m_pGeomDB->SetLevel( nFixtId, GDB_LV_TEMP) ; + // Nome tutto maiuscolo + string sMyName = sName ; + ToUpper( sMyName) ; + // Se recuperabile dal gruppo dei bloccaggi + int nFixtId = m_pMchMgr->GetUnusedFixture( sMyName, m_nPhase) ; + if ( nFixtId != GDB_ID_NULL) { + // aggiungo la fase al bloccaggio + INTVECTOR vPhase ; + m_pMchMgr->GetFixturePhases( nFixtId, vPhase) ; + vPhase.push_back( m_nPhase) ; + m_pGeomDB->SetInfo( nFixtId, MACH_FXT_PHASE, vPhase) ; + // aggiorno visualizzazione + m_pGeomDB->SetStatus( nFixtId, GDB_ST_ON) ; + } + // altrimenti lo carico da file + else { + // recupero il gruppo delle fixtures nella macchinata corrente + int nFixtGrpId = m_pMchMgr->GetCurrFixtGroupId() ; + if ( nFixtGrpId == GDB_ID_NULL) + return GDB_ID_NULL ; + // verifico esistenza file sottopezzo + string sFixtFile = m_pMchMgr->GetCurrFixtDir() + "\\" + sName + ".Nge" ; + if ( ! ExistsFile( sFixtFile)) + return GDB_ID_NULL ; + // inserisco il sottopezzo nel gruppo + if ( ! m_pGeomDB->Load( sFixtFile, nFixtGrpId)) + return GDB_ID_NULL ; + nFixtId = m_pGeomDB->GetLastGroupInGroup( nFixtGrpId) ; + if ( nFixtId == GDB_ID_NULL) + return GDB_ID_NULL ; + // assegno il nome + m_pGeomDB->SetName( nFixtId, sMyName) ; + // imposto il livello a temporaneo + m_pGeomDB->SetLevel( nFixtId, GDB_LV_TEMP) ; + // aggiungo la fase al bloccaggio + m_pGeomDB->SetInfo( nFixtId, MACH_FXT_PHASE, m_nPhase) ; + } + // resetto il riferimento del gruppo + Frame3d* pfrFixt = m_pGeomDB->GetGroupFrame( nFixtId) ; + pfrFixt->Reset() ; // la muovo nella posizione voluta Vector3d vtMove = ( m_ptRef1 + ptPos) - ORIG ; m_pGeomDB->TranslateGlob( nFixtId, vtMove) ; @@ -469,7 +493,7 @@ Disposition::GetFirstFixture( void) // recupero il primo int nId = m_vFixData.front().nId ; // ne verifico la validità - if ( ! VerifyFixture( nId)) + if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyFixture( nId, false)) return GDB_ID_NULL ; return nId ; } @@ -478,9 +502,6 @@ Disposition::GetFirstFixture( void) int Disposition::GetNextFixture( int nId) { - // verifica validità bloccaggio - if ( ! VerifyFixture( nId)) - return GDB_ID_NULL ; // ciclo sui bloccaggi int nFxtTot = int( m_vFixData.size()) ; for ( int i = 0 ; i < nFxtTot ; ++ i) { @@ -488,7 +509,8 @@ Disposition::GetNextFixture( int nId) if ( m_vFixData[i].nId == nId) { // se esiste successivo e valido int j = i + 1 ; - if ( j < nFxtTot && VerifyFixture( m_vFixData[j].nId)) + if ( j < nFxtTot && + m_pMchMgr != nullptr && m_pMchMgr->VerifyFixture( m_vFixData[j].nId, false)) return m_vFixData[j].nId ; else return GDB_ID_NULL ; @@ -502,7 +524,7 @@ bool Disposition::MoveFixture( int nId, const Vector3d& vtMove) { // verifica validità sottopezzo - if ( ! VerifyFixture( nId)) + if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyFixture( nId, false)) return false ; // verifico aggiornamento tavola if ( ! m_bTabOk && ! SetTable( m_sTabName)) @@ -529,7 +551,7 @@ bool Disposition::RotateFixture( int nId, double dDeltaAngDeg) { // verifica validità sottopezzo - if ( ! VerifyFixture( nId)) + if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyFixture( nId, false)) return false ; // verifico aggiornamento tavola if ( ! m_bTabOk && ! SetTable( m_sTabName)) @@ -551,7 +573,7 @@ bool Disposition::MoveFixtureMobile( int nId, double dDeltaMov) { // verifica validità sottopezzo - if ( ! VerifyFixture( nId)) + if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyFixture( nId, false)) return false ; // verifico aggiornamento tavola if ( ! m_bTabOk && ! SetTable( m_sTabName)) @@ -581,7 +603,7 @@ bool Disposition::PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double dMov) { // verifica validità sottopezzo - if ( ! VerifyFixture( nId)) + if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyFixture( nId, false)) return false ; // verifico aggiornamento tavola if ( ! m_bTabOk && ! SetTable( m_sTabName)) @@ -627,13 +649,20 @@ bool Disposition::RemoveFixture( int nId) { // verifica validità sottopezzo - if ( ! VerifyFixture( nId)) + if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyFixture( nId, false)) return false ; // verifico aggiornamento tavola if ( ! m_bTabOk && ! SetTable( m_sTabName)) return false ; - // rimuovo l'oggetto dal DB - m_pGeomDB->Erase( nId) ; + // dichiaro l'oggetto non più usato dalla fase + INTVECTOR vPhase ; + if ( ! m_pMchMgr->GetFixturePhases( nId, vPhase)) + return false ; + auto iIter = find( vPhase.begin(), vPhase.end(), m_nPhase) ; + if ( iIter != vPhase.end()) { + vPhase.erase( iIter) ; + m_pGeomDB->SetInfo( nId, MACH_FXT_PHASE, vPhase) ; + } // rimuovo l'oggetto dal vettore dei comandi while ( true) { auto iIter = find_if( m_vFixData.begin(), m_vFixData.end(), @@ -652,7 +681,7 @@ bool Disposition::MoveToCornerRawPart( int nRawId, const Point3d& ptP, int nFlag, bool bAddToList) { // verifica validità grezzo - if ( ! VerifyRawPart( nRawId)) + if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyRawPart( nRawId, false)) return false ; // recupero il solido int nRawSolId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ; @@ -708,7 +737,7 @@ bool Disposition::MoveToCenterRawPart( int nRawId, const Point3d& ptP, int nFlag, bool bAddToList) { // verifica validità grezzo - if ( ! VerifyRawPart( nRawId)) + if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyRawPart( nRawId, false)) return false ; // recupero il solido int nRawSolId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ; @@ -764,7 +793,7 @@ bool Disposition::MoveRawPart( int nRawId, const Vector3d& vtMove) { // verifica validità grezzo - if ( ! VerifyRawPart( nRawId)) + if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyRawPart( nRawId, false)) return false ; // se movimento nullo, non devo fare alcunché if ( vtMove.IsSmall()) @@ -803,7 +832,7 @@ bool Disposition::RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg) { // verifica validità grezzo - if ( ! VerifyRawPart( nRawId)) + if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyRawPart( nRawId, false)) return false ; // recupero centro del grezzo Point3d ptAx ; @@ -834,7 +863,7 @@ bool Disposition::ApplyRotationToRawPart( int nRawId, double dAngCDeg, double dAngADeg, double dAngC1Deg) { // verifica validità grezzo - if ( ! VerifyRawPart( nRawId)) + if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyRawPart( nRawId, false)) return false ; // recupero centro del grezzo Point3d ptCen ; @@ -859,7 +888,7 @@ bool Disposition::RemoveRawPart( int nRawId) { // verifica validità grezzo - if ( ! VerifyRawPart( nRawId)) + if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyRawPart( nRawId, false)) return false ; // elimino i movimenti registrati per questo grezzo while ( true) { @@ -874,40 +903,6 @@ Disposition::RemoveRawPart( int nRawId) return true ; } -//---------------------------------------------------------------------------- -bool -Disposition::VerifyFixture( int nFixtId) const -{ - // verifico MachMgr e GeomDB - if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) - return false ; - // recupero il gruppo delle fixtures nella macchinata corrente - int nFixtGrpId = m_pMchMgr->GetCurrFixtGroupId() ; - if ( nFixtGrpId == GDB_ID_NULL) - return false ; - // verifico che l'oggetto appartenga al gruppo delle fixtures - if ( m_pGeomDB->GetParentId( nFixtId) != nFixtGrpId) - return false ; - return true ; -} - -//---------------------------------------------------------------------------- -bool -Disposition::VerifyRawPart( int nRawId) const -{ - // verifico MachMgr e GeomDB - if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) - return false ; - // recupero il gruppo dei grezzi nella macchinata corrente - int nRawGroupId = m_pMchMgr->GetCurrRawGroupId() ; - if ( nRawGroupId == GDB_ID_NULL) - return false ; - // verifico che questo grezzo ne faccia parte - if ( m_pGeomDB->GetParentId( nRawId) != nRawGroupId) - return false ; - return true ; -} - //---------------------------------------------------------------------------- bool Disposition::GetFixtureData( int nInd, string& sName, int& nId, Point3d& ptPos, double& dAngDeg) const diff --git a/Disposition.h b/Disposition.h index 41b1b66..b0b95cd 100644 --- a/Disposition.h +++ b/Disposition.h @@ -105,10 +105,6 @@ class Disposition : public Operation bool GetSomeByHand( void) const { return m_bSomeByHand ; } - private : - bool VerifyFixture( int nFixtId) const ; - bool VerifyRawPart( int nRawId) const ; - private : bool m_bTabOk ; // flag di tavola verificata std::string m_sTabName ; // nome della tavola di appartenenza diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 2a431c97ea873929e2df0789947be96711ca2da3..87cf5df3ae64a4e3b72514db630df37f3aa3cd78 100644 GIT binary patch delta 97 zcmZpRX^YwLhmFyE^ItYwW=8YLj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHRjnXm delta 97 zcmZpRX^YwLhmFx}^ItYwW=6Bgj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHR2d*z diff --git a/EgtMachKernel.vcxproj b/EgtMachKernel.vcxproj index e57605c..9071318 100644 --- a/EgtMachKernel.vcxproj +++ b/EgtMachKernel.vcxproj @@ -301,6 +301,7 @@ copy $(TargetPath) \EgtProg\Dll64 + diff --git a/EgtMachKernel.vcxproj.filters b/EgtMachKernel.vcxproj.filters index 6778b75..2758543 100644 --- a/EgtMachKernel.vcxproj.filters +++ b/EgtMachKernel.vcxproj.filters @@ -302,6 +302,9 @@ Header Files + + Header Files + diff --git a/MachConst.h b/MachConst.h index 08b928d..fac7e31 100644 --- a/MachConst.h +++ b/MachConst.h @@ -33,6 +33,8 @@ const std::string MACH_SETUP_GROUP = "Setup" ; const std::string MACH_RAW_GROUP = "Raws" ; // Gruppo delle operazioni in una macchinata const std::string MACH_OPER_GROUP = "Opers" ; +// Chiave per info fase di appartenenza di una fixture +const std::string MACH_FXT_PHASE = "Ph" ; // Nome del grezzo const std::string MACH_RAW_PART = "RawPart" ; // Chiave per info fase di appartenenza del grezzo diff --git a/MachMgr.h b/MachMgr.h index 28a793a..abf1cc3 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -304,8 +304,13 @@ class MachMgr : public IMachMgr int GetCurrOperId( void) const { return ( ExistsCurrMachGroup() ? m_cCurrMGrp.OperGroupId : GDB_ID_NULL) ; } // RawParts + bool VerifyRawPart( int nRawId, bool bLinkedAllowed = true) const ; bool GetRawPartPhases( int nRawId, INTVECTOR& vPhase) const ; bool GetRawPartCenter( int nRawId, Point3d& ptCen) ; + // Tables and Fixtures + bool VerifyFixture( int nFxtId, bool bLinkedAllowed = true) const ; + bool GetFixturePhases( int nFxtId, INTVECTOR& vPhase) const ; + int GetUnusedFixture( const string& sName, int nPhase) ; // Machines Machine* GetCurrMachine( void) const ; ToolsMgr* GetCurrToolsMgr( void) const ; @@ -348,7 +353,6 @@ class MachMgr : public IMachMgr // RawParts int AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) ; int AddRawPart( int nSurfId, Color cCol) ; - bool VerifyRawPart( int nRawId) const ; bool SetRawPartCenter( int nRawId) ; bool ResetRawPartCenter( int nRawId) ; // Parts diff --git a/MachMgrFixtures.cpp b/MachMgrFixtures.cpp index 40e27d0..94e91d0 100644 --- a/MachMgrFixtures.cpp +++ b/MachMgrFixtures.cpp @@ -91,6 +91,65 @@ MachMgr::ShowOnlyTable( bool bVal) return pMch->SetLook( bVal ? MCH_LOOK_TAB : MCH_LOOK_ALL) ; } +//---------------------------------------------------------------------------- +bool +MachMgr::VerifyFixture( int nFxtId, bool bLinkedAllowed) const +{ + // se il bloccaggio fa parte del gruppo dei bloccaggi, va bene + int nFxtGroupId = GetCurrFixtGroupId() ; + if ( nFxtGroupId != GDB_ID_NULL && m_pGeomDB->GetParentId( nFxtId) == nFxtGroupId) + return true ; + // se consentito linkaggio ed il bloccaggio è linkato ad un gruppo della macchina corrente, va bene + if ( bLinkedAllowed) { + Machine* pMch = GetCurrMachine() ; + if ( pMch != nullptr && pMch->IsLinkedFixture( nFxtId)) + return true ; + } + // altrimenti errore + return false ; +} + +//---------------------------------------------------------------------------- +bool +MachMgr::GetFixturePhases( int nFxtId, INTVECTOR& vPhase) const +{ + // pulisco parametro di ritorno + vPhase.clear() ; + // verifica validità bloccaggio + if ( ! VerifyFixture( nFxtId)) + return false ; + // recupero le fasi in cui è presente la fixture (se manca è fase 1) + if ( ! m_pGeomDB->GetInfo( nFxtId, MACH_FXT_PHASE, vPhase) || vPhase.empty()) + vPhase.emplace_back( 1) ; + return true ; +} + +//---------------------------------------------------------------------------- +int +MachMgr::GetUnusedFixture( const string& sName, int nPhase) +{ + // Verifico validità nome + if ( IsEmptyOrSpaces( sName)) + return false ; + // Recupero il gruppo dei bloccaggi + int nFxtGroupId = GetCurrFixtGroupId() ; + // Cerco i bloccaggi non usati nella fase indicata + int nId = m_pGeomDB->GetFirstNameInGroup( nFxtGroupId, sName) ; + while ( nId != GDB_ID_NULL) { + // recupero le fasi in cui è già usato + INTVECTOR vPhase ; + if ( ! m_pGeomDB->GetInfo( nId, MACH_FXT_PHASE, vPhase) || vPhase.empty()) + vPhase.emplace_back( 1) ; + // se non c'è la fase corrente, è libero + if ( find( vPhase.begin(), vPhase.end(), nPhase) == vPhase.end()) + return nId ; + // passo al successivo + nId = m_pGeomDB->GetNextName( nId, sName) ; + } + // non trovato + return GDB_ID_NULL ; +} + //---------------------------------------------------------------------------- int MachMgr::AddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov) diff --git a/MachMgrOperations.cpp b/MachMgrOperations.cpp index c101924..89d2420 100644 --- a/MachMgrOperations.cpp +++ b/MachMgrOperations.cpp @@ -18,6 +18,7 @@ #include "MachConst.h" #include "Disposition.h" #include "MachiningCreate.h" +#include "SetTempPhase.h" #include "/EgtDev/Include/EMkOperationConst.h" #include "/EgtDev/Include/EGkUserObjFactory.h" #include "/EgtDev/Include/EGkGdbIterator.h" @@ -797,6 +798,8 @@ MachMgr::SetMachiningGeometry( const SELVECTOR& vIds) Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ; if ( pMch == nullptr) return false ; + // imposto fase della lavorazione come temporaneamente corrente + SetTempPhase TmpPhase( this, pMch->GetPhase()) ; // imposto la geometria return pMch->SetGeometry( vIds) ; } @@ -813,6 +816,8 @@ MachMgr::MachiningPreview( bool bRecalc) Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ; if ( pMch == nullptr) return false ; + // imposto fase della lavorazione come temporaneamente corrente + SetTempPhase TmpPhase( this, pMch->GetPhase()) ; // calcolo l'anteprima della lavorazione return pMch->Preview( bRecalc) ; } @@ -859,6 +864,8 @@ MachMgr::MachiningApply( bool bRecalc) Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ; if ( pMch == nullptr) return false ; + // imposto fase della lavorazione come temporaneamente corrente + SetTempPhase TmpPhase( this, pMch->GetPhase()) ; // calcolo la lavorazione return pMch->Apply( bRecalc) ; } diff --git a/MachMgrPhases.cpp b/MachMgrPhases.cpp index bcbcb93..5d38bbc 100644 --- a/MachMgrPhases.cpp +++ b/MachMgrPhases.cpp @@ -213,8 +213,20 @@ MachMgr::RemoveLastPhase( void) } // elimino la disposizione di fase int nDispId = GetLastOperation() ; - if ( GetOperationType( nDispId) == OPER_DISP && GetOperationPhase( nDispId) == m_nPhasesCount) + if ( GetOperationType( nDispId) == OPER_DISP && GetOperationPhase( nDispId) == m_nPhasesCount) { + // elimino i bloccaggi della fase + Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nDispId)) ; + if ( pDisp != nullptr) { + int nFxtId = pDisp->GetFirstFixture() ; + while ( nFxtId != GDB_ID_NULL) { + if ( ! pDisp->RemoveFixture( nFxtId)) + break ; + nFxtId = pDisp->GetFirstFixture() ; + } + } + // eliminazione dell'operazione m_pGeomDB->Erase( nDispId) ; + } // se era corrente, rendo corrente la precedente if ( m_nCurrPhase == m_nPhasesCount) SetCurrPhase( m_nCurrPhase - 1) ; diff --git a/MachMgrRawParts.cpp b/MachMgrRawParts.cpp index ef59fe4..8d0a4d7 100644 --- a/MachMgrRawParts.cpp +++ b/MachMgrRawParts.cpp @@ -573,7 +573,7 @@ MachMgr::RemoveRawPartFromCurrPhase( int nRawId) if ( ! GetRawPartPhases( nRawId, vPhase)) return false ; // se non appartiene alla fase corrente, non devo fare alcunché - auto iIter = find( vPhase.begin(), vPhase.end(), m_nPhasesCount) ; + auto iIter = find( vPhase.begin(), vPhase.end(), m_nCurrPhase) ; if ( iIter == vPhase.end()) return true ; // se appartiene solo a questa fase, lo elimino @@ -617,16 +617,18 @@ MachMgr::RemoveRawPart( int nRawId) //---------------------------------------------------------------------------- bool -MachMgr::VerifyRawPart( int nRawId) const +MachMgr::VerifyRawPart( int nRawId, bool bLinkedAllowed) const { // se il grezzo fa parte del gruppo dei grezzi, va bene int nRawGroupId = GetCurrRawGroupId() ; if ( nRawGroupId != GDB_ID_NULL && m_pGeomDB->GetParentId( nRawId) == nRawGroupId) return true ; - // se il grezzo è linkato ad un gruppo della macchina corrente, va bene - Machine* pMch = GetCurrMachine() ; - if ( pMch != nullptr && pMch->IsLinkedRawPart( nRawId)) - return true ; + // se consentito linkaggio ed il grezzo è linkato ad un gruppo della macchina corrente, va bene + if ( bLinkedAllowed) { + Machine* pMch = GetCurrMachine() ; + if ( pMch != nullptr && pMch->IsLinkedRawPart( nRawId)) + return true ; + } // altrimenti errore return false ; } diff --git a/SetTempPhase.h b/SetTempPhase.h new file mode 100644 index 0000000..02a5608 --- /dev/null +++ b/SetTempPhase.h @@ -0,0 +1,37 @@ +//---------------------------------------------------------------------------- +// EgalTech 2016-2016 +//---------------------------------------------------------------------------- +// File : SetTempPhase.h Data : 14.10.16 Versione : 1.6v7 +// Contenuto : Dichiarazione classe per impostazione temporanea +// della fase corrente. +// +// +// Modifiche : 14.10.16 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "MachMgr.h" + +//---------------------------------------------------------------------------- +class SetTempPhase +{ + public : + SetTempPhase( MachMgr* pMachMgr, int nPhase) + { m_pMachMgr = pMachMgr ; + if ( m_pMachMgr != nullptr) { + m_nPrevPhase = m_pMachMgr->GetCurrPhase() ; + m_pMachMgr->SetCurrPhase( nPhase) ; + } } + ~SetTempPhase( void) + { Reset() ; } + void Reset( void) + { if ( m_pMachMgr != nullptr) + m_pMachMgr->SetCurrPhase( m_nPrevPhase) ; } + + private : + int m_nPrevPhase ; + MachMgr* m_pMachMgr ; +} ;