GizmoBase

gzXYZ.h

Go to the documentation of this file.
00001 // *****************************************************************************
00002 // File         : gzXYZ.h
00003 // Module       : gzXYZ
00004 // Description  : Class definition of XYZ templates
00005 // Author       : Anders Modén      
00006 // Product      : GizmoBase 2.1.1
00007 //      
00008 // Copyright © 2003- Saab Training Systems AB, Sweden
00009 //          
00010 // NOTE:    GizmoBase is a platform abstraction utility layer for C++. It contains 
00011 //          design patterns and C++ solutions for the advanced programmer.
00012 //
00013 //
00014 // Revision History...                          
00015 //                                  
00016 // Who  Date    Description                     
00017 //                                  
00018 // AMO  020322  Created file 
00019 //
00020 // ******************************************************************************
00021 
00022 #ifndef __GZ_XYZ_H__
00023 #define __GZ_XYZ_H__
00024 
00030 #include "gzBasicTypes.h"
00031 
00032 //******************************************************************************
00033 // Class    : gzXY
00034 //                                  
00035 // Purpose  : Returns (x,y) pair of T
00036 //                                  
00037 // Notes    : 
00038 //                                  
00039 // Revision History...                          
00040 //                                  
00041 // Who  Date    Description                     
00042 //                                  
00043 // AMO  020322  Created 
00044 //                                  
00045 //******************************************************************************
00046 template <class T> class gzXY 
00047 {
00048 public:
00049 
00050     gzXY(T _x=0,T _y=0):x(_x),y(_y)     {};
00051 
00052     gzXY <T> operator *(const T &right)         { return gzXY<T>(x*right,y*right); }
00053 
00054     gzXY <T> operator /(const T &right)         { return gzXY<T>(x/right,y/right); }
00055 
00056     gzXY <T> operator +(const gzXY<T> &right)   { return gzXY<T>(x+right.x,y+right.y); }
00057 
00058     gzXY <T> operator -(const gzXY<T> &right)   { return gzXY<T>(x-right.x,y-right.y); }
00059 
00060     gzBool operator==(const gzXY<T> &right)     { return (x==right.x)&&(y==right.y); }
00061 
00062     gzBool operator!=(const gzXY<T> &right)     { return (x!=right.x)||(y!=right.y); }
00063 
00064     // Public values
00065 
00066     T x,y;
00067 };
00068 
00069 // Some common pairs
00070 
00071 typedef gzXY<gzULong>   gzULongXY;
00072 typedef gzXY<gzLong>    gzLongXY;
00073 typedef gzXY<gzFloat>   gzFloatXY;
00074 typedef gzXY<gzDouble>  gzDoubleXY;
00075 typedef gzXY<gzReal>    gzRealXY;
00076 typedef gzXY<gzShort>   gzShortXY;
00077 
00078 //******************************************************************************
00079 // Class    : gzXYZ
00080 //                                  
00081 // Purpose  : Returns (x,y,z) pair of T
00082 //                                  
00083 // Notes    : 
00084 //                                  
00085 // Revision History...                          
00086 //                                  
00087 // Who  Date    Description                     
00088 //                                  
00089 // AMO  020322  Created 
00090 //                                  
00091 //******************************************************************************
00092 template <class T> class gzXYZ 
00093 {
00094 public:
00095 
00096     gzXYZ(T _x=0,T _y=0,T _z=0):x(_x),y(_y),z(_z)       {};
00097 
00098     gzXYZ <T> operator *(const T &right)            { return gzXYZ<T>(x*right,y*right,z*right); }
00099 
00100     gzXYZ <T> operator /(const T &right)            { return gzXYZ<T>(x/right,y/right,z/right); }
00101 
00102     gzXYZ <T> operator +(const gzXYZ<T> &right)     { return gzXYZ<T>(x+right.x,y+right.y,z+right.z); }
00103 
00104     gzXYZ <T> operator -(const gzXYZ<T> &right)     { return gzXYZ<T>(x-right.x,y-right.y,z-right.z); }
00105 
00106     gzBool operator==(const gzXYZ<T> &right)        { return (x==right.x) && (y==right.y) && (z==right.z); }
00107 
00108     gzBool operator!=(const gzXYZ<T> &right)        { return (x!=right.x) || (y!=right.y) || (z!=right.z); }
00109 
00110     // Public values
00111 
00112     T x,y,z;
00113 };
00114 
00115 
00116 // Some common pairs
00117 
00118 typedef gzXYZ<gzULong>  gzULongXYZ;
00119 typedef gzXYZ<gzLong>   gzLongXYZ;
00120 typedef gzXYZ<gzFloat>  gzFloatXYZ;
00121 typedef gzXYZ<gzDouble> gzDoubleXYZ;
00122 typedef gzXYZ<gzReal>   gzRealXYZ;
00123 typedef gzXYZ<gzShort>  gzShortXYZ;
00124 
00125 
00126 
00127 #endif // __GZ_XYZ_H__

Documentation for GizmoBase generated at Wed Feb 20 11:57:55 2008 by   Saab Training Systems AB, ¸ (c) 2003-and beyond