Skip to content

Commit

Permalink
#276: active: make Node parameter a strong type
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Feb 2, 2023
1 parent 6fe615a commit eb444cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/hello_world/hello_world.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int main(int argc, char** argv) {
}

if (this_node == 0) {
vt::theMsg()->send<helloWorld>(1, 10, 20, 11.3f);
vt::theMsg()->send<helloWorld>(vt::Node{1}, 10, 20, 11.3f);
}

vt::finalize();
Expand Down
10 changes: 8 additions & 2 deletions src/vt/messaging/active.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include "vt/runtime/component/component_pack.h"
#include "vt/elm/elm_id.h"
#include "vt/elm/elm_lb_data.h"
#include "vt/utils/strong/strong_type.h"

#if vt_check_enabled(trace_enabled)
#include "vt/trace/trace_headers.h"
Expand All @@ -87,7 +88,12 @@ using ContinuationDeleterType =

} /* end namespace vt */

namespace vt { namespace messaging {
namespace vt {

struct StrongNodeType { };
using Node = Strong<NodeType, uninitialized_destination, StrongNodeType>;

namespace messaging {

/** \file */

Expand Down Expand Up @@ -774,7 +780,7 @@ struct ActiveMessenger : runtime::component::PollableComponent<ActiveMessenger>
* \return the \c PendingSend for the sent message
*/
template <auto f, typename... Params>
PendingSendType send(NodeType dest, Params&&... params) {
PendingSendType send(Node dest, Params&&... params) {
using Tuple = typename FunctionTraitsArgs<decltype(f)>::TupleType;
using MsgT = ParamMsg<Tuple>;
auto msg = vt::makeMessage<MsgT>(std::forward<Params>(params)...);
Expand Down

0 comments on commit eb444cf

Please sign in to comment.