示例#1
0
        internal void FromNative(PublicationBuiltinTopicDataWrapper wrapper)
        {
            Deadline          = wrapper.Deadline;
            DestinationOrder  = wrapper.DestinationOrder;
            Durability        = wrapper.Durability;
            DurabilityService = wrapper.DurabilityService;
            Key               = wrapper.Key;
            LatencyBudget     = wrapper.LatencyBudget;
            Lifespan          = wrapper.Lifespan;
            Liveliness        = wrapper.Liveliness;
            Ownership         = wrapper.Ownership;
            OwnershipStrength = wrapper.OwnershipStrength;
            ParticipantKey    = wrapper.ParticipantKey;
            Presentation      = wrapper.Presentation;
            Reliability       = wrapper.Reliability;

            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 PublicationBuiltinTopicDataWrapper ToNative()
        {
            if (toRelease == null)
            {
                toRelease = new List <IntPtr>();
            }

            var data = new PublicationBuiltinTopicDataWrapper
            {
                Deadline          = Deadline,
                DestinationOrder  = DestinationOrder,
                Durability        = Durability,
                DurabilityService = DurabilityService,
                Key               = Key,
                LatencyBudget     = LatencyBudget,
                Lifespan          = Lifespan,
                Liveliness        = Liveliness,
                Ownership         = Ownership,
                OwnershipStrength = OwnershipStrength,
                ParticipantKey    = ParticipantKey,
                Presentation      = Presentation,
                Reliability       = Reliability,
            };

            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>
        /// This operation retrieves information on a publication that is currently "associated" with the <see cref="DataReader" />; that is, a publication
        /// 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" /> IgnorePublication operation.
        /// </summary>
        /// <remarks>
        /// The publicationHandle must correspond to a publication currently associated with the <see cref="DataReader" /> otherwise the operation
        /// will fail and return <see cref="ReturnCode.BadParameter" />. The operation GetMatchedPublications can be used to find the publications that
        /// are currently matched with the <see cref="DataReader" />.
        /// </remarks>
        /// <param name="publicationHandle">The <see cref="InstanceHandle" /> of the publication data requested.</param>
        /// <param name="publicationData">The <see cref="PublicationBuiltinTopicData" /> structure to be filled up.</param>
        /// <returns>The <see cref="ReturnCode" /> that indicates the operation result.</returns>
        public ReturnCode GetMatchedPublicationData(InstanceHandle publicationHandle, ref PublicationBuiltinTopicData publicationData)
        {
            PublicationBuiltinTopicDataWrapper data = default;

            ReturnCode ret = UnsafeNativeMethods.GetMatchedPublicationData(_native, ref data, publicationHandle);

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

            return(ret);
        }
示例#4
0
 public static extern ReturnCode GetMatchedPublicationData(IntPtr dw, [MarshalAs(UnmanagedType.Struct), In, Out] ref PublicationBuiltinTopicDataWrapper data, int handle);