Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

common/vtkSetGet.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkSetGet.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00054 #ifndef __vtkSetGet_h
00055 #define __vtkSetGet_h
00056 
00057 #include "vtkSystemIncludes.h"
00058 #include <math.h>
00059 
00060 // Some constants used throughout the code
00061 #define VTK_LARGE_FLOAT 1.0e+38F
00062 #define VTK_LARGE_INTEGER 2147483647 // 2^31 - 1
00063 
00064 // These types are returned by GetDataType to indicate pixel type.
00065 #define VTK_VOID            0
00066 #define VTK_BIT             1 
00067 #define VTK_CHAR            2
00068 #define VTK_UNSIGNED_CHAR   3
00069 #define VTK_SHORT           4
00070 #define VTK_UNSIGNED_SHORT  5
00071 #define VTK_INT             6
00072 #define VTK_UNSIGNED_INT    7
00073 #define VTK_LONG            8
00074 #define VTK_UNSIGNED_LONG   9
00075 #define VTK_FLOAT          10
00076 #define VTK_DOUBLE         11 
00077 
00078 // Some constant required for correct template performance
00079 #define VTK_BIT_MIN 0
00080 #define VTK_BIT_MAX 1
00081 #define VTK_CHAR_MIN -128
00082 #define VTK_CHAR_MAX 127
00083 #define VTK_UNSIGNED_CHAR_MIN 0
00084 #define VTK_UNSIGNED_CHAR_MAX 255
00085 #define VTK_SHORT_MIN -32768
00086 #define VTK_SHORT_MAX 32767
00087 #define VTK_UNSIGNED_SHORT_MIN 0
00088 #define VTK_UNSIGNED_SHORT_MAX 65535
00089 #define VTK_INT_MIN (-VTK_LARGE_INTEGER-1)
00090 #define VTK_INT_MAX VTK_LARGE_INTEGER
00091 #define VTK_UNSIGNED_INT_MIN 0
00092 #define VTK_UNSIGNED_INT_MAX 4294967295UL
00093 #define VTK_LONG_MIN (-VTK_LARGE_INTEGER-1)
00094 #define VTK_LONG_MAX VTK_LARGE_INTEGER
00095 #define VTK_UNSIGNED_LONG_MIN 0
00096 #define VTK_UNSIGNED_LONG_MAX 4294967295UL
00097 #define VTK_FLOAT_MIN -VTK_LARGE_FLOAT
00098 #define VTK_FLOAT_MAX VTK_LARGE_FLOAT
00099 #define VTK_DOUBLE_MIN -1.0e+99L
00100 #define VTK_DOUBLE_MAX  1.0e+99L
00101 
00102 // These types are returned to distinguish data object types
00103 #define VTK_POLY_DATA          0
00104 #define VTK_STRUCTURED_POINTS  1
00105 #define VTK_STRUCTURED_GRID    2
00106 #define VTK_RECTILINEAR_GRID   3
00107 #define VTK_UNSTRUCTURED_GRID  4
00108 #define VTK_PIECEWISE_FUNCTION  5
00109 #define VTK_IMAGE_DATA 6
00110 #define VTK_DATA_OBJECT 7
00111 #define VTK_DATA_SET 8
00112 
00113 // A macro to get the name of a type
00114 #define vtkImageScalarTypeNameMacro(type) \
00115 (((type) == VTK_VOID) ? "void" : \
00116 (((type) == VTK_FLOAT) ? "float" : \
00117 (((type) == VTK_INT) ? "int" : \
00118 (((type) == VTK_SHORT) ? "short" : \
00119 (((type) == VTK_UNSIGNED_SHORT) ? "unsigned short" : \
00120 (((type) == VTK_UNSIGNED_CHAR) ? "unsigned char" : \
00121 "Undefined"))))))
00122   
00123   
00124 //
00125 // Set built-in type.  Creates member Set"name"() (e.g., SetVisibility());
00126 //
00127 #define vtkSetMacro(name,type) \
00128 virtual void Set##name (type _arg) \
00129   { \
00130   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " #name " to " << _arg); \
00131   if (this->name != _arg) \
00132     { \
00133     this->name = _arg; \
00134     this->Modified(); \
00135     } \
00136   } 
00137 
00138 //
00139 // Get built-in type.  Creates member Get"name"() (e.g., GetVisibility());
00140 //
00141 #define vtkGetMacro(name,type) \
00142 virtual type Get##name () { \
00143   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " << #name " of " << this->name ); \
00144   return this->name; \
00145   } 
00146 
00147 
00148 //
00149 // Set character string.  Creates member Set"name"() 
00150 // (e.g., SetFilename(char *));
00151 //
00152 #define vtkSetStringMacro(name) \
00153 virtual void Set##name (const char* _arg) \
00154   { \
00155   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to " << _arg ); \
00156   if ( this->name && _arg && (!strcmp(this->name,_arg))) { return;} \
00157   if (this->name) { delete [] this->name; } \
00158   if (_arg) \
00159     { \
00160     this->name = new char[strlen(_arg)+1]; \
00161     strcpy(this->name,_arg); \
00162     } \
00163    else \
00164     { \
00165     this->name = NULL; \
00166     } \
00167   this->Modified(); \
00168   } 
00169 
00170 //
00171 // Get character string.  Creates member Get"name"() 
00172 // (e.g., char *GetFilename());
00173 //
00174 #define vtkGetStringMacro(name) \
00175 virtual char* Get##name () { \
00176   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " << #name " of " << this->name); \
00177   return this->name; \
00178   } 
00179 
00180 //
00181 // Set built-in type where value is constrained between min/max limits.
00182 // Create member Set"name"() (eg., SetRadius()). #defines are 
00183 // convenience for clamping open-ended values.
00184 //
00185 #define vtkSetClampMacro(name,type,min,max) \
00186 virtual void Set##name (type _arg) \
00187   { \
00188   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to " << _arg ); \
00189   if (this->name != (_arg<min?min:(_arg>max?max:_arg))) \
00190     { \
00191     this->name = (_arg<min?min:(_arg>max?max:_arg)); \
00192     this->Modified(); \
00193     } \
00194   } 
00195 
00196 //
00197 // Set pointer to object; uses vtkObject reference counting methodology.
00198 // Creates method Set"name"() (e.g., SetPoints()).
00199 //
00200 #define vtkSetObjectMacro(name,type) \
00201 virtual void Set##name (type* _arg) \
00202   { \
00203   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to " << _arg ); \
00204   if (this->name != _arg) \
00205     { \
00206     if (this->name != NULL) { this->name->UnRegister(this); }\
00207     this->name = _arg; \
00208     if (this->name != NULL) { this->name->Register(this); } \
00209     this->Modified(); \
00210     } \
00211   } 
00212 
00213 //
00214 // Identical to vtkSetObjectMacro. Left in for legacy compatibility.
00215 //
00216 #define vtkSetReferenceCountedObjectMacro(name,type) \
00217 virtual void Set##name (type* _arg) \
00218   { \
00219   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to " << _arg ); \
00220   if (this->name != _arg) \
00221     { \
00222     if (this->name != NULL) { this->name->UnRegister(this); }\
00223     this->name = _arg; \
00224     if (this->name != NULL) { this->name->Register(this); } \
00225     this->Modified(); \
00226     } \
00227   } 
00228 
00229 //
00230 // Get pointer to object.  Creates member Get"name" (e.g., GetPoints()).
00231 //
00232 #define vtkGetObjectMacro(name,type) \
00233 virtual type *Get##name () \
00234   { \
00235       vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " #name " address " << this->name ); \
00236   return this->name; \
00237   } 
00238 
00239 //
00240 // Create members "name"On() and "name"Off() (e.g., DebugOn() DebugOff()).
00241 // Set method must be defined to use this macro.
00242 //
00243 #define vtkBooleanMacro(name,type) \
00244 virtual void name##On () { this->Set##name((type)1);}; \
00245 virtual void name##Off () { this->Set##name((type)0);}
00246 
00247 //
00248 // Following set macros for vectors define two members for each macro.  The first 
00249 // allows setting of individual components (e.g, SetColor(float,float,float)), 
00250 // the second allows setting from an array (e.g., SetColor(float* rgb[3])).
00251 // The macros vary in the size of the vector they deal with.
00252 //
00253 #define vtkSetVector2Macro(name,type) \
00254 virtual void Set##name (type _arg1, type _arg2) \
00255   { \
00256   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to (" << _arg1 << "," << _arg2 << ")"); \
00257   if ((this->name[0] != _arg1)||(this->name[1] != _arg2)) \
00258     { \
00259     this->Modified(); \
00260     this->name[0] = _arg1; \
00261     this->name[1] = _arg2; \
00262     } \
00263   }; \
00264 void Set##name (type _arg[2]) \
00265   { \
00266   this->Set##name (_arg[0], _arg[1]); \
00267   } 
00268 
00269 #define vtkGetVector2Macro(name,type) \
00270 virtual type *Get##name () \
00271 { \
00272   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " << #name " pointer " << this->name); \
00273   return this->name; \
00274 } \
00275 virtual void Get##name (type &_arg1, type &_arg2) \
00276   { \
00277     _arg1 = this->name[0]; \
00278     _arg2 = this->name[1]; \
00279   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " << #name " = (" << _arg1 << "," << _arg2 << ")"); \
00280   }; \
00281 virtual void Get##name (type _arg[2]) \
00282   { \
00283   this->Get##name (_arg[0], _arg[1]);\
00284   } 
00285 
00286 #define vtkSetVector3Macro(name,type) \
00287 virtual void Set##name (type _arg1, type _arg2, type _arg3) \
00288   { \
00289   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to (" << _arg1 << "," << _arg2 << "," << _arg3 << ")"); \
00290   if ((this->name[0] != _arg1)||(this->name[1] != _arg2)||(this->name[2] != _arg3)) \
00291     { \
00292     this->Modified(); \
00293     this->name[0] = _arg1; \
00294     this->name[1] = _arg2; \
00295     this->name[2] = _arg3; \
00296     } \
00297   }; \
00298 virtual void Set##name (type _arg[3]) \
00299   { \
00300   this->Set##name (_arg[0], _arg[1], _arg[2]);\
00301   } 
00302 
00303 #define vtkGetVector3Macro(name,type) \
00304 virtual type *Get##name () \
00305 { \
00306   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " << #name " pointer " << this->name); \
00307   return this->name; \
00308 } \
00309 virtual void Get##name (type &_arg1, type &_arg2, type &_arg3) \
00310   { \
00311     _arg1 = this->name[0]; \
00312     _arg2 = this->name[1]; \
00313     _arg3 = this->name[2]; \
00314   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " << #name " = (" << _arg1 << "," << _arg2 << "," << _arg3 << ")"); \
00315   }; \
00316 virtual void Get##name (type _arg[3]) \
00317   { \
00318   this->Get##name (_arg[0], _arg[1], _arg[2]);\
00319   } 
00320 
00321 #define vtkSetVector4Macro(name,type) \
00322 virtual void Set##name (type _arg1, type _arg2, type _arg3, type _arg4) \
00323   { \
00324   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to (" << _arg1 << "," << _arg2 << "," << _arg3 << "," << _arg4 << ")"); \
00325   if ((this->name[0] != _arg1)||(this->name[1] != _arg2)||(this->name[2] != _arg3)||(this->name[3] != _arg4)) \
00326     { \
00327     this->Modified(); \
00328     this->name[0] = _arg1; \
00329     this->name[1] = _arg2; \
00330     this->name[2] = _arg3; \
00331     this->name[3] = _arg4; \
00332     } \
00333   }; \
00334 virtual void Set##name (type _arg[4]) \
00335   { \
00336   this->Set##name (_arg[0], _arg[1], _arg[2], _arg[3]);\
00337   } 
00338 
00339 
00340 #define vtkGetVector4Macro(name,type) \
00341 virtual type *Get##name () \
00342 { \
00343   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " << #name " pointer " << this->name); \
00344   return this->name; \
00345 } \
00346 virtual void Get##name (type &_arg1, type &_arg2, type &_arg3, type &_arg4) \
00347   { \
00348     _arg1 = this->name[0]; \
00349     _arg2 = this->name[1]; \
00350     _arg3 = this->name[2]; \
00351     _arg4 = this->name[3]; \
00352   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " << #name " = (" << _arg1 << "," << _arg2 << "," << _arg3 << "," << _arg4 << ")"); \
00353   }; \
00354 virtual void Get##name (type _arg[4]) \
00355   { \
00356   this->Get##name (_arg[0], _arg[1], _arg[2], _arg[3]);\
00357   } 
00358 
00359 #define vtkSetVector6Macro(name,type) \
00360 virtual void Set##name (type _arg1, type _arg2, type _arg3, type _arg4, type _arg5, type _arg6) \
00361   { \
00362   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to (" << _arg1 << "," << _arg2 << "," << _arg3 << "," << _arg4 << "," << _arg5 << "," << _arg6 << ")"); \
00363   if ((this->name[0] != _arg1)||(this->name[1] != _arg2)||(this->name[2] != _arg3)||(this->name[3] != _arg4)||(this->name[4] != _arg5)||(this->name[5] != _arg6)) \
00364     { \
00365     this->Modified(); \
00366     this->name[0] = _arg1; \
00367     this->name[1] = _arg2; \
00368     this->name[2] = _arg3; \
00369     this->name[3] = _arg4; \
00370     this->name[4] = _arg5; \
00371     this->name[5] = _arg6; \
00372     } \
00373   }; \
00374 virtual void Set##name (type _arg[6]) \
00375   { \
00376   this->Set##name (_arg[0], _arg[1], _arg[2], _arg[3], _arg[4], _arg[5]);\
00377   } 
00378 
00379 #define vtkGetVector6Macro(name,type) \
00380 virtual type *Get##name () \
00381 { \
00382   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " << #name " pointer " << this->name); \
00383   return this->name; \
00384 } \
00385 virtual void Get##name (type &_arg1, type &_arg2, type &_arg3, type &_arg4, type &_arg5, type &_arg6) \
00386   { \
00387     _arg1 = this->name[0]; \
00388     _arg2 = this->name[1]; \
00389     _arg3 = this->name[2]; \
00390     _arg4 = this->name[3]; \
00391     _arg5 = this->name[4]; \
00392     _arg6 = this->name[5]; \
00393   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " << #name " = (" << _arg1 << "," << _arg2 << "," << _arg3 << "," << _arg4 << "," << _arg5 <<"," << _arg6 << ")"); \
00394   }; \
00395 virtual void Get##name (type _arg[6]) \
00396   { \
00397   this->Get##name (_arg[0], _arg[1], _arg[2], _arg[3], _arg[4], _arg[5]);\
00398   } 
00399 
00400 //
00401 // General set vector macro creates a single method that copies specified
00402 // number of values into object.
00403 // Examples: void SetColor(c,3)
00404 //
00405 #define vtkSetVectorMacro(name,type,count) \
00406 virtual void Set##name(type data[]) \
00407 { \
00408   int i; \
00409   for (i=0; i<count; i++) { if ( data[i] != this->name[i] ) { break; }} \
00410   if ( i < count ) \
00411     { \
00412     this->Modified(); \
00413     for (i=0; i<count; i++) { this->name[i] = data[i]; }\
00414     } \
00415 }
00416 
00417 //
00418 // Get vector macro defines two methods. One returns pointer to type 
00419 // (i.e., array of type). This is for efficiency. The second copies data
00420 // into user provided array. This is more object-oriented.
00421 // Examples: float *GetColor() and void GetColor(float c[count]).
00422 //
00423 #define vtkGetVectorMacro(name,type,count) \
00424 virtual type *Get##name () \
00425 { \
00426   vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " << #name " pointer " << this->name); \
00427   return this->name; \
00428 } \
00429 virtual void Get##name (type data[count]) \
00430 { \
00431   for (int i=0; i<count; i++) { data[i] = this->name[i]; }\
00432 }
00433 
00434 // Use a global function which actually calls:
00435 //  vtkOutputWindow::GetInstance()->DisplayText();
00436 // This is to avoid vtkObject #include of vtkOutputWindow
00437 // while vtkOutputWindow #includes vtkObject
00438 
00439 extern VTK_EXPORT void vtkOutputWindowDisplayText(const char*);
00440 
00441 
00442 //
00443 // This macro is used for any output that may not be in an instance method
00444 // vtkGenericWarningMacro(<< "this is debug info" << this->SomeVariable);
00445 //
00446 #define vtkGenericWarningMacro(x) \
00447 { if (vtkObject::GetGlobalWarningDisplay()) { \
00448       char *vtkmsgbuff; ostrstream vtkmsg; \
00449       vtkmsg << "Generic Warning: In " __FILE__ ", line " << __LINE__ << "\n" x \
00450       << "\n\n" << ends; \
00451       vtkmsgbuff = vtkmsg.str(); \
00452       vtkOutputWindowDisplayText(vtkmsgbuff);\
00453       vtkmsg.rdbuf()->freeze(0);}}
00454 
00455 //
00456 // This macro is used for  debug statements in instance methods
00457 // vtkDebugMacro(<< "this is debug info" << this->SomeVariable);
00458 //
00459 #ifdef VTK_LEAN_AND_MEAN
00460 #define vtkDebugMacro(x)
00461 #else
00462 #define vtkDebugMacro(x) \
00463 { if (this->Debug && vtkObject::GetGlobalWarningDisplay()) \
00464     { char *vtkmsgbuff; \
00465       ostrstream vtkmsg; \
00466       vtkmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): " x  << "\n\n" << ends; \
00467       vtkmsgbuff = vtkmsg.str(); \
00468       vtkOutputWindowDisplayText(vtkmsgbuff);\
00469       vtkmsg.rdbuf()->freeze(0);}}
00470 #endif
00471 //
00472 // This macro is used to print out warning messages.
00473 // vtkWarningMacro(<< "Warning message" << variable);
00474 //
00475 #define vtkWarningMacro(x) \
00476 { if (vtkObject::GetGlobalWarningDisplay()) { \
00477       char *vtkmsgbuff; \
00478       ostrstream vtkmsg; \
00479       vtkmsg << "Warning: In " __FILE__ ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): " x << "\n\n" << ends; \
00480       vtkmsgbuff = vtkmsg.str(); \
00481       vtkOutputWindowDisplayText(vtkmsgbuff);\
00482       vtkmsg.rdbuf()->freeze(0);}}
00483 
00484 //
00485 // This macro is used to print out errors
00486 // vtkErrorMacro(<< "Error message" << variable);
00487 //
00488 #define vtkErrorMacro(x) \
00489 { if (vtkObject::GetGlobalWarningDisplay()) {char *vtkmsgbuff; \
00490       ostrstream vtkmsg; \
00491       vtkmsg << "ERROR: In " __FILE__ ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): " x << "\n\n" << ends; \
00492       vtkmsgbuff = vtkmsg.str(); \
00493       vtkOutputWindowDisplayText(vtkmsgbuff);\
00494       vtkmsg.rdbuf()->freeze(0); vtkObject::BreakOnError();}}
00495 
00496 
00497 
00498 //
00499 // This macro is used to quiet compiler warnings about unused parameters
00500 // to methods. Only use it when the parameter really shouldn't be used.
00501 // Don't use it as a way to shut up the compiler while you take your
00502 // sweet time getting around to implementing the method.
00503 //
00504 #define vtkNotUsed(x)
00505 
00506 #define vtkWorldCoordinateMacro(name) \
00507 virtual vtkCoordinate *Get##name##Coordinate () \
00508 { \
00509     vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " #name "Coordinate address " << this->name##Coordinate ); \
00510     return this->name##Coordinate; \
00511 } \
00512 virtual void Set##name(float x[3]) {this->Set##name(x[0],x[1],x[2]);}; \
00513 virtual void Set##name(float x, float y, float z) \
00514 { \
00515     this->name##Coordinate->SetCoordinateSystem(VTK_WORLD); \
00516     this->name##Coordinate->SetValue(x,y,z); \
00517 } \
00518 virtual float *Get##name() \
00519 { \
00520     return this->name##Coordinate->GetValue(); \
00521 }
00522 
00523 #define vtkViewportCoordinateMacro(name) \
00524 virtual vtkCoordinate *Get##name##Coordinate () \
00525 { \
00526     vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning " #name "Coordinate address " << this->name##Coordinate ); \
00527     return this->name##Coordinate; \
00528 } \
00529 virtual void Set##name(float x[2]) {this->Set##name(x[0],x[1]);}; \
00530 virtual void Set##name(float x, float y) \
00531 { \
00532     this->name##Coordinate->SetCoordinateSystem(VTK_VIEWPORT); \
00533     this->name##Coordinate->SetValue(x,y); \
00534 } \
00535 virtual float *Get##name() \
00536 { \
00537     return this->name##Coordinate->GetValue(); \
00538 }
00539 
00540 // Macro used to determine whether a class is the same class or
00541 // a subclass of the named class.
00542 //
00543 #define vtkTypeMacro(thisClass,superclass) \
00544 virtual const char *GetClassName() {return #thisClass;};\
00545 static int IsTypeOf(const char *type) \
00546 { \
00547   if ( !strcmp(#thisClass,type) ) \
00548     { \
00549     return 1; \
00550     } \
00551   return superclass::IsTypeOf(type); \
00552 } \
00553 virtual int IsA(const char *type) \
00554 { \
00555   return this->thisClass::IsTypeOf(type); \
00556 } \
00557 static thisClass* SafeDownCast(vtkObject *o) \
00558 { \
00559   if ( o && o->IsA(#thisClass) ) \
00560     { \
00561     return (thisClass *)o; \
00562     } \
00563   return NULL;\
00564 }
00565 
00566 
00567 // The following macros are all just there to centralize the template 
00568 // switch code so that every execute method doesn't have to have the same
00569 // long list if case statements
00570 
00571 #define vtkTemplateMacro3(func, arg1, arg2, arg3) \
00572       case VTK_DOUBLE: \
00573         { typedef double VTK_TT; \
00574         func(arg1, arg2, arg3); } \
00575         break; \
00576       case VTK_FLOAT: \
00577         { typedef float VTK_TT; \
00578         func(arg1, arg2, arg3); } \
00579         break; \
00580       case VTK_LONG: \
00581         { typedef long VTK_TT; \
00582         func(arg1, arg2, arg3); } \
00583         break; \
00584       case VTK_UNSIGNED_LONG: \
00585         { typedef unsigned long VTK_TT; \
00586         func(arg1, arg2, arg3); } \
00587         break; \
00588       case VTK_INT: \
00589         { typedef int VTK_TT; \
00590         func(arg1, arg2, arg3); } \
00591         break; \
00592       case VTK_UNSIGNED_INT: \
00593         { typedef unsigned int VTK_TT; \
00594         func(arg1, arg2, arg3); } \
00595         break; \
00596       case VTK_SHORT: \
00597         { typedef short VTK_TT; \
00598         func(arg1, arg2, arg3); } \
00599         break; \
00600       case VTK_UNSIGNED_SHORT: \
00601         { typedef unsigned short VTK_TT; \
00602         func(arg1, arg2, arg3); } \
00603         break; \
00604       case VTK_CHAR: \
00605         { typedef char VTK_TT; \
00606         func(arg1, arg2, arg3); } \
00607         break; \
00608       case VTK_UNSIGNED_CHAR: \
00609         { typedef unsigned char VTK_TT; \
00610         func(arg1, arg2, arg3); } \
00611         break
00612 
00613 #define vtkTemplateMacro4(func, arg1, arg2, arg3, arg4) \
00614       case VTK_DOUBLE: \
00615         { typedef double VTK_TT; \
00616         func(arg1, arg2, arg3, arg4); } \
00617         break; \
00618       case VTK_FLOAT: \
00619         { typedef float VTK_TT; \
00620         func(arg1, arg2, arg3, arg4); } \
00621         break; \
00622       case VTK_LONG: \
00623         { typedef long VTK_TT; \
00624         func(arg1, arg2, arg3, arg4); } \
00625         break; \
00626       case VTK_UNSIGNED_LONG: \
00627         { typedef unsigned long VTK_TT; \
00628         func(arg1, arg2, arg3, arg4); } \
00629         break; \
00630       case VTK_INT: \
00631         { typedef int VTK_TT; \
00632         func(arg1, arg2, arg3, arg4); } \
00633         break; \
00634       case VTK_UNSIGNED_INT: \
00635         { typedef unsigned int VTK_TT; \
00636         func(arg1, arg2, arg3, arg4); } \
00637         break; \
00638       case VTK_SHORT: \
00639         { typedef short VTK_TT; \
00640         func(arg1, arg2, arg3, arg4); } \
00641         break; \
00642       case VTK_UNSIGNED_SHORT: \
00643         { typedef unsigned short VTK_TT; \
00644         func(arg1, arg2, arg3, arg4); } \
00645         break; \
00646       case VTK_CHAR: \
00647         { typedef char VTK_TT; \
00648         func(arg1, arg2, arg3, arg4); } \
00649         break; \
00650       case VTK_UNSIGNED_CHAR: \
00651         { typedef unsigned char VTK_TT; \
00652         func(arg1, arg2, arg3, arg4); } \
00653         break
00654 
00655 #define vtkTemplateMacro5(func, arg1, arg2, arg3, arg4, arg5) \
00656       case VTK_DOUBLE: \
00657         { typedef double VTK_TT; \
00658         func(arg1, arg2, arg3, arg4, arg5); } \
00659         break; \
00660       case VTK_FLOAT: \
00661         { typedef float VTK_TT; \
00662         func(arg1, arg2, arg3, arg4, arg5); } \
00663         break; \
00664       case VTK_LONG: \
00665         { typedef long VTK_TT; \
00666         func(arg1, arg2, arg3, arg4, arg5); } \
00667         break; \
00668       case VTK_UNSIGNED_LONG: \
00669         { typedef unsigned long VTK_TT; \
00670         func(arg1, arg2, arg3, arg4, arg5); } \
00671         break; \
00672       case VTK_INT: \
00673         { typedef int VTK_TT; \
00674         func(arg1, arg2, arg3, arg4, arg5); } \
00675         break; \
00676       case VTK_UNSIGNED_INT: \
00677         { typedef unsigned int VTK_TT; \
00678         func(arg1, arg2, arg3, arg4, arg5); } \
00679         break; \
00680       case VTK_SHORT: \
00681         { typedef short VTK_TT; \
00682         func(arg1, arg2, arg3, arg4, arg5); } \
00683         break; \
00684       case VTK_UNSIGNED_SHORT: \
00685         { typedef unsigned short VTK_TT; \
00686         func(arg1, arg2, arg3, arg4, arg5); } \
00687         break; \
00688       case VTK_CHAR: \
00689         { typedef char VTK_TT; \
00690         func(arg1, arg2, arg3, arg4, arg5); } \
00691         break; \
00692       case VTK_UNSIGNED_CHAR: \
00693         { typedef unsigned char VTK_TT; \
00694         func(arg1, arg2, arg3, arg4, arg5); } \
00695         break
00696 
00697 #define vtkTemplateMacro6(func, arg1, arg2, arg3, arg4, arg5, arg6) \
00698       case VTK_DOUBLE: \
00699         { typedef double VTK_TT; \
00700         func(arg1, arg2, arg3, arg4, arg5, arg6); } \
00701         break; \
00702       case VTK_FLOAT: \
00703         { typedef float VTK_TT; \
00704         func(arg1, arg2, arg3, arg4, arg5, arg6); } \
00705         break; \
00706       case VTK_LONG: \
00707         { typedef long VTK_TT; \
00708         func(arg1, arg2, arg3, arg4, arg5, arg6); } \
00709         break; \
00710       case VTK_UNSIGNED_LONG: \
00711         { typedef unsigned long VTK_TT; \
00712         func(arg1, arg2, arg3, arg4, arg5, arg6); } \
00713         break; \
00714       case VTK_INT: \
00715         { typedef int VTK_TT; \
00716         func(arg1, arg2, arg3, arg4, arg5, arg6); } \
00717         break; \
00718       case VTK_UNSIGNED_INT: \
00719         { typedef unsigned int VTK_TT; \
00720         func(arg1, arg2, arg3, arg4, arg5, arg6); } \
00721         break; \
00722       case VTK_SHORT: \
00723         { typedef short VTK_TT; \
00724         func(arg1, arg2, arg3, arg4, arg5, arg6); } \
00725         break; \
00726       case VTK_UNSIGNED_SHORT: \
00727         { typedef unsigned short VTK_TT; \
00728         func(arg1, arg2, arg3, arg4, arg5, arg6); } \
00729         break; \
00730       case VTK_CHAR: \
00731         { typedef char VTK_TT; \
00732         func(arg1, arg2, arg3, arg4, arg5, arg6); } \
00733         break; \
00734       case VTK_UNSIGNED_CHAR: \
00735         { typedef unsigned char VTK_TT; \
00736         func(arg1, arg2, arg3, arg4, arg5, arg6); } \
00737         break
00738           
00739 #define vtkTemplateMacro7(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
00740       case VTK_DOUBLE: \
00741         { typedef double VTK_TT; \
00742         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7); } \
00743         break; \
00744       case VTK_FLOAT: \
00745         { typedef float VTK_TT; \
00746         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7); } \
00747         break; \
00748       case VTK_LONG: \
00749         { typedef long VTK_TT; \
00750         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7); } \
00751         break; \
00752       case VTK_UNSIGNED_LONG: \
00753         { typedef unsigned long VTK_TT; \
00754         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7); } \
00755         break; \
00756       case VTK_INT: \
00757         { typedef int VTK_TT; \
00758         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7); } \
00759         break; \
00760       case VTK_UNSIGNED_INT: \
00761         { typedef unsigned int VTK_TT; \
00762         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7); } \
00763         break; \
00764       case VTK_SHORT: \
00765         { typedef short VTK_TT; \
00766         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7); } \
00767         break; \
00768       case VTK_UNSIGNED_SHORT: \
00769         { typedef unsigned short VTK_TT; \
00770         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7); } \
00771         break; \
00772       case VTK_CHAR: \
00773         { typedef char VTK_TT; \
00774         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7); } \
00775         break; \
00776       case VTK_UNSIGNED_CHAR: \
00777         { typedef unsigned char VTK_TT; \
00778         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7); } \
00779         break
00780           
00781 #define vtkTemplateMacro8(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
00782       case VTK_DOUBLE: \
00783         { typedef double VTK_TT; \
00784         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } \
00785         break; \
00786       case VTK_FLOAT: \
00787         { typedef float VTK_TT; \
00788         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } \
00789         break; \
00790       case VTK_LONG: \
00791         { typedef long VTK_TT; \
00792         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } \
00793         break; \
00794       case VTK_UNSIGNED_LONG: \
00795         { typedef unsigned long VTK_TT; \
00796         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } \
00797         break; \
00798       case VTK_INT: \
00799         { typedef int VTK_TT; \
00800         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } \
00801         break; \
00802       case VTK_UNSIGNED_INT: \
00803         { typedef unsigned int VTK_TT; \
00804         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } \
00805         break; \
00806       case VTK_SHORT: \
00807         { typedef short VTK_TT; \
00808         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } \
00809         break; \
00810       case VTK_UNSIGNED_SHORT: \
00811         { typedef unsigned short VTK_TT; \
00812         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } \
00813         break; \
00814       case VTK_CHAR: \
00815         { typedef char VTK_TT; \
00816         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } \
00817         break; \
00818       case VTK_UNSIGNED_CHAR: \
00819         { typedef unsigned char VTK_TT; \
00820         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } \
00821         break
00822 
00823 #define vtkTemplateMacro9(func,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) \
00824       case VTK_DOUBLE: \
00825         { typedef double VTK_TT; \
00826         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); } \
00827         break; \
00828       case VTK_FLOAT: \
00829         { typedef float VTK_TT; \
00830         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); } \
00831         break; \
00832       case VTK_LONG: \
00833         { typedef long VTK_TT; \
00834         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); } \
00835         break; \
00836       case VTK_UNSIGNED_LONG: \
00837         { typedef unsigned long VTK_TT; \
00838         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); } \
00839         break; \
00840       case VTK_INT: \
00841         { typedef int VTK_TT; \
00842         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); } \
00843         break; \
00844       case VTK_UNSIGNED_INT: \
00845         { typedef unsigned int VTK_TT; \
00846         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); } \
00847         break; \
00848       case VTK_SHORT: \
00849         { typedef short VTK_TT; \
00850         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); } \
00851         break; \
00852       case VTK_UNSIGNED_SHORT: \
00853         { typedef unsigned short VTK_TT; \
00854         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); } \
00855         break; \
00856       case VTK_CHAR: \
00857         { typedef char VTK_TT; \
00858         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); } \
00859         break; \
00860       case VTK_UNSIGNED_CHAR: \
00861         { typedef unsigned char VTK_TT; \
00862         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); } \
00863         break
00864 
00865 #define vtkTemplateMacro10(func,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) \
00866       case VTK_DOUBLE: \
00867         { typedef double VTK_TT; \
00868         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } \
00869         break; \
00870       case VTK_FLOAT: \
00871         { typedef float VTK_TT; \
00872         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } \
00873         break; \
00874       case VTK_LONG: \
00875         { typedef long VTK_TT; \
00876         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } \
00877         break; \
00878       case VTK_UNSIGNED_LONG: \
00879         { typedef unsigned long VTK_TT; \
00880         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } \
00881         break; \
00882       case VTK_INT: \
00883         { typedef int VTK_TT; \
00884         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } \
00885         break; \
00886       case VTK_UNSIGNED_INT: \
00887         { typedef unsigned int VTK_TT; \
00888         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } \
00889         break; \
00890       case VTK_SHORT: \
00891         { typedef short VTK_TT; \
00892         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } \
00893         break; \
00894       case VTK_UNSIGNED_SHORT: \
00895         { typedef unsigned short VTK_TT; \
00896         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } \
00897         break; \
00898       case VTK_CHAR: \
00899         { typedef char VTK_TT; \
00900         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } \
00901         break; \
00902       case VTK_UNSIGNED_CHAR: \
00903         { typedef unsigned char VTK_TT; \
00904         func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } \
00905         break
00906 
00907 // Use to mark methods legacy. Make sure the correct date is used to
00908 // keep track of when a method was made legacy, and so that it can be
00909 // eliminated at the right time.
00910 #ifdef VTK_LEAN_AND_MEAN
00911 #define VTK_LEGACY_METHOD(oldMethod,versionStringMadeLegacy) \
00912   vtkErrorMacro(<< #oldMethod \
00913                 << " was obsoleted for version " << #versionStringMadeLegacy \
00914                 << " and will be removed in a future version");
00915 #else
00916 #define VTK_LEGACY_METHOD(oldMethod,versionStringMadeLegacy)
00917 #endif
00918 
00919 
00920 #endif
00921 

Generated on Wed Nov 21 12:26:54 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001