public Cookie( MamaSourceGroup mGroup, MamaSourceStateChangeCallback mCallback, IntPtr registrationHandle, IntPtr mKey) { this.mGroup = mGroup; this.mCallback = mCallback; this.mHandle = registrationHandle; this.mKey = mKey; }
public Enumerator(MamaSourceGroup that) { mMamaSourceGroup = that; mItems = new ArrayList(); mGroupIteratorDelegate = new MamaSourceGroupIterateDelegate(this.onIterate); int code = NativeMethods.mamaSourceGroup_iterateSources( mMamaSourceGroup.NativeHandle, mGroupIteratorDelegate, IntPtr.Zero); MamaWrapper.CheckResultCode(code); mIndex = 0; GC.KeepAlive(this); }
/// <summary> /// Add an existing MamaSourceGroup to the specified mamaSourceGroupManager. /// The name of the sourceGroup will be used to uniquely identify /// the sourceGroup within the manager. /// </summary> /// <param name="sourceGroup">The mamaSourceGroup being added to the specified /// MamaSourceGroupManager</param> public void add(MamaSourceGroup sourceGroup) { #if MAMA_WRAPPERS_CHECK_ARGUMENTS if (sourceGroup == null) { throw new ArgumentNullException("sourceGroup", sourceGroup); } #endif // MAMA_WRAPPERS_CHECK_ARGUMENTS EnsurePeerCreated(); int code = NativeMethods.mamaSourceGroupManager_addSourceGroup(nativeHandle, sourceGroup.NativeHandle); CheckResultCode(code); // add it to the list mItems[sourceGroup.name] = sourceGroup; GC.KeepAlive(sourceGroup); }
/// <summary> /// Helper, utilizing find and add /// </summary> public MamaSourceGroup this[string sourceGroupName] { get { return(find(sourceGroupName)); } set { // NB!: removal is impossible MamaSourceGroup val = find(sourceGroupName); if (val == null) { add(value); } } }
/// <summary> /// Create a new mamaSourceGroup and add it to the manager. /// </summary> /// <param name="name">The string identifier for the mamaSourceGroup.</param> /// <returns>The added source group</returns> public MamaSourceGroup create(string name) { #if MAMA_WRAPPERS_CHECK_ARGUMENTS if (name == null) { throw new ArgumentNullException("name", name); } #endif // MAMA_WRAPPERS_CHECK_ARGUMENTS EnsurePeerCreated(); IntPtr value = IntPtr.Zero; int code = NativeMethods.mamaSourceGroupManager_createSourceGroup(nativeHandle, name, ref value); CheckResultCode(code); MamaSourceGroup group = new MamaSourceGroup(value); // cache it in order to be able to iterate mItems[name] = group; return(group); }
/// <summary> /// Create a new mamaSourceGroup and add it to the manager. /// </summary> /// <param name="name">The string identifier for the mamaSourceGroup.</param> /// <returns>The added source group</returns> public MamaSourceGroup create(string name) { #if MAMA_WRAPPERS_CHECK_ARGUMENTS if (name == null) { throw new ArgumentNullException("name", name); } #endif // MAMA_WRAPPERS_CHECK_ARGUMENTS EnsurePeerCreated(); IntPtr value = IntPtr.Zero; int code = NativeMethods.mamaSourceGroupManager_createSourceGroup(nativeHandle, name, ref value); CheckResultCode(code); MamaSourceGroup group = new MamaSourceGroup(value); // cache it in order to be able to iterate mItems[name] = group; return group; }