00001 /*------------------------------------------------------------------- 00002 * File: opList.H 00003 * 00004 * Designer: Willie Glover 00005 * 00006 * Description: opList defines a list of ops with an associated 00007 * weight. It is used by legoOp and legoRegion. 00008 * 00009 * 00010 * 12/05/96 WAH: Added copy constructor. 00011 *--------------------------------------------------------------------*/ 00012 #ifndef OPLIST_H 00013 #define OPLIST_H 00014 00015 class legoOp; 00016 class opList { 00017 legoOp *opPtr; 00018 int opId; 00019 int valid; 00020 double weight; 00021 opList *nextListPtr; 00022 00023 public: 00024 opList(void) 00025 { 00026 opPtr = NULL; 00027 opId = 0; 00028 valid = 0; 00029 weight = 0.0; 00030 nextListPtr = NULL; 00031 // fprintf(stderr,"Creating OPLIST %p\n",this); 00032 } 00033 opList(const opList &orig) 00034 { 00035 opPtr = orig.opPtr; // will be changed anyway 00036 opId = orig.opId; // will be changed anyway 00037 valid = orig.valid; 00038 weight = orig.weight; // may be changed anyway 00039 if (orig.nextListPtr != NULL) 00040 nextListPtr = new opList (*(orig.nextListPtr)); 00041 else 00042 nextListPtr = NULL; 00043 // fprintf(stderr,"Creating OPLIST %p\n",this); 00044 } // end copy constructor 00045 ~opList(void) 00046 { 00047 opList* tmpOpListPtr; 00048 while (nextListPtr != NULL) { 00049 tmpOpListPtr = nextListPtr; 00050 nextListPtr = tmpOpListPtr->nextListPtr; 00051 tmpOpListPtr->nextListPtr = NULL; 00052 delete tmpOpListPtr; 00053 } 00054 // fprintf(stderr,"Deleting OPLIST %p\n",this); 00055 } 00056 00057 /*------------------------------------------------------- 00058 * Get legoOp pointer 00059 *-------------------------------------------------------*/ 00060 legoOp * GetOpPtr(void) { return opPtr; } 00061 00062 /*------------------------------------------------------- 00063 * Get op ID 00064 *-------------------------------------------------------*/ 00065 int GetOpId(void) { return opId; } 00066 00067 /*------------------------------------------------------- 00068 * Get valid 00069 *-------------------------------------------------------*/ 00070 int GetValid(void) { return valid; } 00071 00072 /*------------------------------------------------------- 00073 * Get weight 00074 *-------------------------------------------------------*/ 00075 double GetWeight(void) { return weight; } 00076 00077 /*------------------------------------------------------- 00078 * Get nextListPtr (pointer to next opList entry) 00079 *-------------------------------------------------------*/ 00080 opList *GetNextListPtr(void) { return nextListPtr; } 00081 00082 /*------------------------------------------------------- 00083 * Update weight 00084 *-------------------------------------------------------*/ 00085 void SetWeight(double newWeight) { weight = newWeight; } 00086 00087 /*------------------------------------------------------- 00088 * Update legoOp pointer 00089 *-------------------------------------------------------*/ 00090 void SetOpPtr(legoOp* newOpPtr) { opPtr = newOpPtr; } 00091 00092 /*------------------------------------------------------- 00093 * Update op ID 00094 *-------------------------------------------------------*/ 00095 void SetOpId(int newOpId) { opId = newOpId; } 00096 00097 /*------------------------------------------------------- 00098 * Update valid 00099 *-------------------------------------------------------*/ 00100 void SetValid(int newValid) { valid = newValid; } 00101 00102 /*------------------------------------------------------- 00103 * Update nextListPtr (pointer to next opList entry) 00104 *-------------------------------------------------------*/ 00105 void SetNextListPtr(opList* newNext) { nextListPtr = newNext; } 00106 00107 // --------------------------------------------------------------------------- 00108 00109 }; 00110 #endif // OPLIST_H
1.3.2