2014-10-23 14:28:50 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2014-10-23 14:28:50 +00:00
|
|
|
// 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.
|
|
|
|
//============================================================================
|
|
|
|
#ifndef vtk_m_cont_arg_ControlSignatureTagBase_h
|
|
|
|
#define vtk_m_cont_arg_ControlSignatureTagBase_h
|
|
|
|
|
2015-09-17 19:45:35 +00:00
|
|
|
#include <vtkm/StaticAssert.h>
|
2015-07-30 22:02:21 +00:00
|
|
|
#include <vtkm/internal/ExportMacros.h>
|
|
|
|
|
2016-08-29 15:13:00 +00:00
|
|
|
#include <type_traits>
|
2014-10-23 14:28:50 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace cont
|
|
|
|
{
|
|
|
|
namespace arg
|
|
|
|
{
|
2014-10-23 14:28:50 +00:00
|
|
|
|
|
|
|
/// \brief The base class for all tags used in a \c ControlSignature.
|
|
|
|
///
|
|
|
|
/// If a new \c ControlSignature tag is created, it must be derived from this
|
|
|
|
/// class in some way. This helps identify \c ControlSignature tags in the \c
|
|
|
|
/// VTKM_IS_CONTROL_SIGNATURE_TAG macro and allows checking the validity of a
|
|
|
|
/// \c ControlSignature.
|
|
|
|
///
|
|
|
|
/// In addition to inheriting from this base class, a \c ControlSignature tag
|
|
|
|
/// must define the following three typedefs: \c TypeCheckTag, \c TransportTag
|
|
|
|
/// and \c FetchTag.
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
struct ControlSignatureTagBase
|
|
|
|
{
|
|
|
|
};
|
2014-10-23 14:28:50 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace internal
|
|
|
|
{
|
2014-10-23 14:28:50 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename ControlSignatureTag>
|
2014-10-23 14:28:50 +00:00
|
|
|
struct ControlSignatureTagCheck
|
|
|
|
{
|
2018-02-22 16:34:08 +00:00
|
|
|
static constexpr bool Valid =
|
2017-05-18 14:29:41 +00:00
|
|
|
std::is_base_of<vtkm::cont::arg::ControlSignatureTagBase, ControlSignatureTag>::value;
|
2014-10-23 14:28:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
|
|
|
|
/// Checks that the argument is a proper tag for an \c ControlSignature. This
|
|
|
|
/// is a handy concept check when modifying tags or dispatching to make sure
|
|
|
|
/// that a template argument is actually an \c ControlSignature tag. (You can
|
|
|
|
/// get weird errors elsewhere in the code when a mistake is made.)
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
#define VTKM_IS_CONTROL_SIGNATURE_TAG(tag) \
|
|
|
|
VTKM_STATIC_ASSERT_MSG(::vtkm::cont::arg::internal::ControlSignatureTagCheck<tag>::Valid, \
|
|
|
|
"Provided a type that is not a valid ControlSignature tag.")
|
2014-10-23 14:28:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} // namespace vtkm::cont::arg
|
|
|
|
|
|
|
|
#endif //vtk_m_cont_arg_ControlSignatureTagBase_h
|