![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /********************************************************************* 00002 ** Copyright (c) 1999 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: vecNetIsctRecLst.h,v $ $Revision: 1.6 $ $State: Exp $ 00007 *********************************************************************/ 00008 00009 #ifndef vecNetIsctRecLst_H_ 00010 #define vecNetIsctRecLst_H_ 00011 00012 #include "gdb/gdbDefines.h" 00013 #include <vlutil/vlList.h> 00014 #include "gdb/vecNwrkIntRec.h" 00015 00016 // class DtVectorNetworkIntersectionRecordList: 00017 // 00018 // DtVectorNetworkIntersectionRecordList represents a list of 00019 // DtVectorNetworkIntersectionRecords. This is useful for following 00020 // chord recording all of its intersections with a section of the 00021 // vector network. As with the DtChordIntersectionRecordLists, and 00022 // unlike DtList, this class "owns" all of its 00023 // DtVectorNetworkIntersectionRecords and will delete them when it 00024 // is destroyed. 00025 00026 class DT_DLL_gdb DtVectorNetworkIntersectionRecordList 00027 { 00028 public: 00029 00030 // default constructor 00031 DtVectorNetworkIntersectionRecordList(); 00032 00033 //copy constructor 00034 DtVectorNetworkIntersectionRecordList(const DtVectorNetworkIntersectionRecordList& orig); 00035 00036 // destructor 00037 virtual ~DtVectorNetworkIntersectionRecordList(); 00038 00039 // assignment operator 00040 DtVectorNetworkIntersectionRecordList& operator=( 00041 const DtVectorNetworkIntersectionRecordList& orig); 00042 00043 // Return first and last item on the list. DtListItem is an envelope 00044 // for your data. The data can be obtained using DtListItem::data(). 00045 DtListItem* first() const; 00046 DtListItem* last() const; 00047 00048 // A short-cut for looking at the first record 00049 DtVectorNetworkIntersectionRecord* firstVectorNetworkIntersectionRecord() const; 00050 00051 // Returns the number of elements in the list. 00052 unsigned count() const; 00053 00054 // Add element to the end of the list. Returns the DtListItem envelope 00055 // object that contains your new element. 00056 DtListItem* add(const DtVectorNetworkIntersectionRecord& data); 00057 00058 // Add element to the beginning of the list. Returns the DtListItem 00059 // envelope object that contains your new element. 00060 DtListItem* addToStart(const DtVectorNetworkIntersectionRecord& data); 00061 00062 // Add element to the end of the list. Returns the DtListItem envelope 00063 // object that contains your new element. 00064 DtListItem* addToEnd(const DtVectorNetworkIntersectionRecord& data); 00065 00066 // Add element to the list just before the indicated item. 00067 // Returns the DtListItem envelope object that contains your new element. 00068 DtListItem* addBefore(const DtVectorNetworkIntersectionRecord& data, 00069 DtListItem* before); 00070 00071 // Add element to the list just after the indicated item. 00072 // Returns the DtListItem envelope object that contains your new element. 00073 DtListItem* addAfter(const DtVectorNetworkIntersectionRecord& data, 00074 DtListItem* after); 00075 00076 // Remove an element from the list. Item is the envelope containing the 00077 // data element you would like to remove. Return value is true if the 00078 // item was found in the list and the data pointer was non-zero. 00079 // Note: this version of remove DOES free the memory of data associated 00080 // with the item. 00081 bool remove(DtListItem* item); 00082 00083 // Calls remove for all elements in the list. It DOES delete the 00084 // data in the list as well 00085 void removeAll(); 00086 00087 // Returns the DtListItem envelope object containing the indicated 00088 // data element. 00089 DtListItem* itemLookup(const DtVectorNetworkIntersectionRecord* data) const; 00090 00091 // 00092 // Functions specific to DtVectorNetworkIntersectionRecordList 00093 // 00094 00095 // Insert a DtVectorNetworkIntersectRecord in the appropriate spot. Assume list 00096 // is sorted in increasing distance from beginning of chord. 00097 virtual void insertAlongChord(const DtVectorNetworkIntersectionRecord& record); 00098 00099 // Merge in another DtVectorNetworkIntersectionRecordList; assume both lists 00100 // are sorted in increasing distance from beginning of chord. 00101 virtual void mergeAlongChord(const DtVectorNetworkIntersectionRecordList& otherList); 00102 00103 protected: 00104 00105 DtList myList; 00106 }; 00107 00108 // 00109 // Inline functions 00110 // 00111 00112 inline DtListItem* DtVectorNetworkIntersectionRecordList::first() const 00113 { 00114 return myList.first(); 00115 } 00116 00117 inline DtListItem* DtVectorNetworkIntersectionRecordList::last() const 00118 { 00119 return myList.last(); 00120 } 00121 00122 inline unsigned DtVectorNetworkIntersectionRecordList::count() const 00123 { 00124 return myList.count(); 00125 } 00126 00127 inline DtVectorNetworkIntersectionRecord* 00128 DtVectorNetworkIntersectionRecordList::firstVectorNetworkIntersectionRecord() const 00129 { 00130 if (count() != 0) 00131 { 00132 return static_cast<DtVectorNetworkIntersectionRecord*>(myList.first()->data()); 00133 } 00134 else 00135 { 00136 return 0; 00137 } 00138 } 00139 00140 inline DtListItem* DtVectorNetworkIntersectionRecordList::add( 00141 const DtVectorNetworkIntersectionRecord& data) 00142 { 00143 return myList.add(data.clone()); 00144 } 00145 00146 inline DtListItem* DtVectorNetworkIntersectionRecordList::addToStart( 00147 const DtVectorNetworkIntersectionRecord& data) 00148 { 00149 return myList.addToStart(data.clone()); 00150 } 00151 00152 inline DtListItem* DtVectorNetworkIntersectionRecordList::addToEnd( 00153 const DtVectorNetworkIntersectionRecord& data) 00154 { 00155 return myList.addToEnd(data.clone()); 00156 } 00157 00158 inline DtListItem* DtVectorNetworkIntersectionRecordList::addBefore( 00159 const DtVectorNetworkIntersectionRecord& data, DtListItem* before) 00160 { 00161 return myList.addBefore(data.clone(), before); 00162 } 00163 00164 inline DtListItem* DtVectorNetworkIntersectionRecordList::addAfter( 00165 const DtVectorNetworkIntersectionRecord& data, DtListItem* after) 00166 { 00167 return myList.addAfter(data.clone(), after); 00168 } 00169 00170 inline DtListItem* DtVectorNetworkIntersectionRecordList::itemLookup( 00171 const DtVectorNetworkIntersectionRecord* data) const 00172 { 00173 return myList.itemLookup(data); 00174 } 00175 00176 #endif