Exemplo n.º 1
0
        /// <summary>
        /// Sets a default value of the <see cref="Publisher" /> QoS policies which will be used for newly created <see cref="Publisher" /> entities in the
        /// case where the QoS policies are defaulted in the CreatePublisher operation.
        /// </summary>
        /// <remarks>
        /// This operation will check that the resulting policies are self consistent; if they are not, the operation will have no effect and
        /// return <see cref="ReturnCode.InconsistentPolicy" />.
        /// </remarks>
        /// <param name="qos">The default <see cref="PublisherQos" /> to be set.</param>
        /// <returns>The <see cref="ReturnCode" /> that indicates the operation result.</returns>
        public ReturnCode SetDefaultDataWriterQos(DataWriterQos qos)
        {
            if (qos is null)
            {
                return(ReturnCode.BadParameter);
            }

            var qosNative = qos.ToNative();
            var ret       = UnsafeNativeMethods.SetDefaultDataWriterQos(_native, qosNative);

            qos.Release();

            return(ret);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the <see cref="DataWriter" /> QoS policies.
        /// </summary>
        /// <param name="qos">The <see cref="DataWriterQos" /> to be filled up.</param>
        /// <returns>The <see cref="ReturnCode" /> that indicates the operation result.</returns>
        public ReturnCode GetQos(DataWriterQos qos)
        {
            if (qos == null)
            {
                return(ReturnCode.BadParameter);
            }

            DataWriterQosWrapper qosWrapper = default;
            var ret = UnsafeNativeMethods.GetQos64(_native, ref qosWrapper);

            if (ret == ReturnCode.Ok)
            {
                qos.FromNative(qosWrapper);
            }

            qos.Release();

            return(ret);
        }