Beispiel #1
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;
        }
Beispiel #2
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);
        }
Beispiel #3
0
        public ITopic CreateTopic(
                string topicName,
                string typeName,
                ITopicListener listener,
                StatusKind mask)
        {
            ITopic topic = null;

            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,
                            Gapi.NativeConstants.GapiTopicQosDefault,
                            listenerMarshaler.GapiPtr,
                            mask);
                    if (gapiPtr != IntPtr.Zero)
                    {
                        topic = new Topic(gapiPtr, listenerHelper);
                    }
                }
            }
            else
            {
                IntPtr gapiPtr = Gapi.DomainParticipant.create_topic(
                        GapiPeer,
                        topicName,
                        typeName,
                        Gapi.NativeConstants.GapiTopicQosDefault,
                        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;
        }
Beispiel #4
0
        public ITopic CreateTopic(
            string topicName,
            string typeName,
            ITopicListener listener,
            StatusKind mask)
        {
            ITopic topic = null;

            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,
                        Gapi.NativeConstants.GapiTopicQosDefault,
                        listenerMarshaler.GapiPtr,
                        mask);
                    if (gapiPtr != IntPtr.Zero)
                    {
                        topic = new Topic(gapiPtr, listenerHelper);
                    }
                }
            }
            else
            {
                IntPtr gapiPtr = Gapi.DomainParticipant.create_topic(
                    GapiPeer,
                    topicName,
                    typeName,
                    Gapi.NativeConstants.GapiTopicQosDefault,
                    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);
        }
Beispiel #5
0
 internal Topic(IntPtr gapiPtr, TopicListenerHelper listenerHelper)
     : base(gapiPtr)
 {
     // Base class handles everything.
     this.listenerHelper = listenerHelper;
 }
Beispiel #6
0
 internal Topic(IntPtr gapiPtr)
     : base(gapiPtr)
 {
     // Base class handles everything.
     listenerHelper = new TopicListenerHelper();
 }
Beispiel #7
0
 internal Topic(IntPtr gapiPtr, TopicListenerHelper listenerHelper)
     : base(gapiPtr)
 {
     // Base class handles everything.
     this.listenerHelper = listenerHelper;
 }
Beispiel #8
0
 internal Topic(IntPtr gapiPtr)
     : base(gapiPtr)
 {
     // Base class handles everything.
     listenerHelper = new TopicListenerHelper();
 }