VTK  9.2.6
vtkDataObjectTypes.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataObjectTypes.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 =========================================================================*/
36 #ifndef vtkDataObjectTypes_h
37 #define vtkDataObjectTypes_h
38 
39 #include "vtkCommonDataModelModule.h" // For export macro
40 #include "vtkObject.h"
41 
42 class vtkDataObject;
43 
44 class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectTypes : public vtkObject
45 {
46 public:
48 
49  vtkTypeMacro(vtkDataObjectTypes, vtkObject);
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
56  static const char* GetClassNameFromTypeId(int typeId);
57 
62  static int GetTypeIdFromClassName(const char* classname);
63 
67  static vtkDataObject* NewDataObject(const char* classname);
68 
72  static vtkDataObject* NewDataObject(int typeId);
73 
74  /*
75  * Returns true if the `typeId` is same or or a subclass of
76  * `targetTypeId`.
77  */
78  static bool TypeIdIsA(int typeId, int targetTypeId);
79 
86  static int GetCommonBaseTypeId(int typeA, int typeB);
87 
88 protected:
89  vtkDataObjectTypes() = default;
90  ~vtkDataObjectTypes() override = default;
91 
95  static int Validate();
96 
97 private:
98  vtkDataObjectTypes(const vtkDataObjectTypes&) = delete;
99  void operator=(const vtkDataObjectTypes&) = delete;
100 };
101 
102 #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:75
a simple class to control print indentation
Definition: vtkIndent.h:49
abstract base class for most VTK objects
Definition: vtkObject.h:72