public signals.IAttribute this[string name] { get { if (name == null) throw new ArgumentNullException("name"); byte[] strName = System.Text.Encoding.UTF8.GetBytes(name); IntPtr nameBuff = Marshal.AllocHGlobal(strName.Length + 1); try { Marshal.Copy(strName, 0, nameBuff, strName.Length); Marshal.WriteByte(nameBuff, strName.Length, 0); IntPtr attrRef = m_native.GetByName(nameBuff); if (attrRef == IntPtr.Zero) return null; signals.IAttribute newObj = (signals.IAttribute)Registration.retrieveObject(attrRef); if (newObj == null) newObj = new CppProxyAttribute(attrRef); return newObj; } finally { Marshal.FreeHGlobal(nameBuff); } } }
public IEnumerator<signals.IAttribute> Itemize(signals.EAttrEnumFlags flags) { uint numAttr = m_native.Itemize(IntPtr.Zero, 0, (uint)flags); if (numAttr == 0) return ((IList<signals.IAttribute>)new signals.IAttribute[0]).GetEnumerator(); IntPtr[] ptrArr = new IntPtr[numAttr]; GCHandle pin = GCHandle.Alloc(ptrArr, GCHandleType.Pinned); uint numObj; try { numObj = m_native.Itemize(pin.AddrOfPinnedObject(), numAttr, (uint)flags); } finally { pin.Free(); } signals.IAttribute[] attrArray = new signals.IAttribute[numObj]; for (int idx = 0; idx < numObj; idx++) { if (ptrArr[idx] != IntPtr.Zero) { signals.IAttribute newObj = (signals.IAttribute)Registration.retrieveObject(ptrArr[idx]); if (newObj == null) newObj = new CppProxyAttribute(ptrArr[idx]); attrArray[idx] = newObj; } } return ((IList<signals.IAttribute>)attrArray).GetEnumerator(); }
public ChangedCatcher(CppProxyAttribute parent) { this.parent = new WeakReference(parent); }