00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Cristin Barghiel 00008 * Side Effects Software Inc. 00009 * 20 Maud St. 00010 * Toronto, Ontario, M5V 2M5 00011 * Canada 00012 * 416-366-4607 00013 * 00014 * NAME: Geometry Library (C++) 00015 * 00016 * COMMENTS: 00017 * The vertex class. As opposed to points, all vertices are unique. 00018 * 00019 * WARNING: Try to avoid using the assignment operator '=' because it is 00020 * shallow in the attribute component! 00021 * 00022 */ 00023 00024 #ifndef __GB_Vertex_H__ 00025 #define __GB_Vertex_H__ 00026 00027 #include "GB_API.h" 00028 #include "GB_Element.h" 00029 00030 class GB_API GB_Vertex { 00031 public: 00032 GB_Vertex(GB_Element *pt = 0) { myPoint = pt; } 00033 00034 // Avoid using this c-tor because it's dangerously shallow! 00035 GB_Vertex(const GB_Vertex &vtx) { myPoint = vtx.myPoint; } // shallow! 00036 00037 virtual ~GB_Vertex() { } 00038 00039 virtual void setPt (GB_Element *pt) { myPoint = pt; } 00040 GB_Element *getBasePt(void) const { return myPoint; } 00041 00042 void steal(GB_Vertex &src) 00043 { 00044 setPt(src.myPoint); 00045 src.setPt(0); 00046 } 00047 00048 void copy(const GB_Vertex *src) 00049 { 00050 setPt(src->myPoint); 00051 } 00052 00053 // Avoid using operator=() because it's dangerously shallow! 00054 GB_Vertex &operator=(const GB_Vertex &vtx) 00055 { 00056 if (this != &vtx) 00057 setPt(vtx.myPoint); 00058 return *this; 00059 00060 } 00061 int operator==(const GB_Vertex &vtx) const 00062 { 00063 // Trivial check to make it simple. Do not change. 00064 return this == &vtx; 00065 } 00066 00067 private: 00068 GB_Element *myPoint; 00069 }; 00070 00071 #endif
1.5.9