ddsutil module

DDS descriptor utility module

Main purpose of this module is to provide methods to convert DDS descriptor to Python classes dynamically.

Users can use IDL file as an input to generate classes

class ddsutil.GeneratedClassInfo(data_cls, type_support_cls, nested_types)

Bases: object

Place holder for generated classes

Variables:
  • topic_data_class – Topic data class
  • type_support_class – Type support class
__init__(data_cls, type_support_cls, nested_types)
get_class(type_info)

Return classes created dynamically

Parameters:type_info (string) – struct identifier (.e.g, “test::basic::inner_struct”)
register_topic(dp, name, qos)

Register topic for generated topic data class

Parameters:
  • dp (DomainParticipant) – Domain participant
  • name (string) – topic name
  • qos (Qos) – topic QoS
Return type:

Topic

Returns:

topic

ddsutil.get_dds_classes_from_idl(idl_path, type_info)

Create DDS topic data class and DDS type support class from the given IDL file source.

Parameters:
  • idl_path (string) – path to IDL file
  • type_info (string) – struct module (e.g., test::basic::my_struct)
Return type:

GeneratedClassInfo

Returns:

GeneratedClassInfo

Examples:
gen_info = dds_class(“sample.idl”, “basic::test::Type1”, “long_1”)
class ddsutil.TopicDataClass(member_names=[])

Bases: object

Abstract topic data class. Generated classes inherits this base class.

__init__(member_names=[])
get_vars()

Return the dictionary of attribute and value pair for the topic data members.

print_vars()

Print values of all member variables.