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 "vtkObjectBase.h"
32 #include "vtkObject.h" // Need vtkTypeMacro
33 
34 class vtkInformation;
35 
37 {
38 public:
40  void PrintSelf(ostream& os, vtkIndent indent);
41 
43  virtual void Register(vtkObjectBase*);
44 
46  virtual void UnRegister(vtkObjectBase*);
47 
50  const char* GetName();
51 
54  const char* GetLocation();
55 
57 
62  vtkInformationKey(const char* name, const char* location);
65 
69  virtual void ShallowCopy(vtkInformation* from, vtkInformation* to)=0;
70 
72 
76  virtual void DeepCopy(vtkInformation *from, vtkInformation *to)
77  { this->ShallowCopy(from, to); }
79 
81  virtual int Has(vtkInformation* info);
82 
84  virtual void Remove(vtkInformation* info);
85 
87  virtual void Report(vtkInformation* info, vtkGarbageCollector* collector);
88 
90 
91  void Print(vtkInformation* info);
92  virtual void Print(ostream& os, vtkInformation* info);
94 
95 protected:
96  const char* Name;
97  const char* Location;
98 
99  // Set/Get the value associated with this key instance in the given
100  // information object.
101  void SetAsObjectBase(vtkInformation* info, vtkObjectBase* value);
102  vtkObjectBase* GetAsObjectBase(vtkInformation* info);
103 
104  // Report the object associated with this key instance in the given
105  // information object to the collector.
106  void ReportAsObjectBase(vtkInformation* info,
107  vtkGarbageCollector* collector);
108 
109  // Helper for debug leaks support.
110  void ConstructClass(const char*);
111 
112 private:
113  vtkInformationKey(const vtkInformationKey&); // Not implemented.
114  void operator=(const vtkInformationKey&); // Not implemented.
115 };
116 
117 // Macros to define an information key instance in a C++ source file.
118 // The corresponding method declaration must appear in the class
119 // definition in the header file.
120 #define vtkInformationKeyMacro(CLASS, NAME, type) \
121  vtkInformation##type##Key* CLASS::NAME() \
122  { \
123  static vtkInformation##type##Key* CLASS##_##NAME = \
124  new vtkInformation##type##Key(#NAME, #CLASS); \
125  return CLASS##_##NAME; \
126  }
127 #define vtkInformationKeyRestrictedMacro(CLASS, NAME, type, required) \
128  vtkInformation##type##Key* CLASS::NAME() \
129  { \
130  static vtkInformation##type##Key* CLASS##_##NAME = \
131  new vtkInformation##type##Key(#NAME, #CLASS, required); \
132  return CLASS##_##NAME; \
133  }
134 
135 #endif
virtual void Register(vtkObjectBase *o)
virtual void DeepCopy(vtkInformation *from, vtkInformation *to)
Store vtkAlgorithm input/output information.
virtual void PrintSelf(ostream &os, vtkIndent indent)
Detect and break reference loops.
Superclass for vtkInformation keys.
virtual void UnRegister(vtkObjectBase *o)
a simple class to control print indentation
Definition: vtkIndent.h:37
#define VTK_COMMON_EXPORT
abstract base class for most VTK objects
Definition: vtkObjectBase.h:59
const char * Location
void operator=(const vtkObjectBase &)
void Print(ostream &os)