Skip to content

Commit

Permalink
#1501: vrt_coll: switch to use MsgPtrThief
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Aug 19, 2021
1 parent d7559ec commit 1d156ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/vt/vrt/collection/insert/insertable.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "vt/config.h"
#include "vt/vrt/collection/send/sendable.h"
#include "vt/vrt/collection/insert/modify_token.h"
#include "vt/messaging/message/smart_ptr.h"

namespace vt { namespace vrt { namespace collection {

Expand Down Expand Up @@ -90,7 +91,7 @@ struct ElmInsertable : BaseProxyT {
* \param[in] msg the message
*/
template <typename MsgT>
void insertMsg(ModifierToken& token, MsgSharedPtr<MsgT> msg) const;
void insertMsg(ModifierToken& token, messaging::MsgPtrThief<MsgT> msg) const;

/**
* \brief Insert a new collection element, calling the constructor that takes
Expand All @@ -102,7 +103,9 @@ struct ElmInsertable : BaseProxyT {
* \param[in] msg the message
*/
template <typename MsgT>
void insertAtMsg(ModifierToken& token, NodeType node, MsgSharedPtr<MsgT> msg) const;
void insertAtMsg(
ModifierToken& token, NodeType node, messaging::MsgPtrThief<MsgT> msg
) const;

/**
* \brief Destroy the collection element
Expand Down
10 changes: 6 additions & 4 deletions src/vt/vrt/collection/insert/insertable.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,26 @@ void ElmInsertable<ColT,IndexT,BaseProxyT>::insertAt(
template <typename ColT, typename IndexT, typename BaseProxyT>
template <typename MsgT>
void ElmInsertable<ColT,IndexT,BaseProxyT>::insertAtMsg(
ModifierToken& token, NodeType node, MsgSharedPtr<MsgT> msg
ModifierToken& token, NodeType node, messaging::MsgPtrThief<MsgT> msg
) const {
MsgSharedPtr<MsgT> msgptr = msg.msg_;
auto const col_proxy = this->getCollectionProxy();
auto const elm_proxy = this->getElementProxy();
auto const idx = elm_proxy.getIndex();
theCollection()->insert<ColT, MsgT>(col_proxy, idx, node, token, msg);
theCollection()->insert<ColT, MsgT>(col_proxy, idx, node, token, msgptr);
}

template <typename ColT, typename IndexT, typename BaseProxyT>
template <typename MsgT>
void ElmInsertable<ColT,IndexT,BaseProxyT>::insertMsg(
ModifierToken& token, MsgSharedPtr<MsgT> msg
ModifierToken& token, messaging::MsgPtrThief<MsgT> msg
) const {
MsgSharedPtr<MsgT> msgptr = msg.msg_;
auto const col_proxy = this->getCollectionProxy();
auto const elm_proxy = this->getElementProxy();
auto const idx = elm_proxy.getIndex();
theCollection()->insert<ColT, MsgT>(
col_proxy, idx, uninitialized_destination, token, msg
col_proxy, idx, uninitialized_destination, token, msgptr
);
}
template <typename ColT, typename IndexT, typename BaseProxyT>
Expand Down

0 comments on commit 1d156ce

Please sign in to comment.