diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index cd73529..e717526 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/EgtMachKernel.vcxproj b/EgtMachKernel.vcxproj index 1fc963d..97ecd7e 100644 --- a/EgtMachKernel.vcxproj +++ b/EgtMachKernel.vcxproj @@ -105,7 +105,7 @@ false Use CompileAsCpp - stdcpp17 + stdcpp20 true @@ -132,7 +132,7 @@ copy $(TargetPath) \EgtProg\DllD32 true Use CompileAsCpp - stdcpp17 + stdcpp20 -Wno-tautological-undefined-compare @@ -167,7 +167,7 @@ copy $(TargetPath) \EgtProg\DllD64 true true false - stdcpp17 + stdcpp20 false @@ -202,7 +202,7 @@ copy $(TargetPath) \EgtProg\Dll32 false true false - stdcpp17 + stdcpp20 -Wno-tautological-undefined-compare diff --git a/Machine.cpp b/Machine.cpp index 84a8f28..ac0c035 100644 --- a/Machine.cpp +++ b/Machine.cpp @@ -34,6 +34,7 @@ Machine::Machine( void) { m_pMchMgr = nullptr ; m_pGeomDB = nullptr ; + m_nContextId = 0 ; m_nGroupId = GDB_ID_NULL ; m_nTempGroupId = GDB_ID_NULL ; m_dAxisMaxAdjust = EPS_SMALL ; @@ -90,6 +91,7 @@ Machine::Clear( void) // reset membri m_pMchMgr = nullptr ; m_pGeomDB = nullptr ; + m_nContextId = 0 ; m_sName.clear() ; m_sMachineDir.clear() ; m_nGroupId = GDB_ID_NULL ; @@ -109,6 +111,7 @@ Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* p return false ; m_pMchMgr = pMchMgr ; m_pGeomDB = m_pMchMgr->GetGeomDB() ; + m_nContextId = m_pMchMgr->GetContextId() ; // verifico direttorio dati macchina m_sMachineDir = sMachineDir ; if ( ! ExistsDirectory( m_sMachineDir)) diff --git a/Machine.h b/Machine.h index a233441..90a0b74 100644 --- a/Machine.h +++ b/Machine.h @@ -295,6 +295,7 @@ class Machine // generali MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni IGeomDB* m_pGeomDB ; // puntatore al DB geometrico + int m_nContextId ; // indice contesto corrente (1-based) LuaMgr m_LuaMgr ; // interprete lua della macchina Writer m_Writer ; // scrittore di file di testo // dati macchina @@ -415,15 +416,15 @@ Machine::LuaSetGlobVar( const std::string& sVar, const T& Val) { // imposto contesto corretto int nOldCtx = ExeGetCurrentContext() ; - if ( nOldCtx != m_pMchMgr->GetContextId()) - ExeSetCurrentContext( m_pMchMgr->GetContextId()) ; + if ( nOldCtx != m_nContextId) + ExeSetCurrentContext( m_nContextId) ; // imposto l'oggetto corrente per Lua Machine* pOldMchLua = m_pMchLua ; m_pMchLua = this ; // eseguo l'assegnamento bool bOk = ::LuaSetGlobVar( m_LuaMgr.GetLuaState(), sVar, Val) ; // ripristino contesto originale - if ( nOldCtx != m_pMchMgr->GetContextId()) + if ( nOldCtx != m_nContextId) ExeSetCurrentContext( nOldCtx) ; // ripristino dell'oggetto corrente per Lua m_pMchLua = pOldMchLua ; @@ -437,15 +438,15 @@ Machine::LuaGetGlobVar( const std::string& sVar, T& Val) { // imposto contesto corretto int nOldCtx = ExeGetCurrentContext() ; - if ( nOldCtx != m_pMchMgr->GetContextId()) - ExeSetCurrentContext( m_pMchMgr->GetContextId()) ; + if ( nOldCtx != m_nContextId) + ExeSetCurrentContext( m_nContextId) ; // imposto l'oggetto corrente per Lua Machine* pOldMchLua = m_pMchLua ; m_pMchLua = this ; // eseguo la lettura bool bOk = ::LuaGetGlobVar( m_LuaMgr.GetLuaState(), sVar, Val) ; // ripristino contesto originale - if ( nOldCtx != m_pMchMgr->GetContextId()) + if ( nOldCtx != m_nContextId) ExeSetCurrentContext( nOldCtx) ; // ripristino dell'oggetto corrente per Lua m_pMchLua = pOldMchLua ; diff --git a/MachiningDataFactory.h b/MachiningDataFactory.h index 58f3cb4..f44ae21 100644 --- a/MachiningDataFactory.h +++ b/MachiningDataFactory.h @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2015 +// EgalTech 2015-2025 //---------------------------------------------------------------------------- -// File : MachiningDataFactory.h Data : 05.06.15 Versione : 1.6f1 +// File : MachiningDataFactory.h Data : 31.10.25 Versione : 2.7k1 // Contenuto : Factory della classe MachiningData. // // @@ -26,35 +26,6 @@ #define MCHDATA_CREATE( nType) MachiningDataFactory::Create( nType) #define MCHDATA_GETLIST( vsList) MachiningDataFactory::GetList( vsList) -//---------------------------------------------------------------------------- -template -class MachiningDataRegister -{ - public : - static bool DoRegister( int nType, const std::string& sName) - { if ( ! MachiningDataFactory::Register( nType, sName, Create)) - return false ; - GetTypePrivate() = nType ; - GetNamePrivate() = sName ; - return true ; } - static MachiningData* Create( void) - { return new(nothrow) T ; } - static int GetType( void) - { return GetTypePrivate() ; } - static const std::string& GetName( void) - { return GetNamePrivate() ; } - - private : - MachiningDataRegister( void) {} - ~MachiningDataRegister( void) {} - static int& GetTypePrivate( void) - { static int s_nType ; - return s_nType ; } - static std::string& GetNamePrivate( void) - { static std::string s_sName ; - return s_sName ; } -} ; - //---------------------------------------------------------------------------- class MachiningDataFactory { @@ -108,3 +79,32 @@ class MachiningDataFactory return s_CreatorMap ; } } ; + +//---------------------------------------------------------------------------- +template +class MachiningDataRegister +{ + public : + static bool DoRegister( int nType, const std::string& sName) + { if ( ! MachiningDataFactory::Register( nType, sName, Create)) + return false ; + GetTypePrivate() = nType ; + GetNamePrivate() = sName ; + return true ; } + static MachiningData* Create( void) + { return new( std::nothrow) T ; } + static int GetType( void) + { return GetTypePrivate() ; } + static const std::string& GetName( void) + { return GetNamePrivate() ; } + + private : + MachiningDataRegister( void) {} + ~MachiningDataRegister( void) {} + static int& GetTypePrivate( void) + { static int s_nType ; + return s_nType ; } + static std::string& GetNamePrivate( void) + { static std::string s_sName ; + return s_sName ; } +} ;