コード例 #1
0
ファイル: Topic.cs プロジェクト: ericyao2013/DDS-OpenSplice
        public ReturnCode SetQos(TopicQos qos)
        {
            ReturnCode result = DDS.ReturnCode.AlreadyDeleted;

            ReportStack.Start();
            if (this.rlReq_isAlive)
            {
                result = QosManager.checkQos(qos);
                if (result == DDS.ReturnCode.Ok)
                {
                    using (OpenSplice.CustomMarshalers.TopicQosMarshaler marshaler =
                               new OpenSplice.CustomMarshalers.TopicQosMarshaler())
                    {
                        result = marshaler.CopyIn(qos);
                        if (result == ReturnCode.Ok)
                        {
                            result = uResultToReturnCode(
                                User.Topic.SetQos(rlReq_UserPeer, marshaler.UserPtr));
                            if (result != ReturnCode.Ok)
                            {
                                ReportStack.Report(result, "Could not apply TopicQos.");
                            }
                        }
                    }
                }
            }
            ReportStack.Flush(this, result != ReturnCode.Ok);

            return(result);
        }
コード例 #2
0
ファイル: Topic.cs プロジェクト: ericyao2013/DDS-OpenSplice
        public ReturnCode GetQos(ref TopicQos qos)
        {
            IntPtr     userQos = IntPtr.Zero;
            ReturnCode result  = DDS.ReturnCode.AlreadyDeleted;

            ReportStack.Start();
            if (this.rlReq_isAlive)
            {
                result = uResultToReturnCode(
                    User.Topic.GetQos(rlReq_UserPeer, ref userQos));
                if (result == ReturnCode.Ok)
                {
                    using (OpenSplice.CustomMarshalers.TopicQosMarshaler marshaler =
                               new OpenSplice.CustomMarshalers.TopicQosMarshaler(userQos, true))
                    {
                        marshaler.CopyOut(ref qos);
                    }
                }
                else
                {
                    ReportStack.Report(result, "Could not copy TopicQos.");
                }
            }
            ReportStack.Flush(this, result != ReturnCode.Ok);

            return(result);
        }
コード例 #3
0
        public ReturnCode GetQos(ref TopicQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.TopicQosMarshaler marshaler =
                       new OpenSplice.CustomMarshalers.TopicQosMarshaler())
            {
                result = Gapi.Topic.get_qos(GapiPeer, marshaler.GapiPtr);
                if (result == ReturnCode.Ok)
                {
                    marshaler.CopyOut(ref qos);
                }
            }

            return(result);
        }
コード例 #4
0
        public ReturnCode SetQos(TopicQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.TopicQosMarshaler marshaler =
                       new OpenSplice.CustomMarshalers.TopicQosMarshaler())
            {
                result = marshaler.CopyIn(qos);
                if (result == DDS.ReturnCode.Ok)
                {
                    result = Gapi.Topic.set_qos(GapiPeer, marshaler.GapiPtr);
                }
            }

            return(result);
        }
コード例 #5
0
        public ReturnCode SetDefaultTopicQos(TopicQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.TopicQosMarshaler marshaler =
                       new OpenSplice.CustomMarshalers.TopicQosMarshaler())
            {
                result = marshaler.CopyIn(qos);
                if (result == ReturnCode.Ok)
                {
                    result = Gapi.DomainParticipant.set_default_topic_qos(
                        GapiPeer,
                        marshaler.GapiPtr);
                }
            }

            return(result);
        }
コード例 #6
0
        public ReturnCode CopyFromTopicQos(ref DataWriterQos dataWriterQos, TopicQos topicQos)
        {
            ReturnCode result = ReturnCode.Ok;

            if (dataWriterQos == null)
            {
                result = GetDefaultDataWriterQos(ref dataWriterQos);
            }

            if (result == ReturnCode.Ok)
            {
                using (OpenSplice.CustomMarshalers.TopicQosMarshaler marshaler =
                           new OpenSplice.CustomMarshalers.TopicQosMarshaler())
                {
                    result = marshaler.CopyIn(topicQos);
                    if (result == ReturnCode.Ok)
                    {
                        using (OpenSplice.CustomMarshalers.DataWriterQosMarshaler dataWriterMarshaler =
                                   new OpenSplice.CustomMarshalers.DataWriterQosMarshaler())
                        {
                            result = dataWriterMarshaler.CopyIn(dataWriterQos);
                            if (result == ReturnCode.Ok)
                            {
                                result = Gapi.Publisher.copy_from_topic_qos(
                                    GapiPeer,
                                    dataWriterMarshaler.GapiPtr,
                                    marshaler.GapiPtr);

                                if (result == ReturnCode.Ok)
                                {
                                    dataWriterMarshaler.CopyOut(ref dataWriterQos);
                                }
                            }
                        }
                    }
                }
            }

            return(result);
        }
コード例 #7
0
        public ITopic CreateTopic(
            string topicName,
            string typeName,
            TopicQos qos,
            ITopicListener listener,
            StatusKind mask)
        {
            ITopic topic = null;

            using (OpenSplice.CustomMarshalers.TopicQosMarshaler marshaler =
                       new OpenSplice.CustomMarshalers.TopicQosMarshaler())
            {
                if (marshaler.CopyIn(qos) == ReturnCode.Ok)
                {
                    if (listener != null)
                    {
                        OpenSplice.Gapi.gapi_topicListener gapiListener;
                        TopicListenerHelper listenerHelper = new TopicListenerHelper();
                        listenerHelper.Listener = listener;
                        listenerHelper.CreateListener(out gapiListener);
                        using (TopicListenerMarshaler listenerMarshaler =
                                   new TopicListenerMarshaler(ref gapiListener))
                        {
                            IntPtr gapiPtr = Gapi.DomainParticipant.create_topic(
                                GapiPeer,
                                topicName,
                                typeName,
                                marshaler.GapiPtr,
                                listenerMarshaler.GapiPtr,
                                mask);
                            if (gapiPtr != IntPtr.Zero)
                            {
                                topic = new Topic(gapiPtr, listenerHelper);
                            }
                        }
                    }
                    else
                    {
                        // Invoke the corresponding gapi function.
                        IntPtr gapiPtr = Gapi.DomainParticipant.create_topic(
                            GapiPeer,
                            topicName,
                            typeName,
                            marshaler.GapiPtr,
                            IntPtr.Zero,
                            mask);

                        if (gapiPtr != IntPtr.Zero)
                        {
                            topic = new Topic(gapiPtr);
                        }
                    }
                }
            }

            if (topic != null)
            {
                DomainParticipantQos dpQos  = null;
                ReturnCode           result = GetQos(ref dpQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        topic.Enable();
                    }
                }
            }

            return(topic);
        }