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

Ownership questions #13

Open
osrf-migration opened this issue Nov 4, 2017 · 2 comments
Open

Ownership questions #13

osrf-migration opened this issue Nov 4, 2017 · 2 comments
Labels
enhancement New feature or request proposal

Comments

@osrf-migration
Copy link

Original report (archived issue) by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


I noticed on the examples that it is common to use Scene::Create* functions to instantiate most of the rendering types, as opposed to directly calling the type's constructor. All Create* functions return shared pointers.

  1. Does the scene keep shared ownership of everything which is created by Scene::Create*?
This seems to be true for some types but not others, for example:
    auto light = scene->CreateDirectionalLight();
    ASSERT_EQ(light.use_count(), 2u); // passes
    auto ray = scene->CreateRayQuery();
    ASSERT_EQ(ray.use_count(), 1u); // passes
I'd suggest we return `unique_ptr`s for those which the scene won't be keeping1. When calling `Visual::AddChild`, is the ownership shared with the visual? The same goes for other `Add` and `Set` functions which take `shared_ptr`s
  1. What's the appropriate way to destroy something which was created with Scene::Create*? There are some Scene::Destroy* functions, but there isn't a 1-1 relation to the creates. How to destroy the missing ones?

  2. Is there a situation when an object should / could be instantiated without the use of Scene::Create*?

@osrf-migration
Copy link
Author

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


  • Edited issue description

1 similar comment
@osrf-migration
Copy link
Author

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


  • Edited issue description

@chapulina chapulina added question Further information is requested enhancement New feature or request and removed minor question Further information is requested labels May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request proposal
Projects
None yet
Development

No branches or pull requests

2 participants