00001 /********************************************************************** 00002 * File: edgeList.H 00003 * 00004 * Designer: Willie Glover 00005 * 00006 * Description: edgeList defines a list of egde IDs and pointers 00007 * into the edge dictionary. Used by legoRegion. 00008 * 00009 * 12/5/96 WAH: Added copy constructor. 00010 * 00011 **********************************************************************/ 00012 #ifndef EDGELIST_H 00013 #define EDGELIST_H 00014 00015 class opEdges; 00016 class edgeList { 00017 opEdges *edgePtr; // pointer into edge dictionary 00018 int edgeId; 00019 int valid; // 0 = invalid, 1 = valid 00020 edgeList *nextListPtr; //this is pointer to next entry in this regions 00021 // edgelist 00022 00023 public: 00024 edgeList(void) 00025 { 00026 edgePtr = NULL; 00027 edgeId = 0; 00028 valid = 0; 00029 nextListPtr = NULL; 00030 // fprintf(stderr,"Creating EDGELIST %p\n",this); 00031 } 00032 edgeList(const edgeList &orig) 00033 { 00034 edgePtr = orig.edgePtr; // don't duplicate (dictionary) 00035 edgeId = orig.edgeId; // will get changed anyway 00036 valid = orig.valid; 00037 if (orig.nextListPtr != NULL) 00038 nextListPtr = new edgeList (*(orig.nextListPtr)); 00039 else 00040 nextListPtr = NULL; 00041 // fprintf(stderr,"Creating EDGELIST %p\n",this); 00042 } // end copy constructor 00043 ~edgeList(void) 00044 { 00045 edgeList* tmpEdgeListPtr = NULL; 00046 while (nextListPtr != NULL) { 00047 tmpEdgeListPtr = nextListPtr; 00048 nextListPtr = tmpEdgeListPtr->nextListPtr; 00049 tmpEdgeListPtr->nextListPtr = NULL; 00050 delete tmpEdgeListPtr; 00051 } 00052 // fprintf(stderr,"Deleting EDGELIST %p\n",this); 00053 } 00054 00055 /********************************************************** 00056 * Get edge pointer 00057 *********************************************************/ 00058 opEdges *GetEdgePtr(void) { return edgePtr; } 00059 00060 /********************************************************** 00061 * Get edge ID 00062 *********************************************************/ 00063 int GetEdgeId(void) { return edgeId; } 00064 00065 /********************************************************** 00066 * Get valid field 00067 *********************************************************/ 00068 int GetValid(void) { return valid; } 00069 00070 /********************************************************** 00071 * Get nextListPtr (pointer to next egdeList entry) 00072 *********************************************************/ 00073 edgeList *GetNextListPtr(void) { return nextListPtr; } 00074 00075 /********************************************************** 00076 * Update opEdges pointer 00077 *********************************************************/ 00078 void SetEdgePtr(opEdges* newEdgePtr) { edgePtr = newEdgePtr; } 00079 00080 /********************************************************** 00081 * Update edge ID 00082 *********************************************************/ 00083 void SetEdgeId(int newEdgeId) { edgeId = newEdgeId; } 00084 00085 /********************************************************** 00086 * Update valid 00087 *********************************************************/ 00088 void SetValid(int newValid) { valid = newValid; } 00089 00090 /********************************************************** 00091 * Update nextListPtr (pointer to next edgeList entry) 00092 *********************************************************/ 00093 void SetNextListPtr(edgeList* newNext) { nextListPtr = newNext; } 00094 00095 // --------------------------------------------------------------------------- 00096 00097 }; 00098 #endif // EDGELIST_H
1.3.2