亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? memwritelock.cpp

?? 用于開發(fā)Modbus工業(yè)級(jí)通信
?? CPP
字號(hào):
/////////////////////////////////////////////////////////////////////////////
//
// FILE: MemWriteLock.cpp : implementation file
//
// See _README.CPP
// 
// Implementation of the CMemWriteLock 
//                       CControllerMemoryArea
//                       CControllerMemory classes.
//
/////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

/////////////////////////////////////////////////////////////////////////////
// implementation of the CMemWriteLock class.
//
/////////////////////////////////////////////////////////////////////////////

CMemWriteLock::CMemWriteLock(CMutex *pMutex) : CSingleLock(pMutex, FALSE)
{

   m_pMutex = pMutex;
   //m_pMutex->Lock(INFINITE);
   m_pMutex->Lock(20000);  // lock for 20 seconds
}

CMemWriteLock::~CMemWriteLock()
{
   // the base object destructor will call this anyway
   m_pMutex->Unlock();
}

/////////////////////////////////////////////////////////////////////////////
// implementation of the CControllerMemoryArea class.
//
/////////////////////////////////////////////////////////////////////////////

CControllerMemoryArea::CControllerMemoryArea()
{
   SetSize(MAX_MOD_MEMWORDS); // 65536
}

// --------------------------- SetSize ------------------------------
CControllerMemoryArea::SetSize(const DWORD numWords)
{
   CWordArray::SetSize(numWords);
   m_size = numWords;
   m_numberRegistersLimit = numWords;
}

// ---------------------------- GetAt -------------------------------
// read the array
WORD CControllerMemoryArea::GetAt(const DWORD index)
{  
   ASSERT(index <= m_size);
   if (index > m_numberRegistersLimit)
   {
      OutputDebugString("Attempt to read past PLC buffer end");
      return (0);
   }
   return (CWordArray::GetAt(index));
}

// -------------------------- operator [] ------------------------------
// read the array
WORD CControllerMemoryArea::operator [](const DWORD index)
{
   return (GetAt(index));
}

// ------------------------------ SetAt ---------------------------------
// Write to array, 
// requires the write interlock object
void CControllerMemoryArea::SetAt(const DWORD index, WORD data, CMutex *pMutex) 
{
CMemWriteLock  lock(pMutex);  // interlock all writes to us

   ASSERT(index < m_size);
   if (index >= m_numberRegistersLimit)
   {
      OutputDebugString("Attempt to write past PLC buffer end");
      return;  // do nothing when writting past the limit
   }
   CWordArray::SetAt(index, data);
}

// -------------------------------- IncrementAt --------------------------
// increment a specific word by X
void CControllerMemoryArea::IncrementAt(const DWORD index, WORD incValue, CMutex *pMutex)
{
WORD value = GetAt(index);
//CString d;
   SetAt(index, (WORD)(value+incValue), pMutex);
   //d.Format(" last= %d new = %d ", value, value+incValue);
   //OutputDebugString(d);
}

/////////////////////////////////////////////////////////////////////////////
// implementation of the CControllerMemory class.
//
/////////////////////////////////////////////////////////////////////////////

CControllerMemory::CControllerMemory()
{
   if (pGlobalDialog)
      SetSize(pGlobalDialog->GetNumMemoryAreas());//MAX_MOD_MEMTYPES);
}

CControllerMemory::~CControllerMemory()
{
   // delete ram used
   FreeOldMemory();
}

// --------------------------- SetSize -----------------------------
CControllerMemory::SetSize(const DWORD numAreas)
{

   FreeOldMemory();
   CObArray::SetSize(numAreas);
   // allocate new memory
   m_size = numAreas;
   AllocateNewMemory(numAreas);
}


// ---------------------------- GetAt ---------------------------------
CControllerMemoryArea& CControllerMemory::GetAt(const DWORD index)
{
CControllerMemoryArea* pWordArr;
   
   ASSERT(index < m_size);
   if (index > m_size)
      return(*(CControllerMemoryArea*)CObArray::GetAt(0)); //erorr
   pWordArr = (CControllerMemoryArea*)CObArray::GetAt(index);
   return (*pWordArr);
}

// -------------------------- operator [] ------------------------------
CControllerMemoryArea& CControllerMemory::operator [](const DWORD index)
{
   if (index >= m_size)
      return(GetAt(0));
   return (GetAt(index));
}

// ---------------------------- SetAt ----------------------------------
void CControllerMemory::SetAt(const DWORD index, const DWORD subIndex, WORD data)
{
CControllerMemoryArea* pWordArr;
   
   ASSERT(index < m_size);
   pWordArr = (CControllerMemoryArea*)CObArray::GetAt(index);
   pWordArr->SetAt(subIndex, data, &m_Mutex);
}

// ----------------------------- IncrementAt ---------------------------
// increment a specific word by X
void CControllerMemory::IncrementAt(const DWORD index, const DWORD subIndex,  WORD incValue)
{
   if (index > m_size)  // to stop animation messing up during PLC construction
      return;
   GetAt(index).IncrementAt(subIndex, incValue, &m_Mutex);
}

// ---------------------------- FreeOldMemory ---------------------------
// free all CControllerMemoryArea objects
CControllerMemory::FreeOldMemory()
{
LONG size;
CControllerMemoryArea *pWordArr;

   size = GetSize();
   while (size>0)
   {
      pWordArr = (CControllerMemoryArea *)CObArray::GetAt(size-1);
      if (NULL !=pWordArr)
         delete (pWordArr);
      size--;
   }
} // FreeOldMemory

// ---------------------------- AllocateNewMemory ------------------------
// allocates CControllerMemoryArea Objects the required # of memory areas
//
CControllerMemory::AllocateNewMemory(const DWORD areas)
{
LONG index;
CControllerMemoryArea *pWordArr;

   index = 0;
   while (index < (LONG)areas)
   {
      pWordArr = new CControllerMemoryArea;
      CObArray::SetAtGrow(index, pWordArr);
      index++;
   }
} // AllocateNewMemory

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久夜色精品一区| 国产日韩av一区二区| 精品一区二区三区蜜桃| 1024精品合集| 欧美成人福利视频| 91福利小视频| 国产福利一区二区| 青青草国产精品97视觉盛宴 | 中文字幕av一区二区三区| 欧美性生交片4| 99这里只有久久精品视频| 精品一区二区三区的国产在线播放 | 在线播放国产精品二区一二区四区| 国产精品一区二区久激情瑜伽 | 亚洲欧美偷拍三级| 久久久久久久久久久久久夜| 欧美猛男gaygay网站| bt欧美亚洲午夜电影天堂| 韩国欧美一区二区| 蜜桃视频一区二区三区在线观看| 亚洲精品精品亚洲| 国产精品区一区二区三| 久久婷婷国产综合精品青草| 欧美一级二级三级乱码| 欧美视频在线一区| 91成人网在线| 91成人免费在线视频| 99v久久综合狠狠综合久久| 国产精品白丝jk黑袜喷水| 国内精品视频一区二区三区八戒| 日本在线不卡视频| 五月婷婷综合激情| 亚洲国产精品一区二区久久| 一区二区免费视频| 一区二区三区四区乱视频| 专区另类欧美日韩| 中文字幕一区二区视频| 中文字幕第一区| 国产女主播在线一区二区| 中文字幕欧美三区| 国产精品视频看| 国产精品电影院| 亚洲欧洲日产国产综合网| 免费不卡在线视频| 三级欧美在线一区| 日韩—二三区免费观看av| 日本欧美加勒比视频| 免费观看在线色综合| 精品一区二区三区在线观看国产| 狠狠色丁香久久婷婷综| 国产在线精品一区二区不卡了 | 亚洲人成网站精品片在线观看| 国产精品嫩草影院com| 亚洲国产成人午夜在线一区| 亚洲视频在线观看三级| 亚洲色图制服诱惑| 亚洲午夜国产一区99re久久| 婷婷综合另类小说色区| 久久精品国产秦先生| 国产精品99久久久久久似苏梦涵 | 激情五月婷婷综合| 国产高清久久久久| 99久久99精品久久久久久| 一本一道波多野结衣一区二区| 欧美亚洲另类激情小说| 日韩一区二区三| 久久精品视频在线看| 综合电影一区二区三区 | 欧美一区三区二区| 精品国产一二三| 亚洲欧洲日韩av| 天堂影院一区二区| 国产乱理伦片在线观看夜一区| 99久久精品国产网站| 6080日韩午夜伦伦午夜伦| 精品国产91乱码一区二区三区| 欧美国产日本韩| 亚洲一区二区三区在线| 久久er精品视频| 91视视频在线观看入口直接观看www| 欧美午夜片在线观看| www一区二区| 一区二区三区在线视频免费| 另类人妖一区二区av| 99re66热这里只有精品3直播 | 男女男精品视频网| 精品欧美一区二区在线观看 | 亚洲女子a中天字幕| 日韩精品1区2区3区| 成人性生交大片免费看视频在线 | 7878成人国产在线观看| 欧美国产精品劲爆| 婷婷综合五月天| 99热这里都是精品| 欧美一区二区二区| 亚洲女与黑人做爰| 国产一区二区三区四区五区美女 | 91色综合久久久久婷婷| 欧美一级二级在线观看| 亚洲精品国久久99热| 国产黄色精品视频| 3d成人动漫网站| 亚洲视频免费观看| 国产一区美女在线| 欧美日韩精品一区二区在线播放| 中文字幕久久午夜不卡| 欧美aaaaaa午夜精品| 欧亚一区二区三区| 国产精品人成在线观看免费| 极品美女销魂一区二区三区免费| 欧美日韩一区视频| 自拍偷拍亚洲综合| 成人精品免费看| 精品福利av导航| 首页国产欧美久久| 欧美亚洲动漫另类| 日韩毛片精品高清免费| 成人三级伦理片| 久久色在线观看| 热久久一区二区| 欧美精品第1页| 五月天激情小说综合| 在线看国产一区二区| 最新日韩在线视频| 成人开心网精品视频| 久久亚洲精华国产精华液| 久久精品国产亚洲a| 日韩欧美一区二区不卡| 日本va欧美va精品发布| 欧美精品少妇一区二区三区| 午夜伊人狠狠久久| 欧美日韩成人一区二区| 亚洲韩国一区二区三区| 欧美亚洲动漫制服丝袜| 亚洲国产精品精华液网站| 欧美在线你懂的| 樱花影视一区二区| 欧美在线观看一二区| 一区二区三区自拍| 91国产免费看| 亚洲成人资源网| 91精品国产综合久久小美女 | 色悠悠亚洲一区二区| 1024国产精品| 欧美在线999| 色欧美片视频在线观看在线视频| 综合自拍亚洲综合图不卡区| 99久久99久久精品免费观看| 亚洲色图另类专区| 欧美吻胸吃奶大尺度电影| 亚洲一区二区三区四区的| 欧美亚洲一区三区| 日本不卡免费在线视频| 久久综合成人精品亚洲另类欧美| 国产美女精品在线| 亚洲欧洲在线观看av| 色婷婷精品久久二区二区蜜臂av | 日韩一区在线播放| 欧美综合在线视频| 日本中文字幕一区二区有限公司| 精品国产自在久精品国产| 丰满放荡岳乱妇91ww| 综合久久给合久久狠狠狠97色| 欧美在线视频你懂得| 久久精品国产一区二区| 国产精品久久三| 欧美色男人天堂| 激情图片小说一区| 日韩美女精品在线| 欧美一级日韩免费不卡| 国产盗摄女厕一区二区三区| 亚洲少妇屁股交4| 日韩一级二级三级| 成人看片黄a免费看在线| 亚洲第一电影网| 国产午夜精品一区二区三区嫩草 | 91精品福利视频| 日韩电影在线观看一区| 欧美国产一区二区| 7777精品伊人久久久大香线蕉 | 欧美在线一区二区三区| 男女激情视频一区| 最新国产の精品合集bt伙计| 91精品麻豆日日躁夜夜躁| 成人精品国产免费网站| 午夜精品久久久久久久蜜桃app| 亚洲精品一区二区三区香蕉| 一本到三区不卡视频| 韩国一区二区在线观看| 一区二区三区在线高清| 久久网站最新地址| 欧美少妇xxx| 成人av资源下载| 九一久久久久久| 亚洲影院理伦片| 国产精品久久综合| 欧美mv日韩mv亚洲| 欧美午夜宅男影院| 91亚洲精品乱码久久久久久蜜桃| 免费视频最近日韩|