www.pudn.com > Ge_opc_Server_v1.rar > ITEMUTIL.CPP


// ITEMUtil.cpp 
// 
//  This file contains some OPCITEMATTRIBUTES utility functions 
//  for the OPC server. 
// 
// 
//	(c) COPYRIGHT 1996, INTELLUTION INC. 
// ALL RIGHTS RESERVED 
// 
// Original Author: Al Chisholm 
// 
// Modification Log: 
//	Vers    Date   By    Notes 
//	----  -------- ---   ----- 
//	0.00  12/31/96 ACC 
// 
// 
// Notes: 
// See also LHEpipeviewItem::GetIA() in item.cpp 
// 
 
 
#define WIN32_LEAN_AND_MEAN 
 
#include "OPCLHEpipeview.h" 
 
/////////////////////////////////////// 
// Clone an OPCITEMATTRIBUTES 
// This is similar to IAGet() in item.cpp 
// 
void IAClone(OPCITEMATTRIBUTES *newIA, const OPCITEMATTRIBUTES * oldIA, IMalloc *pmem) 
{ 
	// Note Blob and EUInfo not supported at present 
 
	// the easy stuff... 
	// 
	newIA->bActive = oldIA->bActive; 
	newIA->hServer = oldIA->hServer; 
	newIA->hClient = oldIA->hClient; 
	newIA->dwAccessRights = oldIA->dwAccessRights; 
	newIA->dwBlobSize = 0;	// not supported 
	newIA->pBlob = NULL; 
	newIA->vtRequestedDataType= oldIA->vtRequestedDataType; 
	newIA->vtCanonicalDataType= oldIA->vtCanonicalDataType; 
	newIA->dwEUType = OPC_NOENUM;		// not supported 
	newIA->vEUInfo.vt = VT_EMPTY; 
 
	// strings... 
	// 
	newIA->szAccessPath = WSTRClone( oldIA->szAccessPath, pmem); 
	newIA->szItemID = WSTRClone(oldIA->szItemID, pmem); 
 
} 
 
/////////////////////////////////////// 
// Free the contents of an OPCITEMATTRIBUTES 
// (Caller must Free IA itself) 
// 
void IAFree(OPCITEMATTRIBUTES *pIA, IMalloc* pmem) 
{ 
	if(pIA == NULL) return; 
 
	// Note Blob and EUInfo not supported at present 
	WSTRFree(pIA->szAccessPath, pmem); 
	WSTRFree(pIA->szItemID, pmem); 
}