VTK
vtkInformationKey.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkInformationKey.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 =========================================================================*/
28 #ifndef __vtkInformationKey_h
29 #define __vtkInformationKey_h
30 
31 #include "vtkCommonCoreModule.h" // For export macro
32 #include "vtkObjectBase.h"
33 #include "vtkObject.h" // Need vtkTypeMacro
34 
35 class vtkInformation;
36 
38 {
39 public:
41  void PrintSelf(ostream& os, vtkIndent indent);
42 
44  virtual void Register(vtkObjectBase*);
45 
47  virtual void UnRegister(vtkObjectBase*);
48 
51  const char* GetName();
52 
55  const char* GetLocation();
56 
58 
63  vtkInformationKey(const char* name, const char* location);
66 
70  virtual void ShallowCopy(vtkInformation* from, vtkInformation* to)=0;
71 
73 
77  virtual void DeepCopy(vtkInformation *from, vtkInformation *to)
78  { this->ShallowCopy(from, to); }
80 
82  virtual int Has(vtkInformation* info);
83 
85  virtual void Remove(vtkInformation* info);
86 
88  virtual void Report(vtkInformation* info, vtkGarbageCollector* collector);
89 
91 
92  void Print(vtkInformation* info);
93  virtual void Print(ostream& os, vtkInformation* info);
95 
96 protected:
97  const char* Name;
98  const char* Location;
99 
100  // Set/Get the value associated with this key instance in the given
101  // information object.
102  void SetAsObjectBase(vtkInformation* info, vtkObjectBase* value);
103  const vtkObjectBase* GetAsObjectBase(vtkInformation* info) const;
104  vtkObjectBase* GetAsObjectBase(vtkInformation* info);
105 
106  // Report the object associated with this key instance in the given
107  // information object to the collector.
108  void ReportAsObjectBase(vtkInformation* info,
109  vtkGarbageCollector* collector);
110 
111  // Helper for debug leaks support.
112  void ConstructClass(const char*);
113 
114 private:
115  vtkInformationKey(const vtkInformationKey&); // Not implemented.
116  void operator=(const vtkInformationKey&); // Not implemented.
117 };
118 
119 // Macros to define an information key instance in a C++ source file.
120 // The corresponding method declaration must appear in the class
121 // definition in the header file.
122 #define vtkInformationKeyMacro(CLASS, NAME, type) \
123  static vtkInformation##type##Key* CLASS##_##NAME = \
124  new vtkInformation##type##Key(#NAME, #CLASS); \
125  vtkInformation##type##Key* CLASS::NAME() \
126  { \
127  return CLASS##_##NAME; \
128  }
129 #define vtkInformationKeyRestrictedMacro(CLASS, NAME, type, required) \
130  static vtkInformation##type##Key* CLASS##_##NAME = \
131  new vtkInformation##type##Key(#NAME, #CLASS, required); \
132  vtkInformation##type##Key* CLASS::NAME() \
133  { \
134  return CLASS##_##NAME; \
135  }
136 
137 #endif
virtual void Register(vtkObjectBase *o)
virtual void DeepCopy(vtkInformation *from, vtkInformation *to)
Store vtkAlgorithm input/output information.
#define VTKCOMMONCORE_EXPORT
virtual void PrintSelf(ostream &os, vtkIndent indent)
GLsizei const GLfloat * value
Definition: vtkgl.h:12021
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
Detect and break reference loops.
Superclass for vtkInformation keys.
GLuint const GLchar * name
Definition: vtkgl.h:11983
virtual void UnRegister(vtkObjectBase *o)
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract base class for most VTK objects
Definition: vtkObjectBase.h:58
GLint location
Definition: vtkgl.h:12002
const char * Location
void operator=(const vtkObjectBase &)
void Print(ostream &os)