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
15 #ifndef vtkDataObjectTypes_h
16 #define vtkDataObjectTypes_h
17 
18 #include "vtkCommonDataModelModule.h" // For export macro
19 #include "vtkObject.h"
20 
21 VTK_ABI_NAMESPACE_BEGIN
22 class vtkDataObject;
23 
24 class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectTypes : public vtkObject
25 {
26 public:
28 
29  vtkTypeMacro(vtkDataObjectTypes, vtkObject);
30  void PrintSelf(ostream& os, vtkIndent indent) override;
31 
36  static const char* GetClassNameFromTypeId(int typeId);
37 
42  static int GetTypeIdFromClassName(const char* classname);
43 
47  static VTK_NEWINSTANCE vtkDataObject* NewDataObject(const char* classname);
48 
53 
54  /*
55  * Returns true if the `typeId` is same or a subclass of
56  * `targetTypeId`.
57  */
58  static bool TypeIdIsA(int typeId, int targetTypeId);
59 
66  static int GetCommonBaseTypeId(int typeA, int typeB);
67 
68 protected:
69  vtkDataObjectTypes() = default;
70  ~vtkDataObjectTypes() override = default;
71 
75  static int Validate();
76 
77 private:
78  vtkDataObjectTypes(const vtkDataObjectTypes&) = delete;
79  void operator=(const vtkDataObjectTypes&) = delete;
80 };
81 
82 VTK_ABI_NAMESPACE_END
83 #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:55
a simple class to control print indentation
Definition: vtkIndent.h:29
abstract base class for most VTK objects
Definition: vtkObject.h:52
#define VTK_NEWINSTANCE