1.CGlassPool实现;
2.CGlass翻译逻辑优化;
3.在Glass列表页,Glass项的显示,增加显示贴合的Glass的id
| | |
| | | |
| | | int CArm::tempStore(CGlass* pGlass) |
| | | { |
| | | // ä¿è¯å表ä¸åªåå¨ä¸ä¸ªç©æ |
| | | // åï¼ä¿è¯å表ä¸åªåå¨ä¸ä¸ªç©æ |
| | | // ä¿®æ¹ä¸ºï¼å
æ¸
空ä¹åçï¼åæ·»å å½åpGlass, 妿pGlassæbuddyï¼ä¹è¦å å
¥åè¡¨ä¸ |
| | | Lock(); |
| | | for (auto item : m_glassList) { |
| | | item->release(); |
| | | } |
| | | m_glassList.clear(); |
| | | addGlassToList(pGlass); |
| | | if (pGlass->getBuddy() != nullptr) { |
| | | addGlassToList(pGlass->getBuddy()); |
| | | } |
| | | Unlock(); |
| | | |
| | | if (m_listener.onDataChanged != nullptr) { |
| | |
| | | #include "stdafx.h" |
| | | #include "Servo.h" |
| | | #include "CDoubleGlass.h" |
| | | #include "CGlassPool.h" |
| | | |
| | | |
| | | namespace SERVO { |
| | |
| | | ULONGLONG ulGlass1; |
| | | ar >> ulGlass1; |
| | | if (ulGlass1 != 0) { |
| | | m_pGlass1 = new CGlass(); |
| | | m_pGlass1 = theApp.m_model.m_glassPool.allocaGlass(); |
| | | m_pGlass1->serialize(ar); |
| | | } |
| | | if (ulGlass1 != 0) { |
| | | m_pGlass2 = new CGlass(); |
| | | m_pGlass2 = theApp.m_model.m_glassPool.allocaGlass(); |
| | | m_pGlass2->serialize(ar); |
| | | } |
| | | |
| | |
| | | #include "ToolUnits.h" |
| | | #include <regex> |
| | | #include "CArm.h" |
| | | #include "CGlassPool.h" |
| | | #include "Servo.h" |
| | | |
| | | |
| | | #define CHECK_READ_STEP_SIGNAL(addr, data, size) { \ |
| | |
| | | int count; |
| | | ar >> count; |
| | | for (int i = 0; i < count; i++) { |
| | | CGlass* pGlass = new CGlass(); |
| | | CGlass* pGlass = theApp.m_model.m_glassPool.allocaGlass(); |
| | | pGlass->serialize(ar); |
| | | addGlassToList(pGlass); |
| | | } |
| | |
| | | ListView_SetImageList(m_listCtrl.GetSafeHwnd(), imageList, LVSIL_SMALL); |
| | | m_listCtrl.InsertColumn(0, _T(""), LVCFMT_RIGHT, width[0]); |
| | | m_listCtrl.InsertColumn(1, _T("ID"), LVCFMT_LEFT, width[1]); |
| | | m_listCtrl.InsertColumn(2, _T("æ¶é´"), LVCFMT_LEFT, width[2]); |
| | | m_listCtrl.SetColumnWidth(2, LVSCW_AUTOSIZE_USEHEADER); |
| | | m_listCtrl.InsertColumn(2, _T("è´´å"), LVCFMT_LEFT, width[2]); |
| | | m_listCtrl.InsertColumn(3, _T("æ¶é´"), LVCFMT_LEFT, width[3]); |
| | | m_listCtrl.SetColumnWidth(3, LVSCW_AUTOSIZE_USEHEADER); |
| | | |
| | | |
| | | ASSERT(m_pEquipment); |
| | |
| | | for (auto item : list) { |
| | | item->addRef(); |
| | | item->release(); // éæ¾listä¸çå¼ç¨ |
| | | |
| | | SERVO::CGlass* pBuddy = item->getBuddy(); |
| | | int index = m_listCtrl.InsertItem(m_listCtrl.GetItemCount(), _T("")); |
| | | m_listCtrl.SetItemData(index, (DWORD_PTR)item); |
| | | m_listCtrl.SetItemText(index, 1, item->getID().c_str()); |
| | | |
| | | if (pBuddy != nullptr) { |
| | | m_listCtrl.SetItemText(index, 2, pBuddy->getID().c_str()); |
| | | } |
| | | } |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | |
| | | |
| | | CGlass::~CGlass() |
| | | { |
| | | |
| | | } |
| | | |
| | | void CGlass::reset() |
| | | { |
| | | CPath* pPath = m_pPath; |
| | | while (pPath != nullptr) { |
| | | CPath* pTemp = pPath->getNext(); |
| | |
| | | } |
| | | m_pPath = nullptr; |
| | | |
| | | if (m_pBuddy != nullptr && m_type == MaterialsType::G1) { |
| | | if (m_pBuddy != nullptr) { |
| | | m_pBuddy->release(); |
| | | } |
| | | } |
| | |
| | | public: |
| | | CGlass(); |
| | | virtual ~CGlass(); |
| | | void reset(); |
| | | |
| | | public: |
| | | virtual std::string& getClassName(); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "CGlassPool.h" |
| | | |
| | | |
| | | #define DEFAULT_GLASS_POOL_SIZE 1024 |
| | | |
| | | namespace SERVO { |
| | | CGlassPool::CGlassPool() |
| | | { |
| | | InitializeCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | |
| | | CGlassPool::~CGlassPool() |
| | | { |
| | | DeleteCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | void CGlassPool::initPool() |
| | | { |
| | | auto onReleaseAny = [&](void* pAny) -> void { |
| | | // åæ¶Glass |
| | | freeGlass((CGlass*)pAny); |
| | | }; |
| | | |
| | | |
| | | // åé
CGlassæ± |
| | | Lock(); |
| | | for (int i = 0; i < DEFAULT_GLASS_POOL_SIZE; i++) { |
| | | CGlass* pGlass = new CGlass(); |
| | | pGlass->setOnRelease(onReleaseAny); |
| | | m_lsitAvailable.push_back(pGlass); |
| | | } |
| | | Unlock(); |
| | | } |
| | | |
| | | void CGlassPool::term() |
| | | { |
| | | Lock(); |
| | | for (auto item : m_lsitAvailable) { |
| | | delete item; |
| | | } |
| | | m_lsitAvailable.clear(); |
| | | |
| | | for (auto item : m_mapOccupation) { |
| | | delete item.second; |
| | | } |
| | | m_mapOccupation.clear(); |
| | | Unlock(); |
| | | } |
| | | |
| | | CGlass* CGlassPool::allocaGlass() |
| | | { |
| | | |
| | | Lock(); |
| | | CGlass* pGlass = NULL; |
| | | if (!m_lsitAvailable.empty()) { |
| | | pGlass = m_lsitAvailable.front(); |
| | | m_lsitAvailable.pop_front(); |
| | | m_mapOccupation[pGlass] = pGlass; |
| | | } |
| | | |
| | | Unlock(); |
| | | |
| | | return pGlass; |
| | | } |
| | | |
| | | void CGlassPool::freeGlass(CGlass* pGlass) |
| | | { |
| | | // åæ¶CAny |
| | | Lock(); |
| | | pGlass->reset(); |
| | | auto iter = m_mapOccupation.find(pGlass); |
| | | if (iter != m_mapOccupation.end()) { |
| | | m_lsitAvailable.push_back(iter->second); |
| | | m_mapOccupation.erase(iter); |
| | | } |
| | | Unlock(); |
| | | } |
| | | |
| | | int CGlassPool::getAvailableSize() |
| | | { |
| | | Lock(); |
| | | int nSize = (int)(m_lsitAvailable.size()); |
| | | Unlock(); |
| | | |
| | | return nSize; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "CGlass.h" |
| | | #include <map> |
| | | #include <list> |
| | | |
| | | |
| | | namespace SERVO { |
| | | class CGlassPool |
| | | { |
| | | public: |
| | | CGlassPool(); |
| | | ~CGlassPool(); |
| | | |
| | | public: |
| | | void initPool(); |
| | | void term(); |
| | | CGlass* allocaGlass(); |
| | | void freeGlass(CGlass* pGlass); |
| | | int getAvailableSize(); |
| | | |
| | | private: |
| | | inline void Lock() { EnterCriticalSection(&m_criticalSection); } |
| | | inline void Unlock() { LeaveCriticalSection(&m_criticalSection); } |
| | | |
| | | |
| | | private: |
| | | CRITICAL_SECTION m_criticalSection; |
| | | std::map<void*, CGlass*> m_mapOccupation; // 使ç¨ä¸ç |
| | | std::list<CGlass*> m_lsitAvailable; // 空é²ç |
| | | }; |
| | | } |
| | | |
| | |
| | | #include "stdafx.h" |
| | | #include "CLoadPort.h" |
| | | #include "CGlassPool.h" |
| | | #include "Servo.h" |
| | | |
| | | |
| | | #define CHECK_READ_STEP_SIGNAL2(addr, data, size) { \ |
| | |
| | | js.setGlass2Id(szBuffer); |
| | | } |
| | | |
| | | CGlass* pGlass = new CGlass(); |
| | | CGlass* pGlass = theApp.m_model.m_glassPool.allocaGlass(); |
| | | pGlass->setID(szBuffer); |
| | | pGlass->setJobDataB(&jb); |
| | | pGlass->setType(type); |
| | |
| | | |
| | | CMaster::~CMaster() |
| | | { |
| | | for (auto item : m_listEquipment) { |
| | | delete item; |
| | | } |
| | | m_listEquipment.clear(); |
| | | |
| | | if (m_hEventReadBitsThreadExit[0] != nullptr) { |
| | | ::CloseHandle(m_hEventReadBitsThreadExit[0]); |
| | | m_hEventReadBitsThreadExit[0] = nullptr; |
| | |
| | | saveCache(); |
| | | |
| | | |
| | | for (auto item : m_listEquipment) { |
| | | delete item; |
| | | } |
| | | m_listEquipment.clear(); |
| | | |
| | | |
| | | return 0; |
| | | } |
| | |
| | | |
| | | CContext::CContext() |
| | | { |
| | | m_onReleaseCallback = nullptr; |
| | | m_nRef = 0; |
| | | m_nRetCode = 0; |
| | | m_hEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL); |
| | |
| | | DeleteCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | void CContext::setOnRelease(ONRELEASECALLBACK fOnRelease) |
| | | { |
| | | m_onReleaseCallback = fOnRelease; |
| | | } |
| | | |
| | | int CContext::addRef() |
| | | { |
| | | Lock(); |
| | |
| | | int CContext::release() |
| | | { |
| | | Lock(); |
| | | m_nRef--; |
| | | BOOL bDelete = m_nRef == 0; |
| | | Unlock(); |
| | | if (m_nRef > 0) { |
| | | m_nRef--; |
| | | BOOL bRefCount0 = m_nRef == 0; |
| | | Unlock(); |
| | | |
| | | int nRef = m_nRef;; |
| | | if (bDelete) delete this; |
| | | return nRef; |
| | | if (bRefCount0 && m_onReleaseCallback != nullptr) { |
| | | m_onReleaseCallback(this); |
| | | } |
| | | } |
| | | else { |
| | | Unlock(); |
| | | } |
| | | |
| | | return m_nRef; |
| | | } |
| | | |
| | | void CContext::setRetCode(int code) |
| | |
| | | #pragma once |
| | | #include "Common.h" |
| | | #include <functional> |
| | | |
| | | |
| | | typedef std::function<void(void*)> ONRELEASECALLBACK; |
| | | class CContext : public IRxObject |
| | | { |
| | | public: |
| | |
| | | virtual ~CContext(); |
| | | |
| | | public: |
| | | void setOnRelease(ONRELEASECALLBACK fOnRelease); |
| | | int addRef(); |
| | | int release(); |
| | | |
| | |
| | | static BOOL IsLotId(CString& strId); |
| | | |
| | | private: |
| | | ONRELEASECALLBACK m_onReleaseCallback; |
| | | int m_nRef; |
| | | CRITICAL_SECTION m_criticalSection; |
| | | |
| | |
| | | #include "ToolUnits.h" |
| | | #include "CEqAlarmStep.h" |
| | | #include "AlarmManager.h" |
| | | #include "CGlassPool.h" |
| | | |
| | | |
| | | CModel::CModel() |
| | |
| | | CString strModeType = _T("Master"); |
| | | CString strSoftRev = _T("1.0.2"); |
| | | |
| | | |
| | | // CGlassPool |
| | | m_glassPool.initPool(); |
| | | |
| | | |
| | | // Log |
| | |
| | | m_hsmsPassive.term(); |
| | | CLog::GetLog()->SetOnLogCallback(nullptr); |
| | | m_master.term(); |
| | | m_glassPool.term(); |
| | | |
| | | return 0; |
| | | } |
| | |
| | | #include "Configuration.h" |
| | | #include "HsmsPassive.h" |
| | | #include "CMaster.h" |
| | | #include "CGlassPool.h" |
| | | |
| | | class CModel |
| | | { |
| | |
| | | public: |
| | | CConfiguration m_configuration; |
| | | CHsmsPassive m_hsmsPassive; |
| | | SERVO::CGlassPool m_glassPool; |
| | | SERVO::CMaster m_master; |
| | | |
| | | private: |
| | |
| | | <Text Include="ReadMe.txt" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="CGlassPool.h" /> |
| | | <ClInclude Include="PageRecipe.h" /> |
| | | <ClInclude Include="CDoubleGlass.h" /> |
| | | <ClInclude Include="CProcessData.h" /> |
| | |
| | | <ClInclude Include="VerticalLine.h" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClCompile Include="CGlassPool.cpp" /> |
| | | <ClCompile Include="PageRecipe.cpp" /> |
| | | <ClCompile Include="CDoubleGlass.cpp" /> |
| | | <ClCompile Include="CProcessData.cpp" /> |
| | |
| | | <ClCompile Include="PageRecipe.cpp" /> |
| | | <ClCompile Include="CDoubleGlass.cpp" /> |
| | | <ClCompile Include="CProcessData.cpp" /> |
| | | <ClCompile Include="CGlassPool.cpp" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="AlarmManager.h" /> |
| | |
| | | <ClInclude Include="PageRecipe.h" /> |
| | | <ClInclude Include="CDoubleGlass.h" /> |
| | | <ClInclude Include="CProcessData.h" /> |
| | | <ClInclude Include="CGlassPool.h" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ResourceCompile Include="Servo.rc" /> |