-
Notifications
You must be signed in to change notification settings - Fork 240
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
Make Tangram::Map implementation private #844
Conversation
Could we clear tiles for all map instance when triggering a debug flag that requests tile reloading? |
Maybe! We'd have to register all map instances to a global variable somewhere, which seemed undesirable. I had a weird idea on fixing this: |
Reviewing this now. |
std::array<Ease, 4> m_eases; | ||
bool m_cacheGlState; | ||
class Impl; | ||
std::unique_ptr<Impl> impl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note here that Map::Impl
class has its move constructor suppressed, unless explicitly defined/defaulted. This might have an affect if the user of the Map
class tries to move
an instance.
Reference: http://en.cppreference.com/w/cpp/language/pimpl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On similar note, should we restrict copying of a Map object by explicitly deleting copy constructor? RFC!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Map
is implicitly non-copyable - the compiler can't generate a copy constructor because of the unique_ptr
Supporting move semantics for Map
would be trivial, I don't know if there's a serious need for it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I also do not see a serious need or use case for a move for Map
. Wanted to bring this out, just in case, someone has a use case in mind.
This looks good to me. If no one has further comments will merge (squash, to save one merge commit) this. |
Thanks! Yeah, squash makes sense to me. |
Instead of holding all of our subsystem objects directly in the
Map
class,Map
now holds aunique_ptr
to an object of the private classMap::Impl
and all of the subsystem objects are members ofMap::Impl
.This significantly reduces the declarations needed in
tangram.h
and in the future will allow us to change the implementation ofMap
without changing this header.