コード例 #1
0
        /// <summary>
        /// Gets the collection of subscriptions currently "associated" with the <see cref="DataWriter" />; that is, subscriptions that have a
        /// matching <see cref="Topic" /> and compatible QoS that the application has not indicated should be "ignored" by means of the
        /// <see cref="DomainParticipant" /> IgnoreSubscription operation.
        /// </summary>
        /// <remarks>
        /// The handles returned in the 'subscriptionHandles' collection are the ones that are used by the DDS implementation to locally
        /// identify the corresponding matched <see cref="DataReader" /> entities. These handles match the ones that appear in the <see cref="SampleInfo.InstanceState" />
        /// property of the <see cref="SampleInfo" /> when reading the "DCPSSubscriptions" builtin topic.
        /// </remarks>
        /// <param name="subscriptionHandles">The collection of subscription <see cref="InstanceHandle" />s to be filled up.</param>
        /// <returns>The <see cref="ReturnCode" /> that indicates the operation result.</returns>
        public ReturnCode GetMatchedSubscriptions(ICollection <InstanceHandle> subscriptionHandles)
        {
            if (subscriptionHandles == null)
            {
                return(ReturnCode.BadParameter);
            }

            subscriptionHandles.Clear();

            IntPtr     seq = IntPtr.Zero;
            ReturnCode ret = UnsafeNativeMethods.GetMatchedSubscriptions64(_native, ref seq);

            if (ret == ReturnCode.Ok && !seq.Equals(IntPtr.Zero))
            {
                MarshalHelper.PtrToSequence(seq, ref subscriptionHandles);
                MarshalHelper.ReleaseNativePointer(seq);
            }

            return(ret);
        }