DynamicArrayHandle Casting methods now holds by const * const.

This is to make it more clear to developers that the handle is a
reference that could be NULL.
This commit is contained in:
Robert Maynard 2016-01-18 16:50:40 -05:00
parent c1560e2d3f
commit 6fb86da8f9

@ -425,14 +425,14 @@ namespace detail {
template<typename Functor, typename Type>
struct DynamicArrayHandleTryStorage {
const DynamicArrayHandle& Array;
const DynamicArrayHandle* const Array;
const Functor &Function;
bool FoundCast;
VTKM_CONT_EXPORT
DynamicArrayHandleTryStorage(const DynamicArrayHandle &array,
const Functor &f)
: Array(array), Function(f), FoundCast(false) { }
: Array(&array), Function(f), FoundCast(false) { }
template<typename Storage>
VTKM_CONT_EXPORT
@ -446,9 +446,9 @@ private:
void DoCast(Storage, boost::mpl::bool_<true>)
{
if (!this->FoundCast &&
this->Array.template IsTypeAndStorage<Type,Storage>())
this->Array->template IsTypeAndStorage<Type,Storage>())
{
this->Function(this->Array.template CastToTypeStorage<Type,Storage>());
this->Function(this->Array->template CastToTypeStorage<Type,Storage>());
this->FoundCast = true;
}
}
@ -462,13 +462,13 @@ private:
template<typename Functor, typename StorageList>
struct DynamicArrayHandleTryType {
const DynamicArrayHandle& Array;
const DynamicArrayHandle* const Array;
const Functor &Function;
bool FoundCast;
VTKM_CONT_EXPORT
DynamicArrayHandleTryType(const DynamicArrayHandle &array, const Functor &f)
: Array(array), Function(f), FoundCast(false) { }
: Array(&array), Function(f), FoundCast(false) { }
template<typename Type>
VTKM_CONT_EXPORT
@ -476,7 +476,7 @@ struct DynamicArrayHandleTryType {
if (this->FoundCast) { return; }
typedef DynamicArrayHandleTryStorage<Functor, Type> TryStorageType;
TryStorageType tryStorage =
TryStorageType(this->Array, this->Function);
TryStorageType(*this->Array, this->Function);
vtkm::ListForEach(tryStorage, StorageList());
if (tryStorage.FoundCast)
{