vtk-m/vtkm/worklet/internal/DispatcherBaseDetailInvoke.h.in

87 lines
3.2 KiB
C

//============================================================================
// 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.
//
// Copyright 2014 Sandia Corporation.
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 Los Alamos National Security.
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// 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 DispatcherBaseDetailInvoke.h.in > DispatcherBaseDetailInvoke.h
$#
$# Ignore the following comment. It is meant for the generated file.
// **** DO NOT EDIT THIS FILE!!! ****
// This file is automatically generated by FunctionInterfaceDetailPre.h.in
#if !defined(vtk_m_worklet_internal_DispatcherBase_h)
#error DispatcherBaseDetailInvoke.h must be included from DispatcherBase.h
#endif
// Note that this file is included from the middle of the DispatcherBase.h
// class to provide the implementation of the Invoke method, which requires
// variable length template args. If we choose to support C++11 variable
// template arguments, then this could all be replaced efficiently with a
// single method with a variadic template function that calls
// make_FunctionInterface.
$py(max_parameters=9)\
$# Python commands used in template expansion.
$py(
def template_params(num_params, name='T', start=1, default=''):
if num_params < start:
return ''
result = 'typename %s%d%s' % (name, start, default)
for param in xrange(start+1, num_params+1):
result += ',\n typename %s%d%s' % (name, param, default)
return result
def function_params(num_params, typename='T', argname='a', start=1):
if num_params < start:
return ''
result = '%s%d %s%d' % (typename, start, argname, start)
for param in xrange(start+1, num_params+1):
result += ', %s%d %s%d' % (typename, param, argname, param)
return result
def arg_list(num_params, argname='a', start=1):
if num_params < start:
return ''
result = '%s%d' % (argname, start)
for param in xrange(start+1, num_params+1):
result += ',%s%d' % (argname, param)
return result
)\
$#
$extend(template_params, function_params, arg_list)\
$for(num_params in xrange(1, max_parameters+1))\
template<$template_params(num_params)>
VTKM_CONT_EXPORT
void Invoke($function_params(num_params)) const
{
this->StartInvoke(
vtkm::internal::make_FunctionInterface<void>($arg_list(num_params)));
}
$endfor\