/// <summary> adds a new OPCItemExtender to the list </summary> /// <param name="theItem"> the OPCItemExtender-object </param> /// <returns> the index of the added item in this list </returns> /// <exception cref="ArgumentException"> the itemID of the OPCItemExtender has to be different from /// all other itemID in this list! </exception> public int Add(OPCItemExtender theItem) { if (m_itemIDItemMapping.ContainsKey(theItem.itemID)) { string str = "The opc-item already exists in this list." + "\n" + "In order to use the opc-item in a multiple way, you have to insert it into another opc-item-list."; throw new ArgumentException(str); } m_itemIDItemMapping.Add(theItem.itemID, theItem); return(base.Add(theItem)); }
/// <summary> removes the OPCItemExtender-object; /// NOTE: the caller must ensure that the clienthandles are going to be reset /// to the new values! otherwise the callback-mechanism will fail! </summary> /// <param name="index"> the index </param> public override void RemoveAt(int index) { OPCItemExtender itm = (OPCItemExtender)this[index]; m_itemIDItemMapping.Remove(itm.itemID); base.RemoveAt(index); // renew clienthandles of all 'following' items, because the array-index has now changed for (int i = index; i < this.Count; i++) { ((OPCItemExtender)this[i]).clientHndl = i; } }
/// <summary> removes the OPCItemExtender-object; /// NOTE: the caller must ensure that the clienthandles are going to be reset /// to the new values! otherwise the callback-mechanism will fail! </summary> /// <param name="theItem"> the OPCItemExtender-object </param> public void Remove(OPCItemExtender theItem) { int idx = theItem.clientHndl; m_itemIDItemMapping.Remove(theItem.itemID); base.Remove(theItem); // renew clienthandles of all 'following' items, because the array-index has now changed for (int i = idx; i < this.Count; i++) { ((OPCItemExtender)this[i]).clientHndl = i; } }
public int getSrvHandle(string itemID) { OPCItemExtender itm = (OPCItemExtender)m_itemIDItemMapping[itemID]; return(itm.serverHndl); }
public object getValue(string itemID) { OPCItemExtender itm = (OPCItemExtender)m_itemIDItemMapping[itemID]; return(itm.actValue); }
public void setValue(string itemID, object theValue) { OPCItemExtender itm = (OPCItemExtender)m_itemIDItemMapping[itemID]; itm.actValue = theValue; }