Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clone PDU #18

Closed
carlocorradini opened this issue Oct 14, 2023 · 10 comments · Fixed by #20
Closed

Clone PDU #18

carlocorradini opened this issue Oct 14, 2023 · 10 comments · Fixed by #20

Comments

@carlocorradini
Copy link
Collaborator

We need a method/mechanism to clone the PDU:

  1. From the generic Header:
    • If Header is "pure" simply return a copy of the Header
    • If Header is the base class of a specialized PDU, clone the whole chain and return a copy of the Header (it can be casted to the correct PDU)
  2. From a specialized PDU, simply create a copy of the PDU (clone the whole chain)

@karljj1 I don't know if this is already possible but it's super useful (especially in my use-case)

@karljj1
Copy link
Owner

karljj1 commented Oct 14, 2023

You could just call Encode and Decode using the PDU_Factory although it's more work than a straight copy.

@carlocorradini
Copy link
Collaborator Author

@karljj1 Can we try to implement this

What do you think?

@karljj1
Copy link
Owner

karljj1 commented Oct 16, 2023

@karljj1 Can we try to implement this

What do you think?

This would involve adding a clone method to every PDU and DataType? It should be fine, just quite a bit of work ;)

@carlocorradini
Copy link
Collaborator Author

@karljj1
Copy link
Owner

karljj1 commented Oct 17, 2023

Looks interesting. I did avoid using some of the newer c++ features because I know some of the users of kdis were running it on a 20 year old toaster, but it may be time to embrace them 😄

@carlocorradini
Copy link
Collaborator Author

With the refactor we've set the minimum C++ standard as 11.
Therefore, we should be good with this one

@karljj1
Copy link
Owner

karljj1 commented Oct 17, 2023

We should probably get rid of my old smart pointer then, if you haven't already 😄

@carlocorradini
Copy link
Collaborator Author

Done in the previous PR

@carlocorradini
Copy link
Collaborator Author

@karljj1 It's correct that Reliability_Header does not extend Header? Am I missing somethig? Thanks

@karljj1
Copy link
Owner

karljj1 commented Oct 18, 2023

Yes Reliability header is only for PDU that support it, the PDU tend to be in a special reliable category. So instead we use multiple inheritance to add it in when needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants