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

merge(~) feature for Composite State and Properties #708

Merged
merged 1 commit into from
Apr 28, 2016

Conversation

mxgrey
Copy link
Member

@mxgrey mxgrey commented Apr 28, 2016

Up until now, Composite::State and Composite::Properties has had a copy(~) function which will do a deep copy making the contents of one instance exactly the same as the contents of another instance.

This PR adds a merge function which will allow the receiving instance to hang onto any entries it has which are not present in the sending instance. So suppose we have:

Composite::Properties receiver, sender;
sender.create<Aspect1>();
receiver.create<Aspect2>();
receiver.merge(sender);

Then receiver will get the Aspect1 contents of sender, but it will also get to keep its own Aspect2 contents. On the other hand if we used receiver.copy(sender) instead, then receiver would lose its Aspect2 contents in order to be a perfect duplicate of sender.

I've also added a has<Aspect>() function for Composite::State and Composite::Properties.


This change is Reviewable

@jslee02 jslee02 added this to the DART 6.0.0 milestone Apr 28, 2016
@mxgrey mxgrey changed the title Merging features for Composite State and Properties merge(~) feature for Composite State and Properties Apr 28, 2016
@jslee02
Copy link
Member

jslee02 commented Apr 28, 2016

:lgtm:


Reviewed 4 of 4 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

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 this pull request may close these issues.

2 participants