Example #1
0
        internal TopicBuiltinTopicDataWrapper ToNative()
        {
            if (toRelease == null)
            {
                toRelease = new List <IntPtr>();
            }

            var data = new TopicBuiltinTopicDataWrapper
            {
                Deadline          = Deadline,
                DestinationOrder  = DestinationOrder,
                Durability        = Durability,
                DurabilityService = DurabilityService,
                Key               = Key,
                LatencyBudget     = LatencyBudget,
                Lifespan          = Lifespan,
                Liveliness        = Liveliness,
                Ownership         = Ownership,
                Reliability       = Reliability,
                History           = History,
                ResourceLimits    = ResourceLimits,
                TransportPriority = TransportPriority,
            };

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

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

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

            return(data);
        }
Example #2
0
        internal void FromNative(TopicBuiltinTopicDataWrapper 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;
            Reliability       = wrapper.Reliability;
            History           = wrapper.History;
            ResourceLimits    = wrapper.ResourceLimits;
            TransportPriority = wrapper.TransportPriority;

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

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

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