当前位置: 首页>>代码示例>>C#>>正文


C# DDS类代码示例

本文整理汇总了C#中DDS的典型用法代码示例。如果您正苦于以下问题:C# DDS类的具体用法?C# DDS怎么用?C# DDS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DDS类属于命名空间,在下文中一共展示了DDS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: checkParticipant

    static bool checkParticipant(DDS.DomainParticipant participant)
    {
        DDS.DomainParticipantQos participantQos = new DDS.DomainParticipantQos();
        participant.get_qos(participantQos);

        DDS.PropertySeq properties = participantQos.property_qos.value;

        for (int i = 0; i < properties.length; i++)
        {
            if (String.Compare(properties.get_at(i).name,
                "dds.transport.UDPv4.builtin.send_socket_buffer_size") == 0)
            {
                if (String.Compare(properties.get_at(i).value, NEW_SOCKET_BUFFER_SIZE_STRING)
                     != 0)
                {
                    Console.WriteLine("Error, send_socket_buffer_size...not modified");
                    return false;
                }
            }
            if (String.Compare(properties.get_at(i).name,
                "dds.transport.UDPv4.builtin.recv_socket_buffer_size") == 0)
            {
                string value = properties.get_at(i).value;
                if (String.Compare(properties.get_at(i).value, NEW_SOCKET_BUFFER_SIZE_STRING)
                     != 0)
                {
                    Console.WriteLine("Error, recv_socket_buffer_size...not modified");
                    return false;
                }
            }
        }
        return true;
    }
开发者ID:rosemwahlin,项目名称:rticonnextdds-examples,代码行数:33,代码来源:numbers_publisher.cs

示例2: RequestedDeadlineMissedValid

 public static bool RequestedDeadlineMissedValid(DDS.IDataReader reader, int totalCount
     , int totalCountChange)
 {
     bool result = false;
     DDS.RequestedDeadlineMissedStatus holder = new DDS.RequestedDeadlineMissedStatus();
     DDS.ReturnCode rc = reader.GetRequestedDeadlineMissedStatus(ref holder);
     if (rc == DDS.ReturnCode.Ok)
     {
         DDS.RequestedDeadlineMissedStatus status = holder;
         if (status.TotalCount == totalCount)
         {
             if (status.TotalCountChange == totalCountChange)
             {
                 result = true;
             }
             else
             {
                 System.Console.Error.WriteLine("requested_deadline_missed.TotalCountChange != '"
                      + totalCountChange + "', but '" + status.TotalCountChange + "'.");
             }
         }
         else
         {
             System.Console.Error.WriteLine("requested_deadline_missed.TotalCount != '" + totalCount
                  + "', but '" + status.TotalCount + "'.");
         }
     }
     else
     {
         System.Console.Error.WriteLine("get_requested_deadline_missed_status returned " +
              rc);
     }
     return result;
 }
开发者ID:shizhexu,项目名称:opensplice,代码行数:34,代码来源:StatusValidator.cs

示例3: OnLivelinessChanged

 public virtual void OnLivelinessChanged(DDS.IDataReader reader, DDS.LivelinessChangedStatus
      status)
 {
     
     onLivelinessChangedCalled = true;
     lcStatus = status;
 }
开发者ID:shizhexu,项目名称:opensplice,代码行数:7,代码来源:MyDataReaderListener.cs

示例4: shutdown

    static void shutdown(
        DDS.DomainParticipant participant)
    {
        /* Delete all entities */

        if (participant != null) {
            participant.delete_contained_entities();
            DDS.DomainParticipantFactory.get_instance().delete_participant(
                ref participant);
        }

        /* RTI Connext provides finalize_instance() method on
           domain participant factory for users who want to release memory
           used by the participant factory. Uncomment the following block of
           code for clean destruction of the singleton. */
        /*
        try {
            DDS.DomainParticipantFactory.finalize_instance();
        }
        catch(DDS.Exception e) {
            Console.WriteLine("finalize_instance error {0}", e);
            throw e;
        }
        */
    }
开发者ID:jmlvega,项目名称:rticonnextdds-examples,代码行数:25,代码来源:tbf_subscriber.cs

示例5: Report

 public static extern void Report(
         ReportType type,
         string reportContext,
         string fileName,
         int lineNo,
         DDS.ErrorCode reportCode,
         string description);
开发者ID:xrl,项目名称:opensplice_dds,代码行数:7,代码来源:ErrorInfo.cs

示例6: StatussesValid

 public static bool StatussesValid(DDS.IDataReader reader, int rdmTotalCount, int rdmTotalCountChange
     , int riqsTotalCount, int riqsTotalCountChange, int srTotalCount, int srTotalCountChange
     , int lcActiveCount, int lcActiveCountChange, int lcInactiveCount, int lcInactiveCountChange
     , int smTotalCount, int smTotalCountChange, int slTotalCount, int slTotalCountChange
     )
 {
     bool result = false;
     if (RequestedDeadlineMissedValid(reader, rdmTotalCount, rdmTotalCountChange))
     {
         if (RequestedIncompatibleQosValid(reader, riqsTotalCount, riqsTotalCountChange))
         {
             if (SampleRejectedValid(reader, srTotalCount, srTotalCountChange))
             {
                 if (LivelinessChangedValid(reader, lcActiveCount, lcActiveCountChange, lcInactiveCount
                     , lcInactiveCountChange))
                 {
                     if (SubscriptionMatchValid(reader, smTotalCount, smTotalCountChange))
                     {
                         if (SampleLostValid(reader, slTotalCount, slTotalCountChange))
                         {
                             result = true;
                         }
                     }
                 }
             }
         }
     }
     return result;
 }
开发者ID:shizhexu,项目名称:opensplice,代码行数:29,代码来源:StatusValidator.cs

示例7: create_type_code

    private static DDS.TypeCode create_type_code(DDS.TypeCodeFactory tcf)
    {
        DDS.UnionMemberSeq members = new DDS.UnionMemberSeq();

        /* First, we create the typeCode for a union */
        /* Default-member index refers to which member of the union
         * will be the default one. In this example index = 1 refers
         * to the the member 'aLong'. Take into account that index
         * starts in 0 */
        try {
            DDS.TypeCode unionTC = tcf.create_union_tc("Foo",
                DDS.ExtensibilityKind.MUTABLE_EXTENSIBILITY,
                DDS.TypeCode.TC_LONG,
                1, /* default-member index */
                members); /* For now, it does not have any member */

            /* Case 1 will be a short named aShort */
            unionTC.add_member("aShort", DDS.DynamicData.MEMBER_ID_UNSPECIFIED,
                    DDS.TypeCode.TC_SHORT, DDS.TypeCode.NONKEY_MEMBER);

            /* Case 2, the default, will be a long named aLong */
            unionTC.add_member("aLong", 2, DDS.TypeCode.TC_LONG,
                    DDS.TypeCode.NONKEY_MEMBER);

            /* Case 3 will be a double named aDouble */
            unionTC.add_member("aDouble", 3, DDS.TypeCode.TC_DOUBLE,
                    DDS.TypeCode.NONKEY_MEMBER);

            return unionTC;
        } catch (Exception e) {
            Console.WriteLine("register_type error {0}", e);
            return null;
        }
    }
开发者ID:jmlvega,项目名称:rticonnextdds-examples,代码行数:34,代码来源:dynamic_data_union_example.cs

示例8: on_data_available

    public override void on_data_available( DDS.DataReader reader )
    {
        DDS.PublicationBuiltinTopicDataDataReader builtin_reader =
                (DDS.PublicationBuiltinTopicDataDataReader)reader;

        try {
            builtin_reader.take(
                data_seq,
                info_seq,
                DDS.ResourceLimitsQosPolicy.LENGTH_UNLIMITED,
                DDS.SampleStateKind.ANY_SAMPLE_STATE,
                DDS.ViewStateKind.ANY_VIEW_STATE,
                DDS.InstanceStateKind.ANY_INSTANCE_STATE);
        } catch (DDS.Retcode_NoData) {
            return;
        } catch (DDS.Exception e) {
            Console.WriteLine("take error {0}", e);
            return;
        }

        System.Int32 data_length = data_seq.length;
        for (int i = 0; i < data_length; ++i) {

            if (!info_seq.get_at(i).valid_data) {
                continue;
            }
            Console.WriteLine("-----");
            Console.WriteLine("Found topic \"{0}\"",
                data_seq.get_at(i).topic_name);
            Console.WriteLine("participant: {0:x8}{1:x8}{2:x8}",
                data_seq.get_at(i).participant_key.value1,
                data_seq.get_at(i).participant_key.value2,
                data_seq.get_at(i).participant_key.value3);
            Console.WriteLine("datawriter: {0:x8}{1:x8}{2:x8}",
                data_seq.get_at(i).key.value1,
                data_seq.get_at(i).key.value2,
                data_seq.get_at(i).key.value3);
            Console.WriteLine("type:");

            if (data_seq.get_at(i).type_code == null) {
                Console.WriteLine("No type code received, perhaps increase " +
                    "type_code_max_serialized_length?");
                continue;
            }
            /* Using the type_code propagated we print the data type
             * with print_IDL(). */
            try {
                data_seq.get_at(i).type_code.print_IDL(2);
            } catch (DDS.Exception) {
                Console.WriteLine("error printing IDL");
            }
        }

        try {
            builtin_reader.return_loan(data_seq, info_seq);
        } catch (DDS.Exception e) {
            Console.WriteLine("return loan error {0}", e);
        }
    }
开发者ID:jmlvega,项目名称:rticonnextdds-examples,代码行数:59,代码来源:msg_subscriber.cs

示例9: poll_data

    /* Start changes for Ordered_Presentation*/
    /* No listener is needed; we poll readers in this function */
    private static void poll_data(DDS.DataReader[] reader, int numreaders)
    {
        DDS.SampleInfoSeq info_seq = new DDS.SampleInfoSeq();
        orderedSeq data_seq = new orderedSeq();

        for (int r = 0; r < numreaders; ++r) {
            try {
                ((orderedDataReader)(reader[r])).take(
                    data_seq,
                    info_seq,
                    DDS.ResourceLimitsQosPolicy.LENGTH_UNLIMITED,
                    DDS.SampleStateKind.ANY_SAMPLE_STATE,
                    DDS.ViewStateKind.ANY_VIEW_STATE,
                    DDS.InstanceStateKind.ANY_INSTANCE_STATE);
            } catch (DDS.Retcode_NoData) {
                // Not an error
                return;
            } catch (DDS.Exception e) {
                // Is an error
                Console.WriteLine("take error {0}", e);
                return;
            }

            System.Int32 data_length = data_seq.length;
            for (int i = 0; i < data_length; ++i) {
                if (!info_seq.get_at(i).valid_data) {
                    continue;
                }
                // Make things a bit easier to read.
                int ident = r;
                while (ident-- != 0) {
                    Console.Write("\t");
                }
                Console.WriteLine("Reader {0}: Instance{1}->value = {2}", r,
                    data_seq.get_at(i).id, data_seq.get_at(i).value);
            }

            try {
                ((orderedDataReader)(reader[r])).return_loan(data_seq,
                        info_seq);
            } catch (DDS.Exception e) {
                Console.WriteLine("return loan error {0}", e);
            }

            info_seq.ensure_length(0, 0);
            data_seq.ensure_length(0, 0);
        }
    }
开发者ID:jmlvega,项目名称:rticonnextdds-examples,代码行数:50,代码来源:ordered_subscriber.cs

示例10: CopyIn

 internal static DDS.ReturnCode CopyIn(
         DDS.OfferedIncompatibleQosStatus from, 
         IntPtr to, 
         int offset)
 {
     DDS.ReturnCode result = DDS.ReturnCode.Ok;
     if (from != null) {
         Write(to, offset_total_count, from.TotalCount);
         Write(to, offset_total_count_change, from.TotalCountChange);
         Write(to, offset_last_policy_id, (int) from.LastPolicyId);
         result = QosPolicyCountSequenceMarshaler.CopyIn(from.Policies, to, offset_policies);
     } else {
         result = DDS.ReturnCode.BadParameter;
         DDS.OpenSplice.OS.Report(
                 DDS.OpenSplice.ReportType.OS_ERROR,
                 "DDS.OpenSplice.CustomMarshalers.OfferedIncompatibleQosStatusMarshaler.CopyIn",
                 "DDS/OpenSplice/CustomMarshalers/StatusMarshalers.cs",
                 DDS.ErrorCode.InvalidValue,
                 "OfferedIncompatibleQosStatus attribute may not be a null pointer.");
     }
     return result; 
 }
开发者ID:shizhexu,项目名称:opensplice,代码行数:22,代码来源:StatusMarshaler.cs

示例11: on_data_available

        public override void on_data_available(DDS.DataReader reader)
        {
            /* We need to create a DynamicDataReader to receive the DynamicData
             */
            DDS.DynamicDataReader DynamicData_reader =
                (DDS.DynamicDataReader)reader;

            try {
                DynamicData_reader.take(
                    data_seq,
                    info_seq,
                    DDS.ResourceLimitsQosPolicy.LENGTH_UNLIMITED,
                    DDS.SampleStateKind.ANY_SAMPLE_STATE,
                    DDS.ViewStateKind.ANY_VIEW_STATE,
                    DDS.InstanceStateKind.ANY_INSTANCE_STATE);
            }
            catch(DDS.Retcode_NoData) {
                return;
            }
            catch(DDS.Exception e) {
                Console.WriteLine("take error {0}", e);
                return;
            }

            System.Int32 data_length = data_seq.length;
            for (int i = 0; i < data_length; ++i) {
                if (info_seq.get_at(i).valid_data) {
                    data_seq.get_at(i).print(1);
                }
            }

            try {
                DynamicData_reader.return_loan(data_seq, info_seq);
            }
            catch(DDS.Exception e) {
                Console.WriteLine("return loan error {0}", e);
            }
        }
开发者ID:hakiri,项目名称:rticonnextdds-examples,代码行数:38,代码来源:Shapes_subscriber.cs

示例12: GetDiscoveredTopicData

 public ReturnCode GetDiscoveredTopicData(
     ref DDS.TopicBuiltinTopicData[] topic_data,
     long topic_handle)
 {
     throw new System.NotImplementedException();
     //return realParticipant.get_discovered_topic_data(
     //        topic_data, topic_handle);
 }
开发者ID:xrl,项目名称:opensplice_dds,代码行数:8,代码来源:ExtDomainParticipant.cs

示例13: on_data_available

        public override void on_data_available( DDS.DataReader reader )
        {
            sequencesDataReader sequences_reader =
                (sequencesDataReader)reader;

            try {
                sequences_reader.take(
                    data_seq,
                    info_seq,
                    DDS.ResourceLimitsQosPolicy.LENGTH_UNLIMITED,
                    DDS.SampleStateKind.ANY_SAMPLE_STATE,
                    DDS.ViewStateKind.ANY_VIEW_STATE,
                    DDS.InstanceStateKind.ANY_INSTANCE_STATE);
            } catch (DDS.Retcode_NoData) {
                return;
            } catch (DDS.Exception e) {
                Console.WriteLine("take error {0}", e);
                return;
            }

            System.Int32 data_length = data_seq.length;
            for (int i = 0; i < data_length; ++i) {
                if (info_seq.get_at(i).valid_data) {
                    sequencesTypeSupport.print_data(data_seq.get_at(i));
                }
            }

            try {
                sequences_reader.return_loan(data_seq, info_seq);
            } catch (DDS.Exception e) {
                Console.WriteLine("return loan error {0}", e);
            }
        }
开发者ID:jmlvega,项目名称:rticonnextdds-examples,代码行数:33,代码来源:sequences_subscriber.cs

示例14: on_data_available

        /**** Start changes for Advanced_Keys ****/
        public override void on_data_available(DDS.DataReader reader)
        {
            keysDataReader keys_reader =
                (keysDataReader)reader;

            //// Start changes for Advanced_Keys

            while (true)
            {
                /* Given DDS_HANDLE_NIL as a parameter, take_next_instance returns
                a sequence containing samples from only the next (in a well-determined
                but unspecified order) un-taken instance.
                */

                try
                {
                    keys_reader.take_next_instance(
                        data_seq,
                        info_seq,
                        DDS.ResourceLimitsQosPolicy.LENGTH_UNLIMITED,
                        ref DDS.InstanceHandle_t.HANDLE_NIL,
                        DDS.SampleStateKind.ANY_SAMPLE_STATE,
                        DDS.ViewStateKind.ANY_VIEW_STATE,
                        DDS.InstanceStateKind.ANY_INSTANCE_STATE);
                }
                catch (DDS.Retcode_NoData)
                {
                    break;
                }
                catch (DDS.Exception e)
                {
                    Console.WriteLine("take error {0}", e);
                    return;
                }

                System.Int32 data_length = data_seq.length;
                /* We process all the obtained samples for a particular instance */
                for (int i = 0; i < data_length; ++i)
                {
                    /* We first check if the sample includes valid data */
                    if (info_seq.get_at(i).valid_data)
                    {
                        if (info_seq.get_at(i).view_state == DDS.ViewStateKind.NEW_VIEW_STATE)
                        {
                            new_instance_found(keys_reader, info_seq.get_at(i), data_seq.get_at(i));
                        }

                        /* We check if the obtained samples are associated to one
                        of the instances of interest.
                        Since take_next_instance gives sequences of the same instance,
                        we only need to test this for the first sample obtained.
                        */
                        if (i == 0 && !key_is_relevant(data_seq.get_at(i)))
                        {
                            break;
                        }

                        handle_data(keys_reader, info_seq.get_at(i), data_seq.get_at(i));
                    }
                    else
                    {
                        /* Since there is not valid data, it may include metadata */
                        keys dummy = null; ;

                        dummy = keysTypeSupport.create_data();
                        if (dummy == null)
                        {
                            throw new ApplicationException(
                            "keysTypeSupport.create_data error");
                        }

                        DDS.InstanceHandle_t handle = info_seq.get_at(i).instance_handle;

                        try
                        {
                            keys_reader.get_key_value(dummy, ref handle);
                        }
                        catch (DDS.Exception e)
                        {
                            Console.WriteLine(" get_key_value error {0}", e);
                        }

                        /* Here we print a message and change the instance state
                        if the instance state is ALIVE_NO_WRITERS or ALIVE_DISPOSED */
                        if (info_seq.get_at(i).instance_state == DDS.InstanceStateKind.NOT_ALIVE_NO_WRITERS_INSTANCE_STATE)
                        {
                            instance_lost_writers(keys_reader, info_seq.get_at(i), dummy);
                        }
                        else if (info_seq.get_at(i).instance_state == DDS.InstanceStateKind.NOT_ALIVE_DISPOSED_INSTANCE_STATE)
                        {
                            instance_disposed(keys_reader, info_seq.get_at(i), dummy);
                        }
                    }
                }

                try
                {
                    keys_reader.return_loan(data_seq, info_seq);
                }
//.........这里部分代码省略.........
开发者ID:jmlvega,项目名称:rticonnextdds-examples,代码行数:101,代码来源:keys_subscriber.cs

示例15: on_data_available

        public override void on_data_available(DDS.DataReader reader)
        {
            keysDataReader keys_reader =
                (keysDataReader)reader;

            try {
                keys_reader.take(
                    data_seq,
                    info_seq,
                    DDS.ResourceLimitsQosPolicy.LENGTH_UNLIMITED,
                    DDS.SampleStateKind.ANY_SAMPLE_STATE,
                    DDS.ViewStateKind.ANY_VIEW_STATE,
                    DDS.InstanceStateKind.ANY_INSTANCE_STATE);
            }
            catch(DDS.Retcode_NoData) {
                return;
            }
            catch(DDS.Exception e) {
                Console.WriteLine("take error {0}", e);
                return;
            }

            System.Int32 data_length = data_seq.length;
            for (int i = 0; i < data_length; ++i)
            {
                /* Start changes for Keyed_Data */
                /* We first check if the sample includes valid data */
                if (info_seq.get_at(i).valid_data)
                {
                    if (info_seq.get_at(i).view_state ==
                        DDS.ViewStateKind.NEW_VIEW_STATE)
                    {
                        Console.WriteLine("Found new instance; code = {0}",
                            data_seq.get_at(i).code);
                    }

                    Console.WriteLine("Instance {0}: x: {1}, y: {2}",
                        data_seq.get_at(i).code, data_seq.get_at(i).x,
                        data_seq.get_at(i).y);
                }
                else
                {
                    /* Since there is not valid data, it may include metadata */
                    keys dummy = new keys();
                    try
                    {
                        DDS.InstanceHandle_t temp =
                            info_seq.get_at(i).instance_handle;
                        keys_reader.get_key_value(dummy, ref temp);
                    }
                    catch (DDS.Exception e)
                    {
                        Console.WriteLine("get_key_value error {0}", e);
                    }

                    /* Here we print a message if the instance state is ALIVE_NO_WRITERS or ALIVE_DISPOSED */
                    if (info_seq.get_at(i).instance_state ==
                        DDS.InstanceStateKind.NOT_ALIVE_NO_WRITERS_INSTANCE_STATE)
                    {
                        Console.WriteLine("Instance {0} has no writers",
                            dummy.code);
                    }
                    else if (info_seq.get_at(i).instance_state ==
                        DDS.InstanceStateKind.NOT_ALIVE_DISPOSED_INSTANCE_STATE)
                    {
                        Console.WriteLine("Instance {0} disposed",
                            dummy.code);
                    }
                }
                /* End changes for Keyed_Data */
            }

            try {
                keys_reader.return_loan(data_seq, info_seq);
            }
            catch(DDS.Exception e) {
                Console.WriteLine("return loan error {0}", e);
            }
        }
开发者ID:hakiri,项目名称:rticonnextdds-examples,代码行数:79,代码来源:keys_subscriber.cs


注:本文中的DDS类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。