88: PartNode * itsNext;
89: };
90: // PartNode Implementations...
91:
92: PartNode::PartNode(Part* pPart):
93: itsPart(pPart),
94: itsNext(0)
95: {}
96:
97: PartNode::~PartNode()
98: {
99: delete itsPart;
100: itsPart = 0;
101: delete itsNext;
102: itsNext = 0;
103: }
104:
105: // Returns NULL if no next PartNode
106: PartNode * PartNode::GetNext() const
107: {
108: return itsNext;
109: }
110:
111: Part * PartNode::GetPart() const
112: {
113: if (itsPart)
114: return itsPart;
115: else
116: return NULL; //error
117: }
118:
119:
120:
121: // **************** Part List ************
122: class PartsList
123: {
124: public:
125: PartsList();
126: ~PartsList();
127: // needs copy constructor and operator equals!
128: void Iterate(void (Part::*f)()const) const;
129: Part* Find(int & position, int PartNumber) const;
130: Part* GetFirst() const;
131: void Insert(Part *);
132: Part* operator[](int) const;
133: int GetCount() const { return itsCount; }
134: static PartsList& GetGlobalPartsList()
135: {
136: return GlobalPartsList;
137: }
556 Day 16
LISTING16.5 continued