VariantArrayHandleContainer.cxx 1.37 KB
Newer Older
1 2 3 4
//============================================================================
//  Copyright (c) Kitware, Inc.
//  All rights reserved.
//  See LICENSE.txt for details.
5
//
6 7 8 9 10 11 12 13 14
//  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.
//============================================================================

#include <sstream>
#include <typeindex>

#include <vtkm/cont/ErrorBadValue.h>
15
#include <vtkm/cont/internal/VariantArrayHandleContainer.h>
16 17 18 19 20 21 22 23

namespace vtkm
{
namespace cont
{
namespace internal
{

24
VariantArrayHandleContainerBase::VariantArrayHandleContainerBase()
25
  : TypeIndex(typeid(nullptr))
26 27 28
{
}

29 30
VariantArrayHandleContainerBase::VariantArrayHandleContainerBase(const std::type_info& typeinfo)
  : TypeIndex(typeinfo)
31 32 33
{
}

34
VariantArrayHandleContainerBase::~VariantArrayHandleContainerBase()
35 36 37 38 39 40
{
}
}

namespace detail
{
41 42 43
VTKM_CONT_EXPORT void ThrowCastAndCallException(
  const vtkm::cont::internal::VariantArrayHandleContainerBase& ref,
  const std::type_info& type)
44 45 46 47 48 49 50 51 52 53 54
{
  std::ostringstream out;
  out << "Could not find appropriate cast for array in CastAndCall1.\n"
         "Array: ";
  ref.PrintSummary(out);
  out << "TypeList: " << type.name() << "\n";
  throw vtkm::cont::ErrorBadValue(out.str());
}
}
}
} // namespace vtkm::cont::detail