VTK  9.3.20240329
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
124 #ifndef vtkDataObjectTypes_h
125 #define vtkDataObjectTypes_h
126 
127 #include "vtkCommonDataModelModule.h" // For export macro
128 #include "vtkObject.h"
129 
130 VTK_ABI_NAMESPACE_BEGIN
131 class vtkDataObject;
132 
133 class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectTypes : public vtkObject
134 {
135 public:
137 
139  void PrintSelf(ostream& os, vtkIndent indent) override;
140 
145  static const char* GetClassNameFromTypeId(int typeId);
146 
151  static int GetTypeIdFromClassName(const char* classname);
152 
156  static VTK_NEWINSTANCE vtkDataObject* NewDataObject(const char* classname);
157 
162 
163  /*
164  * Returns true if the `typeId` is same or a subclass of
165  * `targetTypeId`.
166  */
167  static bool TypeIdIsA(int typeId, int targetTypeId);
168 
175  static int GetCommonBaseTypeId(int typeA, int typeB);
176 
177 protected:
178  vtkDataObjectTypes() = default;
179  ~vtkDataObjectTypes() override = default;
180 
184  static int Validate();
185 
186 private:
187  vtkDataObjectTypes(const vtkDataObjectTypes&) = delete;
188  void operator=(const vtkDataObjectTypes&) = delete;
189 };
190 
191 VTK_ABI_NAMESPACE_END
192 #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
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:162
#define VTK_NEWINSTANCE