MCPcopy Create free account
hub / github.com/AimRT/AimRT / _CreateContextRef

Function _CreateContextRef

src/runtime/python_runtime/aimrt_py_chn.py:40–54  ·  view source on GitHub ↗
(ctx_or_type, default_serialization_type: str)

Source from the content-addressed store, hash-verified

38
39
40def _CreateContextRef(ctx_or_type, default_serialization_type: str) -> aimrt_python_runtime.ContextRef:
41 if isinstance(ctx_or_type, aimrt_python_runtime.Context):
42 ctx_ref = aimrt_python_runtime.ContextRef(ctx_or_type)
43 elif isinstance(ctx_or_type, aimrt_python_runtime.ContextRef):
44 ctx_ref = ctx_or_type
45 else:
46 serialization_type = ctx_or_type if isinstance(ctx_or_type, str) else default_serialization_type
47 ctx = aimrt_python_runtime.Context()
48 ctx.SetSerializationType(serialization_type)
49 ctx_ref = aimrt_python_runtime.ContextRef(ctx)
50
51 if ctx_ref.GetSerializationType() == "":
52 ctx_ref.SetSerializationType(default_serialization_type)
53
54 return ctx_ref
55
56
57def GetRos2MessageTypeName(msg_type: Ros2MsgType) -> str:

Callers 1

PublishFunction · 0.85

Calls 5

SetSerializationTypeMethod · 0.95
GetSerializationTypeMethod · 0.95
SetSerializationTypeMethod · 0.95
ContextRefMethod · 0.45
ContextMethod · 0.45

Tested by

no test coverage detected