Пример #1
0
        internal void FromNative(SubscriptionBuiltinTopicDataWrapper wrapper)
        {
            Deadline         = wrapper.Deadline;
            DestinationOrder = wrapper.DestinationOrder;
            Durability       = wrapper.Durability;
            Key             = wrapper.Key;
            LatencyBudget   = wrapper.LatencyBudget;
            Liveliness      = wrapper.Liveliness;
            Ownership       = wrapper.Ownership;
            ParticipantKey  = wrapper.ParticipantKey;
            Presentation    = wrapper.Presentation;
            Reliability     = wrapper.Reliability;
            TimeBasedFilter = wrapper.TimeBasedFilter;

            if (Partition == null)
            {
                Partition = new PartitionQosPolicy();
            }
            Partition.FromNative(wrapper.Partition);

            if (GroupData == null)
            {
                GroupData = new GroupDataQosPolicy();
            }
            GroupData.FromNative(wrapper.GroupData);

            if (TopicData == null)
            {
                TopicData = new TopicDataQosPolicy();
            }
            TopicData.FromNative(wrapper.TopicData);

            if (UserData == null)
            {
                UserData = new UserDataQosPolicy();
            }
            UserData.FromNative(wrapper.UserData);

            if (wrapper.TopicName != IntPtr.Zero)
            {
                TopicName = Marshal.PtrToStringAnsi(wrapper.TopicName);
            }
            else
            {
                TopicName = null;
            }

            if (wrapper.TypeName != IntPtr.Zero)
            {
                TypeName = Marshal.PtrToStringAnsi(wrapper.TypeName);
            }
            else
            {
                TypeName = null;
            }
        }
Пример #2
0
        internal SubscriptionBuiltinTopicDataWrapper ToNative()
        {
            if (toRelease == null)
            {
                toRelease = new List <IntPtr>();
            }

            var data = new SubscriptionBuiltinTopicDataWrapper
            {
                Deadline         = Deadline,
                DestinationOrder = DestinationOrder,
                Durability       = Durability,
                Key             = Key,
                LatencyBudget   = LatencyBudget,
                Liveliness      = Liveliness,
                Ownership       = Ownership,
                ParticipantKey  = ParticipantKey,
                Presentation    = Presentation,
                Reliability     = Reliability,
                TimeBasedFilter = TimeBasedFilter,
            };

            if (Partition != null)
            {
                data.Partition = Partition.ToNative();
            }

            if (GroupData != null)
            {
                data.GroupData = GroupData.ToNative();
            }

            if (TopicData != null)
            {
                data.TopicData = TopicData.ToNative();
            }

            if (UserData != null)
            {
                data.UserData = UserData.ToNative();
            }

            if (TopicName != null)
            {
                data.TopicName = Marshal.StringToHGlobalAnsi(TopicName);
                toRelease.Add(data.TopicName);
            }

            if (TypeName != null)
            {
                data.TypeName = Marshal.StringToHGlobalAnsi(TypeName);
                toRelease.Add(data.TypeName);
            }

            return(data);
        }
Пример #3
0
        /// <summary>
        /// Retrieves information on a subscription that is currently "associated" with the <see cref="DataWriter" />; that is, a subscription
        /// with 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>
        /// <para>The subscriptionHandle must correspond to a subscription currently associated with the <see cref="DataWriter" />, otherwise the operation
        /// will fail and return <see cref="ReturnCode.BadParameter" />. The operation GetMatchedSubscriptions can be used to find the subscriptions that
        /// are currently matched with the <see cref="DataWriter" />.</para>
        /// </remarks>
        /// <param name="subscriptionHandle">The <see cref="InstanceHandle" /> of the subscription data requested.</param>
        /// <param name="subscriptionData">The <see cref="SubscriptionBuiltinTopicData" /> structure to be filled up.</param>
        /// <returns>The <see cref="ReturnCode" /> that indicates the operation result.</returns>
        public ReturnCode GetMatchedSubscriptionData(InstanceHandle subscriptionHandle, ref SubscriptionBuiltinTopicData subscriptionData)
        {
            SubscriptionBuiltinTopicDataWrapper data = default;

            ReturnCode ret = UnsafeNativeMethods.GetMatchedSubscriptionData64(_native, ref data, subscriptionHandle);

            if (ret == ReturnCode.Ok)
            {
                subscriptionData.FromNative(data);
            }

            return(ret);
        }
Пример #4
0
 public static extern ReturnCode GetMatchedSubscriptionData64(IntPtr dw, [MarshalAs(UnmanagedType.Struct), In, Out] ref SubscriptionBuiltinTopicDataWrapper data, int handle);