VTK  9.1.0
vtkRangeIterableTraits.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkRangeIterableTraits.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15
16#ifndef vtkRangeIterableTraits_h
17#define vtkRangeIterableTraits_h
18
19class vtkCollection;
22
23namespace vtk
24{
25namespace detail
26{
27
28template <typename CollectionType>
29struct CollectionRange;
30
31struct CompositeDataSetRange;
32struct DataObjectTreeRange;
33
34//------------------------------------------------------------------------------
35// DeduceRangeType:
36// These function signatures define a mapping from an Iterable (e.g. vtkObject)
37// to a RangeType (e.g. the for-range iterable object).
38// They are not implemented, as only the signatures are important. Classes used
39// should only be forward declared in this header.
40// Since classes are only forward declared, the argument type should be const&
41// qualified, and the return type should be a reference.
42
43// vtkCollection subclasses --> CollectionRange
44template <typename CollectionType,
45 typename = typename std::enable_if<std::is_base_of<vtkCollection, CollectionType>::value>::type>
47
48// vtkCompositeDataSet --> CompositeDataSetRange
50
51// vtkDataObjectTree --> DataObjectTreeRange
53
54// Traits class that defines a RangeType corresponding to the iterable range
55// type most appropriate for Iterable.
56template <typename Iterable>
58{
59private:
60 using RangeTypeInternal = decltype(vtk::detail::DeduceRangeType(std::declval<Iterable>()));
61
62public:
63 using RangeType = typename std::decay<RangeTypeInternal>::type;
64};
65
66}
67}
68
69#endif // vtkRangeIterableTraits_h
70
71// VTK-HeaderTest-Exclude: vtkRangeIterableTraits.h
create and manipulate ordered lists of objects
Definition: vtkCollection.h:53
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