VTK  9.3.20240528
vtkRangeIterableTraits.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef vtkRangeIterableTraits_h
5#define vtkRangeIterableTraits_h
6
7#include "vtkABINamespace.h"
8
9VTK_ABI_NAMESPACE_BEGIN
10class vtkCollection;
13VTK_ABI_NAMESPACE_END
14
15namespace vtk
16{
17namespace detail
18{
19VTK_ABI_NAMESPACE_BEGIN
20
21template <typename CollectionType>
22struct CollectionRange;
23
24struct CompositeDataSetRange;
25struct DataObjectTreeRange;
26
27//------------------------------------------------------------------------------
28// DeduceRangeType:
29// These function signatures define a mapping from an Iterable (e.g. vtkObject)
30// to a RangeType (e.g. the for-range iterable object).
31// They are not implemented, as only the signatures are important. Classes used
32// should only be forward declared in this header.
33// Since classes are only forward declared, the argument type should be const&
34// qualified, and the return type should be a reference.
35
36// vtkCollection subclasses --> CollectionRange
37template <typename CollectionType,
38 typename = typename std::enable_if<std::is_base_of<vtkCollection, CollectionType>::value>::type>
40
41// vtkCompositeDataSet --> CompositeDataSetRange
43
44// vtkDataObjectTree --> DataObjectTreeRange
46
47// Traits class that defines a RangeType corresponding to the iterable range
48// type most appropriate for Iterable.
49template <typename Iterable>
51{
52private:
53 using RangeTypeInternal = decltype(vtk::detail::DeduceRangeType(std::declval<Iterable>()));
54
55public:
56 using RangeType = typename std::decay<RangeTypeInternal>::type;
57};
58
59VTK_ABI_NAMESPACE_END
60}
61}
62
63#endif // vtkRangeIterableTraits_h
64
65// VTK-HeaderTest-Exclude: vtkRangeIterableTraits.h
create and manipulate ordered lists of objects
abstract superclass for composite (multi-block or AMR) datasets
provides implementation for most abstract methods in the superclass vtkCompositeDataSet
CollectionRange< CollectionType > & DeduceRangeType(const CollectionType &)
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
typename std::decay< RangeTypeInternal >::type RangeType