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

Generated on Thu Mar 28 14:19:17 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001