Skip to content

Commit

Permalink
Add exception for array of bytes in builder and re-generate xtypes ty…
Browse files Browse the repository at this point in the history
…pe support

Signed-off-by: Dennis Potman <[email protected]>
  • Loading branch information
dpotman authored and eboasson committed Mar 16, 2023
1 parent 11c9f50 commit 3a274df
Show file tree
Hide file tree
Showing 9 changed files with 320 additions and 90 deletions.
4 changes: 2 additions & 2 deletions cyclonedds/idl/_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
PlainCdrV2ArrayOfPrimitiveMachine, PlainCdrV2SequenceOfPrimitiveMachine, LenType, BitMaskMachine, BitBoundEnumMachine

from .types import array, bounded_str, sequence, _type_code_align_size_default_mapping, NoneType, char, typedef, uint8, \
case, default
byte, case, default


class XCDRSupported(IntFlag):
Expand Down Expand Up @@ -138,7 +138,7 @@ def _machine_for_type(cls, _type, add_size_header, use_version_2):
submachine = cls._machine_for_type(_type.subtype, add_size_header, use_version_2)

if isinstance(submachine, PrimitiveMachine):
if submachine.type == uint8:
if submachine.type == uint8 or submachine.type == byte:
return ByteArrayMachine(_type.length)

return PlainCdrV2ArrayOfPrimitiveMachine(submachine.type, _type.length)
Expand Down
4 changes: 2 additions & 2 deletions cyclonedds/idl/_typesupport/DDS/.idlpy_manifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ddsi_xt_type_object
ddsi_xt_typemap
XTypes


ddsi_xt_typemap
ddsi_xt_type_object
XTypes

10 changes: 6 additions & 4 deletions cyclonedds/idl/_typesupport/DDS/XTypes/.idlpy_manifest
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ddsi_xt_typemap

TypeMapping

ddsi_xt_type_object

ANNOTATION_OCTETSEC_VALUE_MAX_LEN
Expand Down Expand Up @@ -174,6 +178,7 @@ TK_FLOAT64
TK_INT16
TK_INT32
TK_INT64
TK_INT8
TK_MAP
TK_NONE
TK_SEQUENCE
Expand All @@ -183,6 +188,7 @@ TK_STRUCTURE
TK_UINT16
TK_UINT32
TK_UINT64
TK_UINT8
TK_UNION
TYPE_NAME_MAX_LENGTH
TypeFlag
Expand All @@ -208,7 +214,3 @@ UnionCaseLabelSeq
UnionDiscriminatorFlag
UnionMemberFlag
UnionTypeFlag

ddsi_xt_typemap

TypeMapping
218 changes: 215 additions & 3 deletions cyclonedds/idl/_typesupport/DDS/XTypes/__init__.py

Large diffs are not rendered by default.

150 changes: 75 additions & 75 deletions cyclonedds/idl/_typesupport/DDS/XTypes/_ddsi_xt_type_object.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cyclonedds/idl/_typesupport/DDS/XTypes/_ddsi_xt_typemap.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""
Generated by Eclipse Cyclone DDS idlc Python Backend
Cyclone DDS IDL version: v0.9.0
Cyclone DDS IDL version: v0.11.0
Module: DDS.XTypes
IDL file: ddsi_xt_typemap.idl
"""

from dataclasses import dataclass
from enum import auto
from typing import TYPE_CHECKING, Optional
from dataclasses import dataclass

import cyclonedds.idl as idl
import cyclonedds.idl.annotations as annotate
Expand Down
6 changes: 4 additions & 2 deletions cyclonedds/idl/_typesupport/DDS/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""
Generated by Eclipse Cyclone DDS idlc Python Backend
Cyclone DDS IDL version: v0.9.0
Cyclone DDS IDL version: v0.11.0
Module: DDS
"""

from . import XTypes
__all__ = ["XTypes", ]
__all__ = [
"XTypes",
]
9 changes: 9 additions & 0 deletions cyclonedds/idl/_typesupport/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""
Generated by Eclipse Cyclone DDS idlc Python Backend
Cyclone DDS IDL version: v0.11.0
Module:
"""

__all__ = [
]
5 changes: 5 additions & 0 deletions cyclonedds/idl/_typesupport/howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ The cyclonedds.idl._typesupport module is generated by normal idlc usage:

$ idlc -l py -p py-root-prefix=cyclonedds.idl._typesupport ddsi_xt_type_object.idl
$ idlc -l py -p py-root-prefix=cyclonedds.idl._typesupport ddsi_xt_typemap.idl

After generating, the type `StronglyConnectedComponentId` in the generated
file `DDS/XTypes/_ddsi_xt_type_object.py` needs an unsafe-hash flag:

`@dataclass(unsafe_hash=True)`

0 comments on commit 3a274df

Please sign in to comment.