VTK  9.3.0
vtkDataObjectTypes.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
24 #ifndef vtkDataObjectTypes_h
25 #define vtkDataObjectTypes_h
26 
27 #include "vtkCommonDataModelModule.h" // For export macro
28 #include "vtkObject.h"
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkDataObject;
32 
33 class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectTypes : public vtkObject
34 {
35 public:
37 
38  vtkTypeMacro(vtkDataObjectTypes, vtkObject);
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
45  static const char* GetClassNameFromTypeId(int typeId);
46 
51  static int GetTypeIdFromClassName(const char* classname);
52 
56  static VTK_NEWINSTANCE vtkDataObject* NewDataObject(const char* classname);
57 
62 
63  /*
64  * Returns true if the `typeId` is same or a subclass of
65  * `targetTypeId`.
66  */
67  static bool TypeIdIsA(int typeId, int targetTypeId);
68 
75  static int GetCommonBaseTypeId(int typeA, int typeB);
76 
77 protected:
78  vtkDataObjectTypes() = default;
79  ~vtkDataObjectTypes() override = default;
80 
84  static int Validate();
85 
86 private:
87  vtkDataObjectTypes(const vtkDataObjectTypes&) = delete;
88  void operator=(const vtkDataObjectTypes&) = delete;
89 };
90 
91 VTK_ABI_NAMESPACE_END
92 #endif
static vtkDataObjectTypes * New()
static int Validate()
Method used to validate data object types, for testing purposes.
vtkDataObjectTypes()=default
static const char * GetClassNameFromTypeId(int typeId)
Given an int (as defined in vtkType.h) identifier for a class return it's classname.
static vtkDataObject * NewDataObject(int typeId)
Create (New) and return a data object of the given type id.
static bool TypeIdIsA(int typeId, int targetTypeId)
static int GetTypeIdFromClassName(const char *classname)
Given a data object classname, return it's int identified (as defined in vtkType.h)
~vtkDataObjectTypes() override=default
static vtkDataObject * NewDataObject(const char *classname)
Create (New) and return a data object of the given classname.
static int GetCommonBaseTypeId(int typeA, int typeB)
Given two data types, returns the closest common data type.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
general representation of visualization data
Definition: vtkDataObject.h:64
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract base class for most VTK objects
Definition: vtkObject.h:61
#define VTK_NEWINSTANCE