2014-06-25 22:03:44 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
|
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
|
|
//
|
2017-09-20 21:33:44 +00:00
|
|
|
// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
|
2014-06-25 22:03:44 +00:00
|
|
|
// Copyright 2014 UT-Battelle, LLC.
|
2015-05-21 12:09:22 +00:00
|
|
|
// Copyright 2014 Los Alamos National Security.
|
2014-06-25 22:03:44 +00:00
|
|
|
//
|
2017-09-20 21:33:44 +00:00
|
|
|
// Under the terms of Contract DE-NA0003525 with NTESS,
|
2014-06-25 22:03:44 +00:00
|
|
|
// the U.S. Government retains certain rights in this software.
|
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
|
|
|
// Laboratory (LANL), the U.S. Government retains certain rights in
|
|
|
|
// this software.
|
|
|
|
//============================================================================
|
|
|
|
$# This file uses the pyexpander macro processing utility to build the
|
|
|
|
$# FunctionInterface facilities that use a variable number of arguments.
|
|
|
|
$# Information, documentation, and downloads for pyexpander can be found at:
|
|
|
|
$#
|
|
|
|
$# http://pyexpander.sourceforge.net/
|
|
|
|
$#
|
|
|
|
$# To build the source code, execute the following (after installing
|
|
|
|
$# pyexpander, of course):
|
|
|
|
$#
|
|
|
|
$# expander.py FunctionInterfaceDetailPost.h.in > FunctionInterfaceDetailPost.h
|
|
|
|
$#
|
|
|
|
$# Ignore the following comment. It is meant for the generated file.
|
|
|
|
// **** DO NOT EDIT THIS FILE!!! ****
|
|
|
|
// This file is automatically generated by FunctionInterfaceDetailPost.h.in
|
|
|
|
|
2014-10-08 16:07:08 +00:00
|
|
|
#ifndef vtk_m_internal_FunctionInterfaceDetailPost_h
|
|
|
|
#define vtk_m_internal_FunctionInterfaceDetailPost_h
|
2014-06-25 22:03:44 +00:00
|
|
|
|
2014-10-08 16:07:08 +00:00
|
|
|
#if !defined(vtk_m_internal_FunctionInterface_h) && !defined(VTKM_TEST_HEADER_BUILD)
|
2014-06-25 22:03:44 +00:00
|
|
|
#error FunctionInterfaceDetailPre.h must be included from FunctionInterface.h
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <vtkm/internal/FunctionInterface.h>
|
|
|
|
|
|
|
|
$# This needs to match the max_parameters in FunctionInterfaceDetailPre.h.in
|
2018-01-04 19:06:16 +00:00
|
|
|
$py(max_parameters=20)\
|
2014-06-25 22:03:44 +00:00
|
|
|
#if VTKM_MAX_FUNCTION_PARAMETERS != $(max_parameters)
|
|
|
|
#error Mismatch of maximum parameters between FunctionInterfaceDatailPre.h.in and FunctionInterfaceDetailPost.h.in
|
|
|
|
#endif
|
|
|
|
|
|
|
|
$# Python commands used in template expansion.
|
|
|
|
$py(
|
|
|
|
def comma_if(flag):
|
|
|
|
if flag:
|
|
|
|
return ','
|
|
|
|
else:
|
|
|
|
return '';
|
|
|
|
|
|
|
|
def ptype(num, name=""):
|
|
|
|
if num == 0:
|
|
|
|
return '%sR' % name
|
|
|
|
else:
|
|
|
|
return '%sP%d' % (name, num)
|
|
|
|
|
|
|
|
def template_params(num_params, start=0, name=''):
|
|
|
|
if num_params < start:
|
|
|
|
return ''
|
|
|
|
result = 'typename %s' % ptype(start, name)
|
|
|
|
for param in xrange(start+1, num_params+1):
|
|
|
|
result += ',\n typename %s' % ptype(param, name)
|
|
|
|
return result
|
|
|
|
|
2014-10-16 22:31:55 +00:00
|
|
|
def signature(num_params, name=''):
|
|
|
|
result = '%s(' % ptype(0, name)
|
2014-06-25 22:03:44 +00:00
|
|
|
if num_params > 0:
|
|
|
|
result += ptype(1, name)
|
|
|
|
for param in xrange(2, num_params+1):
|
|
|
|
result += ',%s' % ptype(param, name)
|
|
|
|
result += ')'
|
|
|
|
return result
|
|
|
|
)\
|
|
|
|
$#
|
|
|
|
$extend(comma_if, ptype, template_params, signature)\
|
|
|
|
|
2017-05-31 15:37:29 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace internal
|
|
|
|
{
|
2014-06-25 22:03:44 +00:00
|
|
|
|
2017-05-31 15:37:29 +00:00
|
|
|
namespace detail
|
|
|
|
{
|
2014-06-25 22:03:44 +00:00
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
2017-05-31 15:37:29 +00:00
|
|
|
// clang-format off
|
|
|
|
|
2014-06-25 22:03:44 +00:00
|
|
|
$for(num_params in xrange(0, max_parameters+1))\
|
|
|
|
template<typename Transform,
|
|
|
|
$template_params(num_params)>
|
2017-05-31 15:37:29 +00:00
|
|
|
struct FunctionInterfaceStaticTransformType<$signature(num_params), Transform>
|
|
|
|
{
|
2014-06-25 22:03:44 +00:00
|
|
|
typedef $ptype(0)(type)(
|
|
|
|
$for(param_index in xrange(1, num_params+1))\
|
2015-01-14 01:26:13 +00:00
|
|
|
typename Transform::template ReturnType<$ptype(param_index),$(param_index)>::type$comma_if(param_index<num_params)
|
2014-06-25 22:03:44 +00:00
|
|
|
$endfor\
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
$endfor\
|
|
|
|
|
2017-05-31 15:37:29 +00:00
|
|
|
// clang-format on
|
|
|
|
|
2014-06-25 22:03:44 +00:00
|
|
|
} // namespace detail
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
2017-05-31 15:37:29 +00:00
|
|
|
// clang-format off
|
|
|
|
|
2014-06-25 22:03:44 +00:00
|
|
|
$for(num_params in xrange(0, max_parameters+1))\
|
|
|
|
/// \brief Create a \c FunctionInterface
|
|
|
|
///
|
|
|
|
/// \c make_FunctionInterface is a function that takes a variable number of
|
|
|
|
/// arguments and returns a \c FunctionInterface object containing these
|
|
|
|
/// objects. Since the return type for the function signature is not specified,
|
|
|
|
/// you must always specify it as a template parameter
|
|
|
|
///
|
|
|
|
/// \code{.cpp}
|
|
|
|
/// vtkm::internal::FunctionInterface<void(int,double,char)> functionInterface =
|
|
|
|
/// vtkm::internal::make_FunctionInterface<void>(1, 2.5, 'a');
|
|
|
|
/// \endcode
|
|
|
|
///
|
2015-09-21 19:26:28 +00:00
|
|
|
VTKM_SUPPRESS_EXEC_WARNINGS
|
2014-06-25 22:03:44 +00:00
|
|
|
template<$template_params(num_params)>
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_EXEC_CONT
|
2014-06-25 22:03:44 +00:00
|
|
|
FunctionInterface<$signature(num_params)>
|
|
|
|
make_FunctionInterface(
|
|
|
|
$for(param_index in xrange(1,num_params+1))\
|
2017-05-31 15:37:29 +00:00
|
|
|
const $ptype(param_index)& p$(param_index)$comma_if(param_index<num_params)
|
2014-06-25 22:03:44 +00:00
|
|
|
$endfor\
|
2017-05-31 15:37:29 +00:00
|
|
|
)
|
2014-06-25 22:03:44 +00:00
|
|
|
{
|
2017-11-15 17:12:48 +00:00
|
|
|
detail::ParameterContainer<$signature(num_params)> container =
|
|
|
|
{
|
2014-06-25 22:03:44 +00:00
|
|
|
$for(param_index in xrange(1,num_params+1))\
|
2017-11-15 17:12:48 +00:00
|
|
|
p$(param_index)$comma_if(param_index<num_params)
|
2014-06-25 22:03:44 +00:00
|
|
|
$endfor\
|
2017-11-15 17:12:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return FunctionInterface<$signature(num_params)>{container};
|
2014-06-25 22:03:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$endfor\
|
|
|
|
|
2017-05-31 15:37:29 +00:00
|
|
|
// clang-format off
|
|
|
|
|
2014-06-25 22:03:44 +00:00
|
|
|
}
|
|
|
|
} // namespace vtkm::internal
|
|
|
|
|
2014-10-08 16:07:08 +00:00
|
|
|
#endif //vtk_m_internal_FunctionInterfaceDetailPost_h
|