⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 connection.cpp

📁 opc 源码 opc 源码
💻 CPP
字号:
// Connection.cpp: implementation of the CConnection class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "VCOPCClient.h"
#include "Connection.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CConnection::CConnection() : m_hServer(INVALID_HANDLE_VALUE)
{

}

CConnection::~CConnection()
{
	//删除已经创建的组
	for( vector<CGroup*>::iterator iter = m_Groups.begin();
		 iter != m_Groups.end(); 
		 ++iter)
	{
		RemoveGroup(m_hServer, (*iter)->m_Handle);
		delete *iter;
	}
	m_Groups.clear();
}

CGroup* CConnection::GetGroup(CString& strGroup)
{
	for( vector<CGroup*>::iterator iter = m_Groups.begin();
		 iter != m_Groups.end(); 
		 ++iter)
	{
		if ( strcmp(strGroup, (*iter)->m_Name) == 0 )
		{
			return *iter;
		}
	}
	return NULL;	
}

void CConnection::EraseGroup(CString& strGroup)
{
	for( vector<CGroup*>::iterator iter = m_Groups.begin();
		 iter != m_Groups.end(); 
		 ++iter)
	{
		if ( strcmp(strGroup, (*iter)->m_Name) == 0 )
		{
			m_Groups.erase(iter);
			return;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -