Exemple #1
0
        /// <summary>
        /// This operation gets the default DomainParticipantQos of the DomainParticipantFactory
        /// </summary>
        /// <remarks>
        /// This operation gets the default DomainParticipantQos of the
        /// DomainParticipantFactory (that is the struct with the QosPolicy settings)
        /// which is used for newly created IDomainParticipant objects, in case no QoS is used
        /// in the CreateParticipant operation.
        ///
        /// The application must provide the DomainParticipantQos struct in which the
        /// QosPolicy settings can be stored and provide a reference to the struct. The
        /// operation writes the default QosPolicy settings to the struct referenced to by qos.<br>
        /// Any settings in the struct are overwritten.<br>
        /// The values retrieved by this operation match the set of values specified on the last
        /// successful call to SetDefaultParticipantQos(), or, if the call was never
        /// made, the default values as specified for each QosPolicy setting.
        /// </remarks>
        /// @param qos A reference to the DomainParticipantQos in which the default
        ///            DomainParticipantQos for the IDomainParticipant is written
        /// @return DDS.ReturnCode Ok - The new default DomainParticipantQos is set
        /// @return DDS.ReturnCode Error - An internal error has occured
        /// @return DDS.ReturnCode OutOfResources - The DDS ran out of resources to complete this operation
        public ReturnCode GetDefaultParticipantQos(ref DomainParticipantQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
                       new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                lock (singleton_lock)
                {
                    ReportStack.Start();
                    result = marshaler.CopyIn(defaultParticipantQos);
                    if (result == ReturnCode.Ok)
                    {
                        marshaler.CopyOut(ref qos);
                        // Listener scheduling qospolicy is not part of User Layer, so obtain it separately from participant.
                        if (qos.ListenerScheduling.SchedulingClass == null)
                        {
                            qos.ListenerScheduling.SchedulingClass = new SchedulingClassQosPolicy();
                        }
                        qos.ListenerScheduling.SchedulingClass.Kind = this.defaultParticipantQos.ListenerScheduling.SchedulingClass.Kind;
                        if (qos.ListenerScheduling.SchedulingPriorityKind == null)
                        {
                            qos.ListenerScheduling.SchedulingPriorityKind = new SchedulingPriorityQosPolicy();
                        }
                        qos.ListenerScheduling.SchedulingPriorityKind.Kind = this.defaultParticipantQos.ListenerScheduling.SchedulingPriorityKind.Kind;
                        qos.ListenerScheduling.SchedulingPriority          = this.defaultParticipantQos.ListenerScheduling.SchedulingPriority;
                    }
                    ReportStack.Flush(null, result != ReturnCode.Ok);
                }
            }

            return(result);
        }
Exemple #2
0
        /// @cond
        /// Constructor for DomainParticipantFactory.
        /// Only to be used by the static <code>GetInstance</code> operation.
        protected DomainParticipantFactory()
        {
            DDS.ReturnCode result;

            // Init default ParticipantFactoryQos and default ParticipantQos.
            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
                       new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                result = marshaler.CopyIn(QosManager.defaultDomainParticipantQos);
                if (result == ReturnCode.Ok)
                {
                    marshaler.CopyOut(ref defaultParticipantQos);
                }
            }
            myQos.EntityFactory = new EntityFactoryQosPolicy();
            myQos.EntityFactory.AutoenableCreatedEntities = true;
        }
        public ReturnCode SetDefaultParticipantQos(DomainParticipantQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
                       new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                result = marshaler.CopyIn(qos);
                if (result == ReturnCode.Ok)
                {
                    // Invoke the corresponding gapi function.
                    result = OpenSplice.Gapi.DomainParticipantFactory.set_default_participant_qos(
                        GapiPeer,
                        marshaler.GapiPtr);
                }
            }
            return(result);
        }
        public ReturnCode GetDefaultParticipantQos(ref DomainParticipantQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
                       new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                // Invoke the corresponding gapi function.
                result = OpenSplice.Gapi.DomainParticipantFactory.get_default_participant_qos(GapiPeer, marshaler.GapiPtr);

                // When no error occured, copy the QoS settings from the gapi Qos representation.
                if (result == ReturnCode.Ok)
                {
                    marshaler.CopyOut(ref qos);
                }
            }

            return(result);
        }
Exemple #5
0
        /// <summary>
        /// This operation sets the default DomainParticipantQos of the DomainParticipantFactory.
        /// </summary>
        /// <remarks>
        /// This operation sets the default DomainParticipantQos of the DomainParticipantFactory
        /// (that is the struct with the QosPolicy settings) which is used for newly created
        /// IDomainParticipant objects, in case no QoS was provided in the CreateParticipant operation.
        ///
        /// The DomainParticipantQos is always self consistent, because its policies do not
        /// depend on each other. <br>
        /// This means this operation never returns the ReturnCode InconsistentPolicy.
        ///
        /// The values set by this operation are returned by GetDefaultParticipantQos().
        /// </remarks>
        /// @param qos The DomainParticipantQos which contains the new default
        ///            DomainParticipantQos for the newly created DomainParticipants
        /// @return DDS.ReturnCode Ok - The new default DomainParticipantQos is set
        /// @return DDS.ReturnCode Error - An internal error has occured
        /// @return DDS.ReturnCode OutOfResources - The DDS ran out of resources to complete this operation
        public ReturnCode SetDefaultParticipantQos(DomainParticipantQos qos)
        {
            ReturnCode result;

            lock (singleton_lock)
            {
                ReportStack.Start();
                result = QosManager.checkQos(qos);
                if (result == DDS.ReturnCode.Ok)
                {
                    using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
                               new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
                    {
                        result = marshaler.CopyIn(qos);
                        if (result == ReturnCode.Ok)
                        {
                            marshaler.CopyOut(ref defaultParticipantQos);
                            // Listener scheduling qospolicy is not part of User Layer, so obtain it separately from participant.
                            if (qos.ListenerScheduling.SchedulingClass == null)
                            {
                                return(ReturnCode.BadParameter);
                            }
                            this.defaultParticipantQos.ListenerScheduling.SchedulingClass.Kind = qos.ListenerScheduling.SchedulingClass.Kind;
                            if (qos.ListenerScheduling.SchedulingPriorityKind == null)
                            {
                                return(ReturnCode.BadParameter);
                            }
                            this.defaultParticipantQos.ListenerScheduling.SchedulingPriorityKind.Kind = qos.ListenerScheduling.SchedulingPriorityKind.Kind;
                            this.defaultParticipantQos.ListenerScheduling.SchedulingPriority          = qos.ListenerScheduling.SchedulingPriority;
                        }
                    }
                }
                ReportStack.Flush(null, result != ReturnCode.Ok);
            }
            return(result);
        }
        public ReturnCode GetDefaultParticipantQos(ref DomainParticipantQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler = 
                    new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                // Invoke the corresponding gapi function.
                result = OpenSplice.Gapi.DomainParticipantFactory.get_default_participant_qos(GapiPeer, marshaler.GapiPtr);

                // When no error occured, copy the QoS settings from the gapi Qos representation.
                if (result == ReturnCode.Ok)
                {
                    marshaler.CopyOut(ref qos);
                }
            }

            return result;
        }
        public ReturnCode SetDefaultParticipantQos(DomainParticipantQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler = 
                    new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                result = marshaler.CopyIn(qos);
                if (result == ReturnCode.Ok)
                {
                    // Invoke the corresponding gapi function.
                    result = OpenSplice.Gapi.DomainParticipantFactory.set_default_participant_qos(
                            GapiPeer,
                            marshaler.GapiPtr);
                }
            }
            return result;
        }
        public IDomainParticipant CreateParticipant(
            DomainId domainId,
            DomainParticipantQos qos,
            IDomainParticipantListener listener,
            StatusKind mask)
        {
            IDomainParticipant participant = null;
            string className = null;

            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler = 
                    new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                if (marshaler.CopyIn(qos) == ReturnCode.Ok)
                {
                    if (listener != null)
                    {
                        OpenSplice.Gapi.gapi_domainParticipantListener gapiListener;
                        DomainParticipantListenerHelper listenerHelper = new DomainParticipantListenerHelper();
                        listenerHelper.Listener = listener;
                        listenerHelper.CreateListener(out gapiListener);
                        using (DomainParticipantListenerMarshaler listenerMarshaler = 
                                new DomainParticipantListenerMarshaler(ref gapiListener))
                        {
                            // Invoke the corresponding gapi function.
                            IntPtr gapiParticipant = OpenSplice.Gapi.DomainParticipantFactory.create_participant(
                                    GapiPeer,
                                    domainId,
                                    marshaler.GapiPtr,
                                    listenerMarshaler.GapiPtr,
                                    mask,
                                    IntPtr.Zero,
                                    IntPtr.Zero,
                                    IntPtr.Zero,
                                    className);
                            if (gapiParticipant != IntPtr.Zero)
                            {
                                participant = new OpenSplice.DomainParticipant(gapiParticipant, listenerHelper);
                            }
                        }
                    }
                    else
                    {
                        // Invoke the corresponding gapi function.
                        IntPtr gapiParticipant = OpenSplice.Gapi.DomainParticipantFactory.create_participant(
                            GapiPeer,
                            domainId,
                            marshaler.GapiPtr,
                            IntPtr.Zero,
                            mask,
                            IntPtr.Zero,
                            IntPtr.Zero,
                            IntPtr.Zero,
                            className);
                        if (gapiParticipant != IntPtr.Zero)
                        {
                            participant = new OpenSplice.DomainParticipant(gapiParticipant);
                        }
                    }
                }
            }

            if (participant != null)
            {
                DomainParticipantFactoryQos dpfQos = null;
                ReturnCode result = GetQos(ref dpfQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpfQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        participant.Enable();
                    }
                }
            }       
                
            return participant;
        }
Exemple #9
0
        public ReturnCode GetQos(ref DomainParticipantQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
                    new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                result = Gapi.DomainParticipant.get_qos(
                        GapiPeer,
                        marshaler.GapiPtr);

                if (result == ReturnCode.Ok)
                {
                    marshaler.CopyOut(ref qos);
                }
            }

            return result;
        }
        public IDomainParticipant CreateParticipant(
            string domainId,
            DomainParticipantQos qos,
            IDomainParticipantListener listener,
            StatusKind mask)
        {
            IDomainParticipant participant = null;

            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
                       new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                if (marshaler.CopyIn(qos) == ReturnCode.Ok)
                {
                    if (listener != null)
                    {
                        OpenSplice.Gapi.gapi_domainParticipantListener gapiListener;
                        DomainParticipantListenerHelper listenerHelper = new DomainParticipantListenerHelper();
                        listenerHelper.Listener = listener;
                        listenerHelper.CreateListener(out gapiListener);
                        using (DomainParticipantListenerMarshaler listenerMarshaler =
                                   new DomainParticipantListenerMarshaler(ref gapiListener))
                        {
                            // Invoke the corresponding gapi function.
                            IntPtr gapiParticipant = OpenSplice.Gapi.DomainParticipantFactory.create_participant(
                                GapiPeer,
                                domainId,
                                marshaler.GapiPtr,
                                listenerMarshaler.GapiPtr,
                                mask,
                                IntPtr.Zero,
                                IntPtr.Zero,
                                IntPtr.Zero);
                            if (gapiParticipant != IntPtr.Zero)
                            {
                                participant = new OpenSplice.DomainParticipant(gapiParticipant, listenerHelper);
                            }
                        }
                    }
                    else
                    {
                        // Invoke the corresponding gapi function.
                        IntPtr gapiParticipant = OpenSplice.Gapi.DomainParticipantFactory.create_participant(
                            GapiPeer,
                            domainId,
                            marshaler.GapiPtr,
                            IntPtr.Zero,
                            mask,
                            IntPtr.Zero,
                            IntPtr.Zero,
                            IntPtr.Zero);
                        if (gapiParticipant != IntPtr.Zero)
                        {
                            participant = new OpenSplice.DomainParticipant(gapiParticipant);
                        }
                    }
                }
            }

            if (participant != null)
            {
                DomainParticipantFactoryQos dpfQos = null;
                ReturnCode result = GetQos(ref dpfQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpfQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        participant.Enable();
                    }
                }
            }

            return(participant);
        }