Skip to content

Commit d330f2b

Browse files
committed
#276: active: make Node parameter a strong type
1 parent b600931 commit d330f2b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

examples/hello_world/hello_world.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ int main(int argc, char** argv) {
6565
}
6666

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

7171
vt::finalize();

src/vt/messaging/active.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
#include "vt/runtime/component/component_pack.h"
6565
#include "vt/elm/elm_id.h"
6666
#include "vt/elm/elm_lb_data.h"
67+
#include "vt/utils/strong/strong_type.h"
6768

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

8889
} /* end namespace vt */
8990

90-
namespace vt { namespace messaging {
91+
namespace vt {
92+
93+
struct StrongNodeType { };
94+
using Node = Strong<NodeType, uninitialized_destination, StrongNodeType>;
95+
96+
namespace messaging {
9197

9298
/** \file */
9399

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

0 commit comments

Comments
 (0)