Closed eboasson closed 2 months ago
@adrianomarto you might give this a try, it does work for simple case, but whether I actually got it right ...
@thijsmie I do my best to solve whatever problems are discovered in the Python binding and tooling, but sometimes I have a feeling I am only finding something merely exhibiting the symptoms of a solution. What I did here feels like one of those cases, though it does work for cyclonedds typeof Hello
given the following:
module Hierarchy {
@mutable
struct Vogel {
long v;
};
struct Kwartel : Vogel {
long k;
};
@mutable struct Base {
string fieldA;
Kwartel fieldK;
};
struct Derived : Base {
string fieldB;
};
};
from dataclasses import dataclass
from cyclonedds.domain import DomainParticipant
from cyclonedds.pub import DataWriter
from cyclonedds.topic import Topic
import Hierarchy
from time import sleep
dp = DomainParticipant(0)
tp = Topic(dp, "Hello", Hierarchy.Base)
tp2 = Topic(dp, "Hello", Hierarchy.Derived)
dw = DataWriter(dp, tp)
dw2 = DataWriter(dp, tp2)
while True:
sleep(10)
If by any chance you feel like giving this a look over, I'd appreciate it.
@eboasson, I confirm your fix also works for the specific cases I am working on. Thanks for that!
Thank you very much @thijsmie, this is exactly the type of detail that I was worried about ☺️
This solves
when
cyclonedds typeof
is used to print a derived type.With this change it prints the fields including those of the base type, but not the fact that is actually a derived type:
What I would like to see is of course:
Fixes #241 in the narrow sense that the error goes away and it does something at least somewhat useful.