VTK
vtkTypeList.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTypeList.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 
17 // The Loki Library
18 // Copyright (c) 2001 by Andrei Alexandrescu
19 // This code accompanies the book:
20 // Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
21 // Patterns Applied". Copyright (c) 2001. Addison-Wesley.
22 // Permission to use, copy, modify, distribute and sell this software for any
23 // purpose is hereby granted without fee, provided that the above copyright
24 // notice appear in all copies and that both that copyright notice and this
25 // permission notice appear in supporting documentation.
26 // The author or Addison-Wesley Longman make no representations about the
27 // suitability of this software for any purpose. It is provided "as is"
28 // without express or implied warranty.
30 
50 #ifndef vtkTypeList_h
51 #define vtkTypeList_h
52 
53 #ifndef __VTK_WRAP__
54 
55 #include "vtkTypeListMacros.h"
56 
57 namespace vtkTypeList
58 {
59 
60 //------------------------------------------------------------------------------
64 struct NullType
65 {
66 };
67 
68 //------------------------------------------------------------------------------
70 
73 template <typename T, typename U>
74 struct TypeList
75 {
76  typedef T Head;
77  typedef U Tail;
78 };
80 
81 //------------------------------------------------------------------------------
85 template <bool Exp, typename T, typename F>
86 struct Select;
87 
88 //------------------------------------------------------------------------------
93 template <typename From, typename To>
94 struct CanConvert;
95 
96 //------------------------------------------------------------------------------
101 template <typename TList, typename T>
102 struct IndexOf;
103 
104 //------------------------------------------------------------------------------
109 template <typename TList, typename T>
110 struct Erase;
111 
112 //------------------------------------------------------------------------------
116 template <typename TList, typename T>
117 struct EraseAll;
118 
119 //------------------------------------------------------------------------------
124 template <typename TList>
125 struct Unique;
126 
127 //------------------------------------------------------------------------------
132 template <typename TList, typename Bad, typename Good>
133 struct Replace;
134 
135 //------------------------------------------------------------------------------
140 template <typename TList, typename Bad, typename Good>
141 struct ReplaceAll;
142 
143 //------------------------------------------------------------------------------
149 template <typename TList, typename T>
150 struct MostDerived;
151 
152 //------------------------------------------------------------------------------
158 template <typename TList>
160 
161 //------------------------------------------------------------------------------
165 template <typename TList, typename T>
166 struct Append;
167 
168 } // end namespace vtkTypeList
169 
170 #include "vtkTypeList.txx"
171 
172 namespace vtkTypeList
173 {
174 
175 template <typename... Ts>
176 using Create = typename vtkTypeList::detail::CreateImpl<Ts...>::type;
177 
178 } // end namespace vtkTypeList
179 
180 #endif // __VTK_WRAP__
181 
182 #endif // vtkTypeList_h
183 // VTK-HeaderTest-Exclude: vtkTypeList.h
vtkTypeList::Select
Sets Result to T if Exp is true, or F if Exp is false.
Definition: vtkTypeList.h:86
vtkTypeList
Definition: vtkTypeList.h:57
vtkX3D::type
Definition: vtkX3D.h:522
vtkTypeList::DerivedToFront
Sort the TypeList from most-derived to least-derived type, storing the sorted TypeList in Result.
Definition: vtkTypeList.h:159
vtkTypeList::CanConvert
Sets member Result to true if a conversion exists to convert type From to type To.
Definition: vtkTypeList.h:94
vtkTypeList::EraseAll
Erase all type T from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:117
vtkTypeList::Create
typename vtkTypeList::detail::CreateImpl< Ts... >::type Create
Definition: vtkTypeList.h:176
vtkTypeList::MostDerived
Given a type T and a TypeList TList, store the most derived type of T in TList as Result.
Definition: vtkTypeList.h:150
vtkTypeList::TypeList
Generic implementation of TypeList.
Definition: vtkTypeList.h:74
vtkTypeList::Unique
Remove all duplicate types from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:125
vtkTypeList::TypeList::Head
T Head
Definition: vtkTypeList.h:76
vtkTypeList::TypeList::Tail
U Tail
Definition: vtkTypeList.h:77
vtkTypeList::ReplaceAll
Replace all instances of Bad with Good in the TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:141
vtkTypeList::NullType
Used to terminate a TypeList.
Definition: vtkTypeList.h:64
vtkTypeList::IndexOf
Sets the enum value Result to the index of type T in the TypeList TList.
Definition: vtkTypeList.h:102
vtkTypeList::Replace
Replace the first instance of Bad with Good in the TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:133
vtkTypeList::Erase
Erase the first element of type T from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:110
vtkTypeList::Append
Appends type T to TypeList TList and stores the result in Result.
Definition: vtkTypeList.h:166