Skip to content

Commit

Permalink
#872: increase readability of makeHandler() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Strzebonski committed Oct 29, 2020
1 parent b8ad708 commit c59d312
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 22 deletions.
21 changes: 14 additions & 7 deletions src/vt/registry/auto/auto_registry_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,20 @@ inline AutoHandlerType getAutoHandlerObjTypeIdx(HandlerType han) {

template <typename ObjT, typename MsgT, objgroup::ActiveObjType<MsgT, ObjT> f>
inline HandlerType makeAutoHandlerObjGroup(HandlerControlType ctrl) {
using AdapterT = FunctorAdapterMember<
objgroup::ActiveObjType<MsgT, ObjT>, f, ObjT
>;
using AdapterT =
FunctorAdapterMember<objgroup::ActiveObjType<MsgT, ObjT>, f, ObjT>;
using ContainerType = AutoActiveObjGroupContainerType;
using RegInfoType = AutoRegInfoType<AutoActiveObjGroupType>;
using FuncType = objgroup::ActiveObjAnyType;
using RunType = RunnableGen<AdapterT, ContainerType, RegInfoType, FuncType>;

auto const obj = true;
constexpr bool is_auto = true;
constexpr bool is_functor = false;
constexpr bool is_objgroup = true;
auto const idx = RunType::idx;
auto const han = HandlerManagerType::makeHandler(true, false, idx, obj, ctrl);
auto const han =
HandlerManagerType::makeHandler(is_auto, is_functor, idx, is_objgroup, ctrl
);
auto obj_idx = objgroup::registry::makeObjIdx<ObjT>();
getAutoRegistryGen<ContainerType>().at(idx).setObjIdx(obj_idx);
return han;
Expand All @@ -93,7 +96,9 @@ inline HandlerType makeAutoHandler() {
using FuncType = ActiveFnPtrType;
using RunType = RunnableGen<AdapterT, ContainerType, RegInfoType, FuncType>;

return HandlerManagerType::makeHandler(true, false, RunType::idx);
constexpr bool is_auto = true;
constexpr bool is_functor = false;
return HandlerManagerType::makeHandler(is_auto, is_functor, RunType::idx);
}

template <typename T, T value>
Expand All @@ -104,7 +109,9 @@ inline HandlerType makeAutoHandlerParam() {
using FuncType = ActiveFnPtrType;
using RunType = RunnableGen<AdapterT, ContainerType, RegInfoType, FuncType>;

return HandlerManagerType::makeHandler(true, false, RunType::idx);
constexpr bool is_auto = true;
constexpr bool is_functor = false;
return HandlerManagerType::makeHandler(is_auto, is_functor, RunType::idx);
}

inline AutoActiveType getAutoHandler(HandlerType const& handler) {
Expand Down
10 changes: 6 additions & 4 deletions src/vt/registry/auto/functor/auto_registry_functor_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ inline HandlerType makeAutoHandlerFunctor() {
using ContainerType = AutoActiveFunctorContainerType;
using RegInfoType = AutoRegInfoType<AutoActiveFunctorType>;
using FuncType = ActiveFnPtrType;
using RunType = RunnableFunctor<
AdapterType, ContainerType, RegInfoType, FuncType, msg
>;
return HandlerManagerType::makeHandler(true, true, RunType::idx);
using RunType =
RunnableFunctor<AdapterType, ContainerType, RegInfoType, FuncType, msg>;

constexpr bool is_auto = true;
constexpr bool is_functor = true;
return HandlerManagerType::makeHandler(is_auto, is_functor, RunType::idx);
}

template <typename RunnableT, typename RegT, typename InfoT, typename FnT>
Expand Down
26 changes: 15 additions & 11 deletions src/vt/registry/auto/map/auto_registry_map_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ inline HandlerType makeAutoHandlerFunctorMap() {
using RunnableT = RunnableFunctor<
FunctorT, ContainerType, RegInfoType, FuncType, true, Args...
>;
auto const& han = HandlerManagerType::makeHandler(true, true, RunnableT::idx);
vt_debug_print(
handler, node,
"makeAutoHandlerFunctorMap: handler={}\n", han
);

constexpr bool is_auto = true;
constexpr bool is_functor = true;
auto const han =
HandlerManagerType::makeHandler(is_auto, is_functor, RunnableT::idx);
vt_debug_print(handler, node, "makeAutoHandlerFunctorMap: handler={}\n", han);
return han;
}

Expand Down Expand Up @@ -110,12 +111,12 @@ inline HandlerType makeAutoHandlerMap() {
using ContainerType = AutoActiveMapContainerType;
using RegInfoType = AutoRegInfoType<AutoActiveMapType>;
using FuncType = ActiveMapFnPtrType;

constexpr bool is_auto = true;
constexpr bool is_functor = false;
auto id = RunnableGen<FunctorType, ContainerType, RegInfoType, FuncType>::idx;
auto const& han = HandlerManagerType::makeHandler(true,false,id);
vt_debug_print(
handler, node,
"makeAutoHandlerMap: id={}, han={}\n", id, han
);
auto const han = HandlerManagerType::makeHandler(is_auto, is_functor, id);
vt_debug_print(handler, node, "makeAutoHandlerMap: id={}, han={}\n", id, han);
return han;
}

Expand All @@ -135,8 +136,11 @@ inline HandlerType makeAutoHandlerSeedMap() {
using ContainerType = AutoActiveSeedMapContainerType;
using RegInfoType = AutoRegInfoType<AutoActiveSeedMapType>;
using FuncType = ActiveSeedMapFnPtrType;

constexpr bool is_auto = true;
constexpr bool is_functor = false;
auto id = RunnableGen<FunctorType, ContainerType, RegInfoType, FuncType>::idx;
auto const& han = HandlerManagerType::makeHandler(true, false, id);
auto const han = HandlerManagerType::makeHandler(is_auto, is_functor, id);
vt_debug_print(handler, node, "makeAutoHandlerMap: id={}, han={}\n", id, han);
return han;
}
Expand Down

0 comments on commit c59d312

Please sign in to comment.