libcellml
libcellml copied to clipboard
Revisit the way we handle adding entities and how this affects the overall API
Right now, we can perfectly do something like:
auto m = libcellml::Model::create();
auto c = libcellml::Component::create();
m->addComponent(c);
m->addComponent(c);
i.e. add c twice to m, which doesn't make sense to me since any changes to c will effectively be duplicated when serialising m. In the example above, I would therefore have the second m->addComponent(c); fail since c has already been added to m. Note that this may have some effects on the rest of the API, so we should look at this issue the API level.
(See https://github.com/cellml/libcellml/pull/785#issuecomment-791101465 for some background discussion.)
Just to be clear, current behaviour is to reject the second addition of c. #785 changes this behviour to accept the multiple additions.