VR-Forces 4.1 Class Documentation
vecNetIsctRecLst.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1999 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: vecNetIsctRecLst.h,v $ $Revision: 1.6 $ $State: Exp $
7 *********************************************************************/
8 
9 #ifndef vecNetIsctRecLst_H_
10 #define vecNetIsctRecLst_H_
11 
12 #include "gdb/gdbDefines.h"
13 #include <vlutil/vlList.h>
14 #include "gdb/vecNwrkIntRec.h"
15 
16 // class DtVectorNetworkIntersectionRecordList:
17 //
18 // DtVectorNetworkIntersectionRecordList represents a list of
19 // DtVectorNetworkIntersectionRecords. This is useful for following
20 // chord recording all of its intersections with a section of the
21 // vector network. As with the DtChordIntersectionRecordLists, and
22 // unlike DtList, this class "owns" all of its
23 // DtVectorNetworkIntersectionRecords and will delete them when it
24 // is destroyed.
25 
27 {
28 public:
29 
30  // default constructor
32 
33  //copy constructor
35 
36  // destructor
38 
39  // assignment operator
42 
43  // Return first and last item on the list. DtListItem is an envelope
44  // for your data. The data can be obtained using DtListItem::data().
45  DtListItem* first() const;
46  DtListItem* last() const;
47 
48  // A short-cut for looking at the first record
49  DtVectorNetworkIntersectionRecord* firstVectorNetworkIntersectionRecord() const;
50 
51  // Returns the number of elements in the list.
52  unsigned count() const;
53 
54  // Add element to the end of the list. Returns the DtListItem envelope
55  // object that contains your new element.
56  DtListItem* add(const DtVectorNetworkIntersectionRecord& data);
57 
58  // Add element to the beginning of the list. Returns the DtListItem
59  // envelope object that contains your new element.
60  DtListItem* addToStart(const DtVectorNetworkIntersectionRecord& data);
61 
62  // Add element to the end of the list. Returns the DtListItem envelope
63  // object that contains your new element.
64  DtListItem* addToEnd(const DtVectorNetworkIntersectionRecord& data);
65 
66  // Add element to the list just before the indicated item.
67  // Returns the DtListItem envelope object that contains your new element.
68  DtListItem* addBefore(const DtVectorNetworkIntersectionRecord& data,
69  DtListItem* before);
70 
71  // Add element to the list just after the indicated item.
72  // Returns the DtListItem envelope object that contains your new element.
73  DtListItem* addAfter(const DtVectorNetworkIntersectionRecord& data,
74  DtListItem* after);
75 
76  // Remove an element from the list. Item is the envelope containing the
77  // data element you would like to remove. Return value is true if the
78  // item was found in the list and the data pointer was non-zero.
79  // Note: this version of remove DOES free the memory of data associated
80  // with the item.
81  bool remove(DtListItem* item);
82 
83  // Calls remove for all elements in the list. It DOES delete the
84  // data in the list as well
85  void removeAll();
86 
87  // Returns the DtListItem envelope object containing the indicated
88  // data element.
89  DtListItem* itemLookup(const DtVectorNetworkIntersectionRecord* data) const;
90 
91  //
92  // Functions specific to DtVectorNetworkIntersectionRecordList
93  //
94 
95  // Insert a DtVectorNetworkIntersectRecord in the appropriate spot. Assume list
96  // is sorted in increasing distance from beginning of chord.
97  virtual void insertAlongChord(const DtVectorNetworkIntersectionRecord& record);
98 
99  // Merge in another DtVectorNetworkIntersectionRecordList; assume both lists
100  // are sorted in increasing distance from beginning of chord.
101  virtual void mergeAlongChord(const DtVectorNetworkIntersectionRecordList& otherList);
102 
103 protected:
104 
105  DtList myList;
106 };
107 
108 //
109 // Inline functions
110 //
111 
113 {
114  return myList.first();
115 }
116 
118 {
119  return myList.last();
120 }
121 
123 {
124  return myList.count();
125 }
126 
129 {
130  if (count() != 0)
131  {
132  return static_cast<DtVectorNetworkIntersectionRecord*>(myList.first()->data());
133  }
134  else
135  {
136  return 0;
137  }
138 }
139 
142 {
143  return myList.add(data.clone());
144 }
145 
148 {
149  return myList.addToStart(data.clone());
150 }
151 
154 {
155  return myList.addToEnd(data.clone());
156 }
157 
159  const DtVectorNetworkIntersectionRecord& data, DtListItem* before)
160 {
161  return myList.addBefore(data.clone(), before);
162 }
163 
165  const DtVectorNetworkIntersectionRecord& data, DtListItem* after)
166 {
167  return myList.addAfter(data.clone(), after);
168 }
169 
171  const DtVectorNetworkIntersectionRecord* data) const
172 {
173  return myList.itemLookup(data);
174 }
175 
176 #endif

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)