-
Notifications
You must be signed in to change notification settings - Fork 9
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
#962 Msg API - switch to implicit conversion #969
Conversation
65eed88
to
461065a
Compare
Codecov Report
@@ Coverage Diff @@
## develop #969 +/- ##
===========================================
- Coverage 77.56% 77.40% -0.16%
===========================================
Files 667 665 -2
Lines 25614 25522 -92
===========================================
- Hits 19868 19756 -112
- Misses 5746 5766 +20
|
Looks good so far. Looking forward to seeing all of the |
b37a297
to
7b623c9
Compare
@lifflander "Works Here", ahah ^_^ |
* \brief Helper to unify 'stealing' message ownership. | ||
* | ||
* This type is not intented to be used directly. It uses implicit conversion | ||
* construtors to perform a 'std::move' on a \c MsgPtr<MsgT>&. |
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.
Typo 'constructors'
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.
Fixed.
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.
... It still reads 'construtors' (missing 'c'). Neglected push?
auto msg_hold = promoteMsg(msg.get()); | ||
theMsg()->broadcastMsg<MsgType,CollectionManager::releaseLBPhase>(msg); | ||
|
||
CollectionManager::releaseLBPhase(msg_hold.get()); |
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.
This repeated pattern of get, promote, broadcast, and deliver further favors making broadcast include local delivery.
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.
@PhilMiller broadcastMsgIncludingSelf
? A mouthful..
This is good progress. I like that this makes |
ec9669d
to
0cb4044
Compare
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.
I'm generally pretty happy with this.
25f5f03
to
72a7735
Compare
Looks good save for the one failed build. |
d116675
to
ad39899
Compare
- This allows the same callsite to, eg., bind to either a Msg<T>* or a MsgPtr<T>& without requiring duplicated methods. However, it also requires that the templated forms accepting a 'FunctorT' as the first parameter specify the message type as such can no longer be inferred.
- Despite very few usages, it's also quite confusing auto-null a ptr. It also does not work towards elimination of using T* directly. The usages of T* are restricted to being const, which should effectively only be 'msg.get()' cases.
- Now issues a vtAssert in some cases. In particular, get() will never return null as this much more eagerly exposes when a MsgPtr& has been [unexpectedly] moved by the API.
- Examples / tutorials / tests.
- The new name should (hopefully) much more clearly represent what is occuring and/or should be expected. This doesn't steal a Msg*, only a MsgPtr. This is designed to be used to transitional API which still accepts a Msg* which can be targeted as [deprecated]. - Tests cover expected thieving ability.
- The msg thief tests cover the expected lifetimes of all allowed usages - MsgT, MgsPtr<MsgT>&, MsgPtr<MsgT>&&.
- All (immediate) test directories are added in CMake instead of being manually specified. This reduces the chance of misplacing and expected resource.. such as 'context'. - REMOVED the non-compiled / not-executed context tests. These tests are woefully out of date and fail to compile for multiple reasons. See #999.
- Clarify ownership, provide std::move example.
- Not needed, if ever might have been.
ad39899
to
89bf296
Compare
Here is an overview of what got changed by this pull request: Clones removed
==============
+ tests/unit/memory/test_memory_lifetime.cc -4
+ tutorial/tutorial_1g.h -3
See the complete overview on Codacy |
Changes theMsg()'s sendMsg and broadcastMsg to perform an implicit std::move on the
MsgPtr&
argument.Change all core usages to supply a
MsgPtr&
(and all but two usage in tests).This change can make some code that worked before fail is the implicit move-like semantics are not honored.
Notes:
This currently uses an implicit proxy to unify both
MsgPtr&
andMsg*
. However, this type can be eliminated if droppingMsg*
directly and always acceptingMsgPtr&
.Over all the current code in VT, the pattern of creating a message is "the method" so there is no need to accept a
MsgPtr
orMsgPtr&&
.The implicit type is still very hand for transitioning over.