VTK  9.7.1
vtkIdTypeArray.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
15 #ifndef vtkIdTypeArray_h
16 #define vtkIdTypeArray_h
17 
18 #include "vtkAOSDataArrayTemplate.h" // Real Superclass
19 #include "vtkCommonCoreModule.h" // For export macro
20 #include "vtkDataArray.h"
21 
22 // Fake the superclass for non-Python wrappers.
23 // Python can handle the templated superclass; Java and others cannot.
24 #if !defined(__VTK_WRAP__) || defined(__VTK_WRAP_PYTHON__) || defined(__VTK_WRAP_HIERARCHY__)
25 #define vtkDataArray vtkAOSDataArrayTemplate<vtkIdType>
26 #endif
27 VTK_ABI_NAMESPACE_BEGIN
28 class VTKCOMMONCORE_EXPORT vtkIdTypeArray : public vtkDataArray
29 {
30 public:
31  vtkTypeMacro(vtkIdTypeArray, vtkDataArray);
32 #if !defined(__VTK_WRAP__) || defined(__VTK_WRAP_PYTHON__) || defined(__VTK_WRAP_HIERARCHY__)
33 #undef vtkDataArray
34 #endif
35  using DataTypeTag = std::integral_constant<int, VTK_ID_TYPE>;
36  static vtkIdTypeArray* New();
37  static vtkIdTypeArray* ExtendedNew();
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
40  // This macro expands to the set of method declarations that
41  // make up the interface of vtkAOSDataArrayTemplate, which is ignored
42  // by the wrappers.
43 #if (defined(__VTK_WRAP__) || defined(__WRAP_GCCXML__)) && !defined(__VTK_WRAP_PYTHON__)
45 #else
46 
50  int GetDataType() const override
51  {
52  // This needs to overwritten from superclass because
53  // the templated superclass is not able to differentiate
54  // vtkIdType from a long long or an int since vtkIdType
55  // is simply a typedef. This means that
56  // vtkAOSDataArrayTemplate<vtkIdType> != vtkIdTypeArray.
58  }
59 #endif
60 
65  {
66  return static_cast<vtkIdTypeArray*>(Superclass::FastDownCast(source));
67  }
68 
69 protected:
71  ~vtkIdTypeArray() override;
72 
73 private:
74  typedef vtkAOSDataArrayTemplate<vtkIdType> RealSuperclass;
75 
76  vtkIdTypeArray(const vtkIdTypeArray&) = delete;
77  void operator=(const vtkIdTypeArray&) = delete;
78 };
79 
80 // Define vtkArrayDownCast implementation:
82 
83 VTK_ABI_NAMESPACE_END
84 #endif
Abstract superclass for all arrays.
#define vtkCreateWrappedArrayInterface(T)
static vtkIdTypeArray * FastDownCast(vtkAbstractArray *source)
A faster alternative to SafeDownCast for downcasting vtkAbstractArrays.
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:363
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetDataType() const override
Get the data type.
a simple class to control print indentation
Definition: vtkIndent.h:28
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
vtkArrayDownCast_FastCastMacro(vtkIdTypeArray)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
std::integral_constant< int, VTK_OPAQUE > DataTypeTag
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...