mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 01:43:34 +08:00
Preserving original filename in the compound type descriptor structure
This commit is contained in:
@@ -92,12 +92,13 @@ class CompoundType(Type):
|
|||||||
KIND_SERVICE = 0
|
KIND_SERVICE = 0
|
||||||
KIND_MESSAGE = 1
|
KIND_MESSAGE = 1
|
||||||
|
|
||||||
def __init__(self, full_name, kind, dsdl_signature, dsdl_path, default_dtid):
|
def __init__(self, full_name, kind, dsdl_signature, dsdl_path, default_dtid, filename):
|
||||||
super().__init__(full_name, Type.CATEGORY_COMPOUND)
|
super().__init__(full_name, Type.CATEGORY_COMPOUND)
|
||||||
self.dsdl_signature = dsdl_signature
|
self.dsdl_signature = dsdl_signature
|
||||||
self.dsdl_path = dsdl_path
|
self.dsdl_path = dsdl_path
|
||||||
self.default_dtid = default_dtid
|
self.default_dtid = default_dtid
|
||||||
self.kind = kind
|
self.kind = kind
|
||||||
|
self.filename = filename
|
||||||
max_bitlen_sum = lambda fields: sum([x.type.get_max_bitlen() for x in fields])
|
max_bitlen_sum = lambda fields: sum([x.type.get_max_bitlen() for x in fields])
|
||||||
if kind == CompoundType.KIND_SERVICE:
|
if kind == CompoundType.KIND_SERVICE:
|
||||||
self.request_fields = []
|
self.request_fields = []
|
||||||
@@ -394,7 +395,8 @@ class Parser:
|
|||||||
if response_part:
|
if response_part:
|
||||||
dsdl_signature = self._compute_dsdl_signature(full_typename, fields, constants,
|
dsdl_signature = self._compute_dsdl_signature(full_typename, fields, constants,
|
||||||
resp_fields, resp_constants)
|
resp_fields, resp_constants)
|
||||||
typedef = CompoundType(full_typename, CompoundType.KIND_SERVICE, dsdl_signature, filename, default_dtid)
|
typedef = CompoundType(full_typename, CompoundType.KIND_SERVICE, dsdl_signature, filename,
|
||||||
|
default_dtid, filename)
|
||||||
typedef.request_fields = fields
|
typedef.request_fields = fields
|
||||||
typedef.request_constants = constants
|
typedef.request_constants = constants
|
||||||
typedef.response_fields = resp_fields
|
typedef.response_fields = resp_fields
|
||||||
@@ -403,7 +405,8 @@ class Parser:
|
|||||||
max_bytelen = tuple(map(bitlen_to_bytelen, max_bitlen))
|
max_bytelen = tuple(map(bitlen_to_bytelen, max_bitlen))
|
||||||
else:
|
else:
|
||||||
dsdl_signature = self._compute_dsdl_signature(full_typename, fields, constants)
|
dsdl_signature = self._compute_dsdl_signature(full_typename, fields, constants)
|
||||||
typedef = CompoundType(full_typename, CompoundType.KIND_MESSAGE, dsdl_signature, filename, default_dtid)
|
typedef = CompoundType(full_typename, CompoundType.KIND_MESSAGE, dsdl_signature, filename,
|
||||||
|
default_dtid, filename)
|
||||||
typedef.fields = fields
|
typedef.fields = fields
|
||||||
typedef.constants = constants
|
typedef.constants = constants
|
||||||
max_bitlen = typedef.get_max_bitlen()
|
max_bitlen = typedef.get_max_bitlen()
|
||||||
|
|||||||
Reference in New Issue
Block a user