Skip to content
Snippets Groups Projects
Commit ade9f6a4 authored by Mark Winter's avatar Mark Winter
Browse files

Rearranging include structure for script command autogenerators

parent a0c285a5
No related branches found
No related tags found
No related merge requests found
......@@ -37,10 +37,12 @@
<ClInclude Include="WrapCmds\PyArgConverter.h" />
<ClInclude Include="WrapCmds\ScrCmdClosure.h" />
<ClInclude Include="WrapCmds\ScriptCommand.h" />
<ClInclude Include="WrapCmds\ScriptCommandDefines.h" />
<ClInclude Include="WrapCmds\ScriptCommands.h" />
<ClInclude Include="WrapCmds\ScriptCommandImpl.h" />
<ClInclude Include="WrapCmds\ScriptHelpers.h" />
<ClInclude Include="WrapCmds\CommandList.h" />
<ClInclude Include="WrapCmds\ScriptioMaps.h" />
<ClInclude Include="WrapCmds\ScriptTraits.h" />
<ClInclude Include="WrapCmds\ScriptTraitTfms.h" />
</ItemGroup>
......
......@@ -83,6 +83,12 @@
<ClInclude Include="mph\preproc_helper.h">
<Filter>Header Files\mph</Filter>
</ClInclude>
<ClInclude Include="WrapCmds\ScriptioMaps.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="WrapCmds\ScriptCommandDefines.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
......
#pragma once
#include "mph/qualifier_helpers.h"
// Helper macro definitions for script commands and io mappers
// valid_map - Used in error check for valid OutMap templates
// NOTE: See _SCR_CHK_MAIN_TYPE for details
template <template <typename> class T, typename = void>
struct valid_map: std::false_type {};
template <template <typename> class T>
struct valid_map<T, mph::void_t<typename T<void>::type>>: std::true_type {};
#define _SCR_CHK_MAIN_TYPE(Name) \
template <typename T> struct OutMap_Impl; \
static_assert(valid_map<OutMap_Impl>::value, \
"HIP_COMPILE: Default IO type map undefined for: " \
#Name ". Command name may be mismatched");
/////////////
// SCR_DEFINE_IO_TYPE_MAP - Define an input->output io map for the specified script command
#define SCR_DEFINE_IO_TYPE_MAP(Name, OutT,InT) \
namespace CudaCall_##Name##_Stub \
{ \
_SCR_CHK_MAIN_TYPE(Name) \
template <> struct OutMap_Impl<InT> {using type = OutT;}; \
};
/////////////
// SCR_COMMAND_CLASSDEF - Create the class definition line for a script command
// See ScrCmd*.h files for examples
#define SCR_COMMAND_CLASSDEF(Name) class ScriptCommand_##Name: public ScriptCommand_##Name##_Base
/////////////
// SCR_HELP_STRING - Add the command help string to a script command class definition
// See ScrCmd*.h files for examples
#define SCR_HELP_STRING(Str) using HelpStrType = decltype(mph::literal(Str));\
static constexpr auto helpStr = mph::literal(Str)
#pragma once
#include "ScriptCommandDefines.h"
#define GENERATE_DEFAULT_IO_MAPPERS
#include "GenCommands.h"
#undef GENERATE_DEFAULT_IO_MAPPERS
/////////////////
// SCRIPT_COMMAND_DEF:
// If necessary, place any non-default input->ouput map definitions here
// E.g. see Gaussian command, for an example of non-standard type-mapping
/////////////////
......@@ -130,4 +130,9 @@ namespace mph
/////////////////////////
template <template <typename> class Tfm, typename T>
using full_type_tfm_t = typename internal::full_type_tfm_impl<Tfm, T, T>::type;
/////////////////////////
// void_t - C++14 compatibility (used with SFINAE for identifying "valid" type expressions)
/////////////////////////
template <typename... Ts> using void_t = void;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment