![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /********************************************************************* 00002 ** Copyright (c) 2004 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: networkEdgePointConstIter.h,v $ $Revision: 1.5 $ $State: Exp $ 00007 *********************************************************************/ 00008 #ifndef networkEdgePointConstIter_H_ 00009 #define networkEdgePointConstIter_H_ 00010 00011 // 00012 // \file networkEdgePointConstIter.h 00013 // \brief Contains the DtNetworkEdgePointConstIter class declaration. 00014 // 00015 00016 #include "gdb/gdbDefines.h" 00017 #include "gdb/netwrkEdge.h" 00018 00019 class DtPoint; 00020 class DtString; 00021 00022 // 00023 // DtNetworkEdgePointConstIter is an ABC representing 00024 // a const iterator over the points representing a DtNetworkEdge. 00025 // \invariant At all times, this iterator must point to a valid DtNetworkEdge. 00026 // \invariant This iterator can not be used to modify the referenced DtNetworkEdge 00027 class DT_DLL_gdb DtNetworkEdgePointConstIter 00028 { 00029 public: 00030 00031 // constructor 00032 // \param edge The DtNetworkEdge to iterate over 00033 DtNetworkEdgePointConstIter(const DtNetworkEdge& edge); 00034 00035 // constructor that allows the user to specify that 00036 // the iterator is initialized to the end of the 00037 // points of the edge. 00038 // \param edge The DtNetworkEdge to iterate over 00039 // \param isend Is the iterator at the end or not. 00040 DtNetworkEdgePointConstIter(const DtNetworkEdge& edge, bool isEnd); 00041 00042 // destructor 00043 virtual ~DtNetworkEdgePointConstIter(); 00044 00045 // copy constructor 00046 DtNetworkEdgePointConstIter(const DtNetworkEdgePointConstIter& orig); 00047 00048 // assignment operator 00049 virtual DtNetworkEdgePointConstIter& operator=(const DtNetworkEdgePointConstIter& orig); 00050 00051 // Increment/Decrement to the next/previous points. 00052 // \note Incrementing is defined as moving to the next point in the direction 00053 // in which the iterator is iterating over the edge, NOT necessarily the 00054 // next point in the order in which they are defined in the edge itself. 00055 virtual void operator++() = 0; 00056 virtual void operator--() = 0; 00057 00058 // \return A reference to a const DtPoint in the edge 00059 virtual const DtPoint& operator*() const = 0; 00060 // \return A pointer to a const DtPoint in the edge 00061 virtual const DtPoint* operator->() const = 0; 00062 00063 // \return A boolean signifying whether the iteration is equal to the other 00064 // iterator or not. 00065 virtual bool operator==(const DtNetworkEdgePointConstIter& other) const; 00066 virtual bool operator!=(const DtNetworkEdgePointConstIter& other) const; 00067 00068 // \return the DtString "DtNetworkEdgePointConstIter" 00069 virtual const DtString type() const; 00070 00071 protected: 00072 // Tests the invariant for the class (described above) 00073 // \return true if the invariant is valid. 00074 // false otherwise. 00075 bool testInvariant() const; 00076 00077 const DtNetworkEdge* myEdge; 00078 bool myIsEnd; 00079 00080 private: 00081 // default constructor 00082 DtNetworkEdgePointConstIter(); 00083 }; 00084 00085 00086 inline DtNetworkEdgePointConstIter::DtNetworkEdgePointConstIter(const DtNetworkEdge& edge): 00087 myEdge(&edge), 00088 myIsEnd(false) 00089 { 00090 } 00091 00092 inline DtNetworkEdgePointConstIter::DtNetworkEdgePointConstIter(const DtNetworkEdge& edge, bool isEnd): 00093 myEdge(&edge), 00094 myIsEnd(isEnd) 00095 { 00096 } 00097 00098 00099 inline DtNetworkEdgePointConstIter::~DtNetworkEdgePointConstIter() 00100 { 00101 } 00102 00103 inline DtNetworkEdgePointConstIter::DtNetworkEdgePointConstIter(const DtNetworkEdgePointConstIter& orig) 00104 { 00105 myEdge = orig.myEdge; 00106 myIsEnd = orig.myIsEnd; 00107 } 00108 00109 inline DtNetworkEdgePointConstIter& DtNetworkEdgePointConstIter::operator=(const DtNetworkEdgePointConstIter& orig) 00110 { 00111 if (*this != orig) 00112 { 00113 myEdge = orig.myEdge; 00114 myIsEnd = orig.myIsEnd; 00115 } 00116 00117 return *this; 00118 } 00119 00120 inline const DtString DtNetworkEdgePointConstIter::type() const 00121 { 00122 return "DtNetworkEdgePointConstIter"; 00123 } 00124 00125 00126 #endif