From ae0f01b2ffb1b39572ab7558a0bf58ef9b987cfe Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 11 Oct 2000 19:44:34 +0000 Subject: [PATCH] convert tabs to spaces --- src/libCom/cxxTemplates/tsDLList.h | 481 +++++++++---------- src/libCom/cxxTemplates/tsDLListDeprecated.h | 284 +++++------ src/libCom/cxxTemplates/tsMinMax.h | 4 +- src/libCom/cxxTemplates/tsSLList.h | 178 +++---- src/libCom/fdmgr/fdManager.h | 140 +++--- 5 files changed, 542 insertions(+), 545 deletions(-) diff --git a/src/libCom/cxxTemplates/tsDLList.h b/src/libCom/cxxTemplates/tsDLList.h index 071d776b6..48dbacdc7 100644 --- a/src/libCom/cxxTemplates/tsDLList.h +++ b/src/libCom/cxxTemplates/tsDLList.h @@ -1,7 +1,7 @@ /* * $Id$ * - * type safe doubly linked list templates + * type safe doubly linked list templates * * Author Jeffrey O. Hill * johill@lanl.gov @@ -59,14 +59,11 @@ class tsDLNode { friend class tsDLFwdIter; // deprecated friend class tsDLBwdIter; // deprecated public: - tsDLNode(); - void operator = (const tsDLNode &) const; + tsDLNode(); + void operator = (const tsDLNode &) const; private: - T *pNext; - T *pPrev; -//protected: -// T *getNext(void) const; -// T *getPrev(void) const; + T *pNext; + T *pPrev; }; // @@ -83,60 +80,60 @@ class tsDLList { friend class tsDLBwdIter; public: - tsDLList (); // create empty list + tsDLList (); // create empty list - unsigned count () const; // number of items on list + unsigned count () const; // number of items on list - void add (T &item); // add item to end of list + void add (T &item); // add item to end of list // all Ts in addList added to end of list // (addList left empty) - void add (tsDLList &addList); + void add (tsDLList &addList); - void push (T &item); // add item to beginning of list + void push (T &item); // add item to beginning of list - // remove item from list - void remove (T &item); + // remove item from list + void remove (T &item); - T * get (); // removes first item on list - T * pop (); // same as get () + T * get (); // removes first item on list + T * pop (); // same as get () - // insert item in the list immediately after itemBefore - void insertAfter (T &item, T &itemBefore); + // insert item in the list immediately after itemBefore + void insertAfter (T &item, T &itemBefore); - // insert item in the list immediately before itemAfter) - void insertBefore (T &item, T &itemAfter); - - // - // returns -1 if the item isnt on the list and the node + // insert item in the list immediately before itemAfter) + void insertBefore (T &item, T &itemAfter); + + // + // returns -1 if the item isnt on the list and the node // number (beginning with zero if it is) - // - int find (T &item) const; + // + int find (T &item) const; - T *first (void) const; // ptr to first item on list - T *last (void) const; // ptr to last item on list + T *first (void) const; // ptr to first item on list + T *last (void) const; // ptr to last item on list private: - T *pFirst; - T *pLast; - unsigned itemCount; + T *pFirst; + T *pLast; + unsigned itemCount; - // - // create empty list + // + // create empty list // (throw away any knowledge of current list) - // - void clear (); + // + void clear (); - // - // copying one list item into another and - // ending up with to list headers pointing - // at the same list is always a questionable - // thing to do. - // - // therefore, this is intentionally private + // + // copying one list item into another and + // ending up with to list headers pointing + // at the same list is always a questionable + // thing to do. + // + // therefore, this is intentionally private // and _not_ implemented. - // - tsDLList (const tsDLList &); + // + tsDLList (const tsDLList &); }; // @@ -147,27 +144,27 @@ private: template class tsDLIterConstBD { public: - tsDLIterConstBD (const T *pInitialEntry); + tsDLIterConstBD (const T *pInitialEntry); - tsDLIterConstBD operator = (const T *pNewEntry); + tsDLIterConstBD operator = (const T *pNewEntry); tsDLIterConstBD itemAfter (); tsDLIterConstBD itemBefore (); - bool operator == (const tsDLIterConstBD &rhs) const; - bool operator != (const tsDLIterConstBD &rhs) const; + bool operator == (const tsDLIterConstBD &rhs) const; + bool operator != (const tsDLIterConstBD &rhs) const; - const T & operator * () const; - const T * operator -> () const; + const T & operator * () const; + const T * operator -> () const; tsDLIterConstBD operator ++ (); // prefix ++ - tsDLIterConstBD operator ++ (int); // postfix ++ - tsDLIterConstBD operator -- (); // prefix -- - tsDLIterConstBD operator -- (int); // postfix -- + tsDLIterConstBD operator ++ (int); // postfix ++ + tsDLIterConstBD operator -- (); // prefix -- + tsDLIterConstBD operator -- (int); // postfix -- -# if defined(_MSC_VER) && _MSC_VER < 1200 - tsDLIterConstBD (const class tsDLIterConstBD ©In); -# endif +# if defined(_MSC_VER) && _MSC_VER < 1200 + tsDLIterConstBD (const class tsDLIterConstBD ©In); +# endif bool valid () const; @@ -178,8 +175,8 @@ public: protected: union { - const T *pConstEntry; - T *pEntry; + const T *pConstEntry; + T *pEntry; }; }; @@ -191,30 +188,30 @@ protected: template class tsDLIterBD : private tsDLIterConstBD { public: - tsDLIterBD (T *pInitialEntry); + tsDLIterBD (T *pInitialEntry); - tsDLIterBD operator = (T *pNewEntry); + tsDLIterBD operator = (T *pNewEntry); - tsDLIterBD itemAfter (); - tsDLIterBD itemBefore (); + tsDLIterBD itemAfter (); + tsDLIterBD itemBefore (); - bool operator == (const tsDLIterBD &rhs) const; - bool operator != (const tsDLIterBD &rhs) const; + bool operator == (const tsDLIterBD &rhs) const; + bool operator != (const tsDLIterBD &rhs) const; - T & operator * () const; - T * operator -> () const; + T & operator * () const; + T * operator -> () const; - tsDLIterBD operator ++ (); // prefix ++ + tsDLIterBD operator ++ (); // prefix ++ - tsDLIterBD operator ++ (int); // postfix ++ + tsDLIterBD operator ++ (int); // postfix ++ - tsDLIterBD operator -- (); // prefix -- + tsDLIterBD operator -- (); // prefix -- - tsDLIterBD operator -- (int); // postfix -- + tsDLIterBD operator -- (int); // postfix -- -# if defined(_MSC_VER) && _MSC_VER < 1200 - tsDLIterBD (const class tsDLIterBD ©In); -# endif +# if defined(_MSC_VER) && _MSC_VER < 1200 + tsDLIterBD (const class tsDLIterBD ©In); +# endif bool valid () const; @@ -265,7 +262,7 @@ inline void tsDLNode::operator = (const tsDLNode &) const {} template inline tsDLList::tsDLList () { - this->clear (); + this->clear (); } // @@ -276,7 +273,7 @@ inline tsDLList::tsDLList () template inline unsigned tsDLList::count () const { - return this->itemCount; + return this->itemCount; } // @@ -303,9 +300,9 @@ inline T *tsDLList::last (void) const template inline void tsDLList::clear () { - this->pFirst = 0; - this->pLast = 0; - this->itemCount = 0u; + this->pFirst = 0; + this->pLast = 0; + this->itemCount = 0u; } // @@ -314,25 +311,25 @@ inline void tsDLList::clear () template inline void tsDLList::remove (T &item) { - tsDLNode &theNode = item; + tsDLNode &theNode = item; - if (this->pLast == &item) { - this->pLast = theNode.pPrev; - } - else { - tsDLNode &nextNode = *theNode.pNext; - nextNode.pPrev = theNode.pPrev; - } + if (this->pLast == &item) { + this->pLast = theNode.pPrev; + } + else { + tsDLNode &nextNode = *theNode.pNext; + nextNode.pPrev = theNode.pPrev; + } - if (this->pFirst == &item) { - this->pFirst = theNode.pNext; - } - else { - tsDLNode &prevNode = *theNode.pPrev; - prevNode.pNext = theNode.pNext; - } - - this->itemCount--; + if (this->pFirst == &item) { + this->pFirst = theNode.pNext; + } + else { + tsDLNode &prevNode = *theNode.pPrev; + prevNode.pNext = theNode.pNext; + } + + this->itemCount--; } // @@ -341,13 +338,13 @@ inline void tsDLList::remove (T &item) template inline T * tsDLList::get() { - T *pItem = this->pFirst; + T *pItem = this->pFirst; - if (pItem) { - this->remove (*pItem); - } - - return pItem; + if (pItem) { + this->remove (*pItem); + } + + return pItem; } // @@ -357,7 +354,7 @@ inline T * tsDLList::get() template inline T * tsDLList::pop() { - return this->get(); + return this->get(); } // @@ -369,37 +366,37 @@ inline T * tsDLList::pop() template inline void tsDLList::add (tsDLList &addList) { - // - // NOOP if addList is empty - // - if ( addList.itemCount == 0u ) { - return; - } + // + // NOOP if addList is empty + // + if ( addList.itemCount == 0u ) { + return; + } - if ( this->itemCount == 0u ) { - // - // this is empty so just init from - // addList - // - *this = addList; - } - else { - tsDLNode *pLastNode = this->pLast; - tsDLNode *pAddListFirstNode = addList.pFirst; + if ( this->itemCount == 0u ) { + // + // this is empty so just init from + // addList + // + *this = addList; + } + else { + tsDLNode *pLastNode = this->pLast; + tsDLNode *pAddListFirstNode = addList.pFirst; - // - // add addList to the end of this - // - pLastNode->pNext = addList.pFirst; - pAddListFirstNode->pPrev = addList.pLast; - this->pLast = addList.pLast; - this->itemCount += addList.itemCount; - } + // + // add addList to the end of this + // + pLastNode->pNext = addList.pFirst; + pAddListFirstNode->pPrev = addList.pLast; + this->pLast = addList.pLast; + this->itemCount += addList.itemCount; + } - // - // leave addList empty - // - addList.clear(); + // + // leave addList empty + // + addList.clear(); } // @@ -412,20 +409,20 @@ inline void tsDLList::add (T &item) { tsDLNode &theNode = item; - theNode.pNext = 0; - theNode.pPrev = this->pLast; + theNode.pNext = 0; + theNode.pPrev = this->pLast; - if (this->itemCount) { - tsDLNode &lastNode = *this->pLast; - lastNode.pNext = &item; - } - else { - this->pFirst = &item; - } + if (this->itemCount) { + tsDLNode &lastNode = *this->pLast; + lastNode.pNext = &item; + } + else { + this->pFirst = &item; + } - this->pLast = &item; + this->pLast = &item; - this->itemCount++; + this->itemCount++; } // @@ -436,22 +433,22 @@ inline void tsDLList::add (T &item) template inline void tsDLList::insertAfter (T &item, T &itemBefore) { - tsDLNode &nodeItem = item; - tsDLNode &nodeBefore = itemBefore; + tsDLNode &nodeItem = item; + tsDLNode &nodeBefore = itemBefore; - nodeItem.pPrev = &itemBefore; - nodeItem.pNext = nodeBefore.pNext; - nodeBefore.pNext = &item; + nodeItem.pPrev = &itemBefore; + nodeItem.pNext = nodeBefore.pNext; + nodeBefore.pNext = &item; - if (nodeItem.pNext) { - tsDLNode *pNextNode = nodeItem.pNext; - pNextNode->pPrev = &item; - } - else { - this->pLast = &item; - } + if (nodeItem.pNext) { + tsDLNode *pNextNode = nodeItem.pNext; + pNextNode->pPrev = &item; + } + else { + this->pLast = &item; + } - this->itemCount++; + this->itemCount++; } // @@ -462,22 +459,22 @@ inline void tsDLList::insertAfter (T &item, T &itemBefore) template inline void tsDLList::insertBefore (T &item, T &itemAfter) { - tsDLNode &node = item; - tsDLNode &nodeAfter = itemAfter; + tsDLNode &node = item; + tsDLNode &nodeAfter = itemAfter; - node.pNext = &itemAfter; - node.pPrev = nodeAfter.pPrev; - nodeAfter.pPrev = &item; + node.pNext = &itemAfter; + node.pPrev = nodeAfter.pPrev; + nodeAfter.pPrev = &item; - if (node.pPrev) { - tsDLNode &prevNode = *node.pPrev; - prevNode.pNext = &item; - } - else { - this->pFirst = &item; - } + if (node.pPrev) { + tsDLNode &prevNode = *node.pPrev; + prevNode.pNext = &item; + } + else { + this->pFirst = &item; + } - this->itemCount++; + this->itemCount++; } // @@ -488,21 +485,21 @@ inline void tsDLList::insertBefore (T &item, T &itemAfter) template inline void tsDLList::push (T &item) { - tsDLNode &theNode = item; - theNode.pPrev = 0; - theNode.pNext = this->pFirst; + tsDLNode &theNode = item; + theNode.pPrev = 0; + theNode.pNext = this->pFirst; - if (this->itemCount) { - tsDLNode *pFirstNode = this->pFirst; - pFirstNode->pPrev = &item; - } - else { - this->pLast = &item; - } + if (this->itemCount) { + tsDLNode *pFirstNode = this->pFirst; + pFirstNode->pPrev = &item; + } + else { + this->pLast = &item; + } - this->pFirst = &item; + this->pFirst = &item; - this->itemCount++; + this->itemCount++; } // @@ -514,17 +511,17 @@ inline void tsDLList::push (T &item) template int tsDLList::find (T &item) const { - tsDLFwdIter iter (*this); - tsDLNode *pItem; - int itemNo=0; + tsDLFwdIter iter (*this); + tsDLNode *pItem; + int itemNo=0; - while ( ( pItem = iter.next () ) ) { - if ( pItem == &item ) { - return itemNo; - } - itemNo++; - } - return -1; + while ( ( pItem = iter.next () ) ) { + if ( pItem == &item ) { + return itemNo; + } + itemNo++; + } + return -1; } ////////////////////////////////////////// @@ -532,7 +529,7 @@ int tsDLList::find (T &item) const ////////////////////////////////////////// template inline tsDLIterConstBD::tsDLIterConstBD (const T * pInitialEntry) : - pConstEntry (pInitialEntry) {} + pConstEntry (pInitialEntry) {} // // This is apparently required by some compiler, but @@ -540,56 +537,56 @@ inline tsDLIterConstBD::tsDLIterConstBD (const T * pInitialEntry) : // should not be required by any compiler. I am assuming // that this "some compiler" is a past version of MS // Visual C. -// -# if defined(_MSC_VER) && _MSC_VER < 1200 - template - inline tsDLIterConstBD::tsDLIterConstBD (const class tsDLIterBD ©In) : - pConstEntry (copyIn.pEntry) {} -# endif +// +# if defined(_MSC_VER) && _MSC_VER < 1200 + template + inline tsDLIterConstBD::tsDLIterConstBD (const class tsDLIterBD ©In) : + pConstEntry (copyIn.pEntry) {} +# endif template inline tsDLIterConstBD tsDLIterConstBD::operator = (const T *pNewEntry) { - this->pConstEntry = pNewEntry; - return *this; + this->pConstEntry = pNewEntry; + return *this; } template inline bool tsDLIterConstBD::operator == (const tsDLIterConstBD &rhs) const { - return this->pConstEntry == rhs.pConstEntry; + return this->pConstEntry == rhs.pConstEntry; } template inline bool tsDLIterConstBD::operator != (const tsDLIterConstBD &rhs) const { - return this->pConstEntry != rhs.pConstEntry; + return this->pConstEntry != rhs.pConstEntry; } template inline const T & tsDLIterConstBD::operator * () const { - return *this->pConstEntry; + return *this->pConstEntry; } template inline const T * tsDLIterConstBD::operator -> () const { - return this->pConstEntry; + return this->pConstEntry; } template inline tsDLIterConstBD tsDLIterConstBD::itemAfter () { - const tsDLNode &node = *this->pConstEntry; - return tsDLIterConstBD (node.pNext); + const tsDLNode &node = *this->pConstEntry; + return tsDLIterConstBD (node.pNext); } template inline tsDLIterConstBD tsDLIterConstBD::itemBefore () { - const tsDLNode &node = *this->pConstEntry; - return tsDLIterConstBD (node.pPrev); + const tsDLNode &node = *this->pConstEntry; + return tsDLIterConstBD (node.pPrev); } // @@ -598,8 +595,8 @@ inline tsDLIterConstBD tsDLIterConstBD::itemBefore () template inline tsDLIterConstBD tsDLIterConstBD::operator ++ () { - const tsDLNode &node = *this->pConstEntry; - this->pConstEntry = node.pNext; + const tsDLNode &node = *this->pConstEntry; + this->pConstEntry = node.pNext; return *this; } @@ -609,10 +606,10 @@ inline tsDLIterConstBD tsDLIterConstBD::operator ++ () template inline tsDLIterConstBD tsDLIterConstBD::operator ++ (int) { - tsDLIterConstBD tmp = *this; - const tsDLNode &node = *this->pConstEntry; - this->pConstEntry = node.pNext; - return tmp; + tsDLIterConstBD tmp = *this; + const tsDLNode &node = *this->pConstEntry; + this->pConstEntry = node.pNext; + return tmp; } // @@ -621,8 +618,8 @@ inline tsDLIterConstBD tsDLIterConstBD::operator ++ (int) template inline tsDLIterConstBD tsDLIterConstBD::operator -- () { - const tsDLNode &entryNode = *this->pConstEntry; - this->pConstEntry = entryNode.pPrev; + const tsDLNode &entryNode = *this->pConstEntry; + this->pConstEntry = entryNode.pPrev; return *this; } @@ -632,10 +629,10 @@ inline tsDLIterConstBD tsDLIterConstBD::operator -- () template inline tsDLIterConstBD tsDLIterConstBD::operator -- (int) { - tsDLIterConstBD tmp = *this; - const tsDLNode &entryNode = *this->pConstEntry; - this->pConstEntry = entryNode.pPrev; - return tmp; + tsDLIterConstBD tmp = *this; + const tsDLNode &entryNode = *this->pConstEntry; + this->pConstEntry = entryNode.pPrev; + return tmp; } template @@ -659,7 +656,7 @@ inline const tsDLIterConstBD tsDLIterConstBD::eol () template inline tsDLIterBD::tsDLIterBD (T * pInitialEntry) : - tsDLIterConstBD (pInitialEntry) {} + tsDLIterConstBD (pInitialEntry) {} // // This is apparently required by some compiler, but @@ -667,12 +664,12 @@ inline tsDLIterBD::tsDLIterBD (T * pInitialEntry) : // should not be required by any compiler. I am assuming // that this "some compiler" is a past version of MS // Visual C. -// -# if defined(_MSC_VER) && _MSC_VER < 1200 - template - inline tsDLIterBD::tsDLIterBD (const class tsDLIterBD ©In) : - tsDLIterConstBD (copyIn) {} -# endif +// +# if defined(_MSC_VER) && _MSC_VER < 1200 + template + inline tsDLIterBD::tsDLIterBD (const class tsDLIterBD ©In) : + tsDLIterConstBD (copyIn) {} +# endif template inline tsDLIterBD tsDLIterBD::operator = (T *pNewEntry) @@ -684,7 +681,7 @@ inline tsDLIterBD tsDLIterBD::operator = (T *pNewEntry) template inline bool tsDLIterBD::operator == (const tsDLIterBD &rhs) const { - return this->pEntry == rhs.pEntry; + return this->pEntry == rhs.pEntry; } template @@ -696,27 +693,27 @@ inline bool tsDLIterBD::operator != (const tsDLIterBD &rhs) const template inline T & tsDLIterBD::operator * () const { - return *this->pEntry; + return *this->pEntry; } template inline T * tsDLIterBD::operator -> () const { - return this->pEntry; + return this->pEntry; } template inline tsDLIterBD tsDLIterBD::itemAfter () { - tsDLNode &node = *this->pEntry; - return tsDLIterBD (node.pNext); + tsDLNode &node = *this->pEntry; + return tsDLIterBD (node.pNext); } template inline tsDLIterBD tsDLIterBD::itemBefore () { - tsDLNode &node = *this->pEntry; - return tsDLIterBD (node.pPrev); + tsDLNode &node = *this->pEntry; + return tsDLIterBD (node.pPrev); } template @@ -734,31 +731,31 @@ inline const tsDLIterBD tsDLIterBD::eol () template inline tsDLIterBD tsDLIterBD::operator ++ () // prefix ++ { - this->tsDLIterConstBD::operator ++ (); - return *this; + this->tsDLIterConstBD::operator ++ (); + return *this; } template inline tsDLIterBD tsDLIterBD::operator ++ (int) // postfix ++ { - tsDLIterBD tmp = *this; - this->tsDLIterConstBD::operator ++ (1); - return tmp; + tsDLIterBD tmp = *this; + this->tsDLIterConstBD::operator ++ (1); + return tmp; } template inline tsDLIterBD tsDLIterBD::operator -- () // prefix -- { - this->tsDLIterConstBD::operator -- (); - return *this; + this->tsDLIterConstBD::operator -- (); + return *this; } template inline tsDLIterBD tsDLIterBD::operator -- (int) // postfix -- { - tsDLIterBD tmp = *this; - this->tsDLIterConstBD::operator -- (1); - return tmp; + tsDLIterBD tmp = *this; + this->tsDLIterConstBD::operator -- (1); + return tmp; } #include "tsDLListDeprecated.h" diff --git a/src/libCom/cxxTemplates/tsDLListDeprecated.h b/src/libCom/cxxTemplates/tsDLListDeprecated.h index fa69bf54c..b0dadefd4 100644 --- a/src/libCom/cxxTemplates/tsDLListDeprecated.h +++ b/src/libCom/cxxTemplates/tsDLListDeprecated.h @@ -7,28 +7,28 @@ // Notes: // 1) // This iterator does not allow for removal -// of an item in order to avoid problems -// resulting when we remove an item (and -// then dont know whether to make pCurrent -// point at the item before or after the -// item removed +// of an item in order to avoid problems +// resulting when we remove an item (and +// then dont know whether to make pCurrent +// point at the item before or after the +// item removed // template class tsDLIter { public: - tsDLIter (tsDLList & listIn); - void reset (); - void reset (tsDLList &listIn); - void operator = (tsDLList &listIn); - T * next (); - T * prev (); - T * first(); - T * last(); - T * operator () (); + tsDLIter (tsDLList & listIn); + void reset (); + void reset (tsDLList &listIn); + void operator = (tsDLList &listIn); + T * next (); + T * prev (); + T * first(); + T * last(); + T * operator () (); protected: - T *pCurrent; - tsDLList *pList; + T *pCurrent; + tsDLList *pList; T * current (); // certain compilers require this }; @@ -38,37 +38,37 @@ protected: // // Notes: // 1) No direct access to pCurrent is provided since -// this might allow for confusion when an item -// is removed (and pCurrent ends up pointing at -// an item that has been seen before) +// this might allow for confusion when an item +// is removed (and pCurrent ends up pointing at +// an item that has been seen before) // // 2) This iterator only moves forward in order to -// avoid problems resulting when we remove an -// item (and then dont know whether to make -// pCurrent point at the item before or after -// the item removed +// avoid problems resulting when we remove an +// item (and then dont know whether to make +// pCurrent point at the item before or after +// the item removed // template class tsDLFwdIter: private tsDLIter { public: - tsDLFwdIter (tsDLList &listIn); - void reset (); - void reset (tsDLList &listIn); - void operator = (tsDLList &listIn); - T * operator () (); - T * next (); - T * first(); + tsDLFwdIter (tsDLList &listIn); + void reset (); + void reset (tsDLList &listIn); + void operator = (tsDLList &listIn); + T * operator () (); + T * next (); + T * first(); - // - // remove () - // (and move current to be the item - // pointed to by pPrev - the item seen - // by the iterator before the current one - - // this guarantee that the list will be - // accessed sequentially even if an item - // is removed) - // - void remove (); + // + // remove () + // (and move current to be the item + // pointed to by pPrev - the item seen + // by the iterator before the current one - + // this guarantee that the list will be + // accessed sequentially even if an item + // is removed) + // + void remove (); protected: T *current (); }; @@ -78,37 +78,37 @@ protected: // // Notes: // 1) No direct access to pCurrent is provided since -// this might allow for confusion when an item -// is removed (and pCurrent ends up pointing at -// an item that has been seen before) +// this might allow for confusion when an item +// is removed (and pCurrent ends up pointing at +// an item that has been seen before) // // 2) This iterator only moves backward in order to -// avoid problems resulting when we remove an -// item (and then dont know whether to make -// pCurrent point at the item before or after -// the item removed +// avoid problems resulting when we remove an +// item (and then dont know whether to make +// pCurrent point at the item before or after +// the item removed // template class tsDLBwdIter : private tsDLIter { public: - tsDLBwdIter (tsDLList &listIn); - void reset (); - void reset (tsDLList &listIn); - void operator = (tsDLList &listIn); - T * operator () () { return this->tsDLIter::prev(); } - T * prev (); - T * last(); - // - // remove () - // remove current item - // (and move current to be the item - // pointed to by pNext - the item seen - // by the iterator before the current one - - // this guarantee that the list will be - // accessed sequentially even if an item - // is removed) - // - void remove (); + tsDLBwdIter (tsDLList &listIn); + void reset (); + void reset (tsDLList &listIn); + void operator = (tsDLList &listIn); + T * operator () () { return this->tsDLIter::prev(); } + T * prev (); + T * last(); + // + // remove () + // remove current item + // (and move current to be the item + // pointed to by pNext - the item seen + // by the iterator before the current one - + // this guarantee that the list will be + // accessed sequentially even if an item + // is removed) + // + void remove (); protected: T * current (); }; @@ -125,21 +125,21 @@ protected: template void tsDLFwdIter::remove () { - T *pCur = this->pCurrent; + T *pCur = this->pCurrent; - if (pCur) { - tsDLNode *pCurNode = pCur; + if (pCur) { + tsDLNode *pCurNode = pCur; - // - // Move this->pCurrent to the previous item - // - this->pCurrent = pCurNode->pPrev; + // + // Move this->pCurrent to the previous item + // + this->pCurrent = pCurNode->pPrev; - // - // delete current item - // - this->pList->remove(*pCur); - } + // + // delete current item + // + this->pList->remove(*pCur); + } } // @@ -148,8 +148,8 @@ void tsDLFwdIter::remove () template inline T * tsDLFwdIter::next () { - tsDLIter &iterBase = *this; - return iterBase.next(); + tsDLIter &iterBase = *this; + return iterBase.next(); } // @@ -158,7 +158,7 @@ inline T * tsDLFwdIter::next () template inline T * tsDLFwdIter::operator () () { - return this->next(); + return this->next(); } ////////////////////////////////////////// @@ -167,39 +167,39 @@ inline T * tsDLFwdIter::operator () () template inline tsDLIter::tsDLIter (tsDLList & listIn) : - pCurrent(0), pList(&listIn) {} + pCurrent(0), pList(&listIn) {} template inline void tsDLIter::reset () { - this->pCurrent = 0; + this->pCurrent = 0; } template inline void tsDLIter::reset (tsDLList &listIn) { - this->reset(); - this->pList = &listIn; + this->reset(); + this->pList = &listIn; } template inline void tsDLIter::operator = (tsDLList &listIn) { - this->reset(listIn); + this->reset(listIn); } template inline T * tsDLIter::first() { - this->pCurrent = this->pList->pFirst; - return this->pCurrent; + this->pCurrent = this->pList->pFirst; + return this->pCurrent; } template inline T * tsDLIter::last() { - this->pCurrent = this->pList->pLast; - return this->pCurrent; + this->pCurrent = this->pList->pLast; + return this->pCurrent; } // @@ -208,16 +208,16 @@ inline T * tsDLIter::last() template inline T * tsDLIter::next () { - T *pCur = this->pCurrent; - if (pCur==0) { - pCur = this->pList->pFirst; - } - else { - tsDLNode *pCurNode = pCur; - pCur = pCurNode->pNext; - } - this->pCurrent = pCur; - return pCur; + T *pCur = this->pCurrent; + if (pCur==0) { + pCur = this->pList->pFirst; + } + else { + tsDLNode *pCurNode = pCur; + pCur = pCurNode->pNext; + } + this->pCurrent = pCur; + return pCur; } // @@ -226,16 +226,16 @@ inline T * tsDLIter::next () template inline T * tsDLIter::prev () { - T *pCur = this->pCurrent; - if (pCur==0) { - pCur = this->pList->pLast; - } - else { - tsDLNode *pCurNode = pCur; - pCur = pCurNode->pPrev; - } - this->pCurrent = pCur; - return pCur; + T *pCur = this->pCurrent; + if (pCur==0) { + pCur = this->pList->pLast; + } + else { + tsDLNode *pCurNode = pCur; + pCur = pCurNode->pPrev; + } + this->pCurrent = pCur; + return pCur; } // @@ -244,7 +244,7 @@ inline T * tsDLIter::prev () template inline T * tsDLIter::operator () () { - return this->next(); + return this->next(); } // @@ -253,7 +253,7 @@ inline T * tsDLIter::operator () () template inline T * tsDLIter::current() { - return this->pCurrent; + return this->pCurrent; } /////////////////////////////////////////// @@ -262,30 +262,30 @@ inline T * tsDLIter::current() template inline tsDLBwdIter::tsDLBwdIter(tsDLList &listIn) : - tsDLIter(listIn) {} + tsDLIter(listIn) {} template inline void tsDLBwdIter::reset () { - this->tsDLIter::reset(); + this->tsDLIter::reset(); } template inline void tsDLBwdIter::reset (tsDLList &listIn) { - this->tsDLIter::reset(listIn); + this->tsDLIter::reset(listIn); } template inline void tsDLBwdIter::operator = (tsDLList &listIn) { - this->tsDLIter::reset(listIn); + this->tsDLIter::reset(listIn); } template inline T * tsDLBwdIter::last() { - return this->tsDLIter::last(); + return this->tsDLIter::last(); } // @@ -302,29 +302,29 @@ inline T * tsDLBwdIter::last() template void tsDLBwdIter::remove () { - T *pCur = this->pCurrent; + T *pCur = this->pCurrent; - if (pCur) { - tsDLNode *pCurNode = pCur; + if (pCur) { + tsDLNode *pCurNode = pCur; - // - // strip const (we didnt declare the - // list const in the constructor) - // - tsDLList * pMutableList = - (tsDLList *) this->pList; + // + // strip const (we didnt declare the + // list const in the constructor) + // + tsDLList * pMutableList = + (tsDLList *) this->pList; - // - // Move this->pCurrent to the item after the - // item being deleted - // - this->pCurrent = pCurNode->pNext; + // + // Move this->pCurrent to the item after the + // item being deleted + // + this->pCurrent = pCurNode->pNext; - // - // delete current item - // - pMutableList->remove(*pCur); - } + // + // delete current item + // + pMutableList->remove(*pCur); + } } ////////////////////////////////////////// @@ -333,35 +333,35 @@ void tsDLBwdIter::remove () template inline tsDLFwdIter::tsDLFwdIter (tsDLList &listIn) : - tsDLIter(listIn) {} + tsDLIter(listIn) {} template inline void tsDLFwdIter::reset () { - this->tsDLIter::reset(); + this->tsDLIter::reset(); } template inline void tsDLFwdIter::reset (tsDLList &listIn) { - this->tsDLIter::reset(listIn); + this->tsDLIter::reset(listIn); } template inline void tsDLFwdIter::operator = (tsDLList &listIn) { - this->tsDLIter::reset(listIn); + this->tsDLIter::reset(listIn); } template inline T * tsDLFwdIter::first() { - tsDLIter &iterBase = *this; - return iterBase.first(); + tsDLIter &iterBase = *this; + return iterBase.first(); } template inline T * tsDLFwdIter::current() { - return this->tsDLIter::current (); + return this->tsDLIter::current (); } diff --git a/src/libCom/cxxTemplates/tsMinMax.h b/src/libCom/cxxTemplates/tsMinMax.h index caee4075e..fbde7398a 100644 --- a/src/libCom/cxxTemplates/tsMinMax.h +++ b/src/libCom/cxxTemplates/tsMinMax.h @@ -7,11 +7,11 @@ template inline const T & tsMax (const T &a, const T &b) { - return (a>b) ? a : b; + return (a>b) ? a : b; } template inline const T & tsMin (const T &a, const T &b) { - return (a; friend class tsSLIterRm; public: - tsSLNode (); + tsSLNode (); - void operator = (const tsSLNode &) const; + void operator = (const tsSLNode &) const; private: - void removeNextItem (); // removes the item after this node + void removeNextItem (); // removes the item after this node - T *pNext; + T *pNext; }; @@ -80,15 +80,15 @@ class tsSLList : public tsSLNode { public: tsSLList (); // creates an empty list - void insert (T &item, tsSLNode &itemBefore); // insert after item before + void insert (T &item, tsSLNode &itemBefore); // insert after item before - void add (T &item); // add to the beginning of the list + void add (T &item); // add to the beginning of the list - T * get (); // remove from the beginning of the list + T * get (); // remove from the beginning of the list - T * pop (); // same as get + T * pop (); // same as get - void push (T &item); // same as add + void push (T &item); // same as add private: tsSLList (const tsSLList &); // intentionally _not_ implemented }; @@ -99,15 +99,15 @@ private: template class tsSLIter { public: - tsSLIter (const tsSLList &listIn); + tsSLIter (const tsSLList &listIn); - T * next (); // move iterator forward + T * next (); // move iterator forward - T * operator () (); // same as next () + T * operator () (); // same as next () private: - T *pCurrent; - const tsSLList *pList; // ptr allows cpy op + T *pCurrent; + const tsSLList *pList; // ptr allows cpy op }; // @@ -118,23 +118,23 @@ template class tsSLIterRm { public: - // - // exceptions - // - class noCurrentItemInIterator {}; + // + // exceptions + // + class noCurrentItemInIterator {}; - tsSLIterRm (tsSLList &listIn); + tsSLIterRm (tsSLList &listIn); - T * next (); // move iterator forward + T * next (); // move iterator forward - T * operator () (); // same as next () + T * operator () (); // same as next () - void remove (); // remove current node + void remove (); // remove current node private: - T *pPrevious; - T *pCurrent; - tsSLList *pList; // ptr allows cpy op + T *pPrevious; + T *pCurrent; + tsSLList *pList; // ptr allows cpy op }; ////////////////////////////////////////// @@ -166,11 +166,11 @@ inline void tsSLNode::operator = (const tsSLNode &) const {} template inline void tsSLNode::removeNextItem () { - T *pItem = this->pNext; - if (pItem) { - tsSLNode *pNode = pItem; - this->pNext = pNode->pNext; - } + T *pItem = this->pNext; + if (pItem) { + tsSLNode *pNode = pItem; + this->pNext = pNode->pNext; + } } ////////////////////////////////////////// @@ -196,9 +196,9 @@ inline tsSLList::tsSLList () template inline void tsSLList::insert (T &item, tsSLNode &itemBefore) { - tsSLNode &node = item; - node.pNext = itemBefore.pNext; - itemBefore.pNext = &item; + tsSLNode &node = item; + node.pNext = itemBefore.pNext; + itemBefore.pNext = &item; } // @@ -207,7 +207,7 @@ inline void tsSLList::insert (T &item, tsSLNode &itemBefore) template inline void tsSLList::add (T &item) { - this->insert (item, *this); + this->insert (item, *this); } // @@ -216,10 +216,10 @@ inline void tsSLList::add (T &item) template inline T * tsSLList::get() { - tsSLNode *pThisNode = this; - T *pItem = pThisNode->pNext; - pThisNode->removeNextItem(); - return pItem; + tsSLNode *pThisNode = this; + T *pItem = pThisNode->pNext; + pThisNode->removeNextItem(); + return pItem; } // @@ -228,7 +228,7 @@ inline T * tsSLList::get() template inline T * tsSLList::pop() { - return this->get(); + return this->get(); } // @@ -237,7 +237,7 @@ inline T * tsSLList::pop() template inline void tsSLList::push(T &item) { - this->add(item); + this->add(item); } ////////////////////////////////////////// @@ -265,19 +265,19 @@ inline tsSLIter::tsSLIter (const tsSLList &listIn) : template inline T * tsSLIter::next () { - if (this->pCurrent!=0) { - tsSLNode *pCurNode = this->pCurrent; - this->pCurrent = pCurNode->pNext; - } - else { - const tsSLNode &first = *this->pList; - // - // assume that we are starting (or restarting) at the - // beginning of the list - // - this->pCurrent = first.pNext; - } - return this->pCurrent; + if (this->pCurrent!=0) { + tsSLNode *pCurNode = this->pCurrent; + this->pCurrent = pCurNode->pNext; + } + else { + const tsSLNode &first = *this->pList; + // + // assume that we are starting (or restarting) at the + // beginning of the list + // + this->pCurrent = first.pNext; + } + return this->pCurrent; } // @@ -286,7 +286,7 @@ inline T * tsSLIter::next () template inline T * tsSLIter::operator () () { - return this->next(); + return this->next(); } ////////////////////////////////////////// @@ -329,21 +329,21 @@ inline tsSLIterRm::tsSLIterRm (tsSLList &listIn) : template inline T * tsSLIterRm::next () { - if (this->pCurrent!=0) { - tsSLNode *pCurNode = this->pCurrent; - this->pPrevious = this->pCurrent; - this->pCurrent = pCurNode->pNext; - } - else { - const tsSLNode &first = *this->pList; - // - // assume that we are starting (or restarting) at the - // beginning of the list - // - this->pCurrent = first.pNext; - this->pPrevious = 0; - } - return this->pCurrent; + if (this->pCurrent!=0) { + tsSLNode *pCurNode = this->pCurrent; + this->pPrevious = this->pCurrent; + this->pCurrent = pCurNode->pNext; + } + else { + const tsSLNode &first = *this->pList; + // + // assume that we are starting (or restarting) at the + // beginning of the list + // + this->pCurrent = first.pNext; + this->pPrevious = 0; + } + return this->pCurrent; } // @@ -352,7 +352,7 @@ inline T * tsSLIterRm::next () template inline T * tsSLIterRm::operator () () { - return this->next(); + return this->next(); } // @@ -372,30 +372,30 @@ inline T * tsSLIterRm::operator () () template void tsSLIterRm::remove () { - if (this->pCurrent==0) { + if (this->pCurrent==0) { throwWithLocation ( noCurrentItemInIterator () ); - } + } - tsSLNode *pPrevNode; - tsSLNode *pCurNode = this->pCurrent; + tsSLNode *pPrevNode; + tsSLNode *pCurNode = this->pCurrent; - if (this->pPrevious==0) { - pPrevNode = this->pList; - // - // fail if it is an attempt to - // delete twice without moving the iterator - // - if (pPrevNode->pNext != this->pCurrent) { + if (this->pPrevious==0) { + pPrevNode = this->pList; + // + // fail if it is an attempt to + // delete twice without moving the iterator + // + if (pPrevNode->pNext != this->pCurrent) { throwWithLocation ( noCurrentItemInIterator ()); - } - } - else { - pPrevNode = this->pPrevious; - } + } + } + else { + pPrevNode = this->pPrevious; + } - pPrevNode->pNext = pCurNode->pNext; - this->pCurrent = this->pPrevious; - this->pPrevious = 0; + pPrevNode->pNext = pCurNode->pNext; + this->pCurrent = this->pPrevious; + this->pPrevious = 0; } #endif // tsSLListh diff --git a/src/libCom/fdmgr/fdManager.h b/src/libCom/fdmgr/fdManager.h index 40164f7f6..e66336d16 100644 --- a/src/libCom/fdmgr/fdManager.h +++ b/src/libCom/fdmgr/fdManager.h @@ -56,32 +56,32 @@ class epicsShareClass fdRegId { public: - fdRegId (const SOCKET fdIn, const fdRegType typeIn) : - fd(fdIn), type(typeIn) {} + fdRegId (const SOCKET fdIn, const fdRegType typeIn) : + fd(fdIn), type(typeIn) {} - SOCKET getFD () const - { - return this->fd; - } + SOCKET getFD () const + { + return this->fd; + } - fdRegType getType () const - { - return this->type; - } + fdRegType getType () const + { + return this->type; + } - bool operator == (const fdRegId &idIn) const - { - return this->fd == idIn.fd && this->type==idIn.type; - } + bool operator == (const fdRegId &idIn) const + { + return this->fd == idIn.fd && this->type==idIn.type; + } - resTableIndex hash (unsigned nBitsId) const; + resTableIndex hash (unsigned nBitsId) const; static const unsigned minIndexBitWidth (); static const unsigned maxIndexBitWidth (); - virtual void show (unsigned level) const; + virtual void show (unsigned level) const; private: - const SOCKET fd; + const SOCKET fd; const fdRegType type; }; @@ -100,34 +100,34 @@ public: // class fdInterestSubscriptionAlreadyExits {}; - epicsShareFunc fdManager (osiTimerQueue &timerQueue = osiDefaultTimerQueue); - epicsShareFunc ~fdManager (); - epicsShareFunc void process (double delay); // delay parameter is in seconds + epicsShareFunc fdManager (osiTimerQueue &timerQueue = osiDefaultTimerQueue); + epicsShareFunc ~fdManager (); + epicsShareFunc void process (double delay); // delay parameter is in seconds - // - // returns NULL if the fd is unknown - // + // + // returns NULL if the fd is unknown + // epicsShareFunc fdReg *lookUpFD (const SOCKET fd, const fdRegType type); osiTimerQueue & timerQueueRef () const; private: - tsDLList regList; - tsDLList activeList; - resTable fdTbl; - fd_set fdSets[fdrNEnums]; + tsDLList regList; + tsDLList activeList; + resTable fdTbl; + fd_set fdSets[fdrNEnums]; osiTimerQueue &timerQueue; - SOCKET maxFD; - unsigned processInProg; - // - // Set to fdreg when in call back - // and nill otherwise - // - fdReg *pCBReg; + SOCKET maxFD; + unsigned processInProg; + // + // Set to fdreg when in call back + // and nill otherwise + // + fdReg *pCBReg; - epicsShareFunc void installReg (fdReg ®); - epicsShareFunc void removeReg (fdReg ®); + epicsShareFunc void installReg (fdReg ®); + epicsShareFunc void removeReg (fdReg ®); }; // @@ -146,37 +146,37 @@ class fdReg : public fdRegId, public tsDLNode, public tsSLNode { public: epicsShareFunc fdReg (const SOCKET fdIn, const fdRegType type, - const bool onceOnly=false, fdManager &manager = fileDescriptorManager); - epicsShareFunc virtual ~fdReg (); + const bool onceOnly=false, fdManager &manager = fileDescriptorManager); + epicsShareFunc virtual ~fdReg (); - epicsShareFunc virtual void show (unsigned level) const; - - // - // Called by the file descriptor manager: - // 1) If the fdManager is deleted and there are still - // fdReg objects attached - // 2) Immediately after calling "callBack()" if - // the constructor specified "onceOnly" - // - // fdReg::destroy() does a "delete this" - // - epicsShareFunc virtual void destroy (); + epicsShareFunc virtual void show (unsigned level) const; + + // + // Called by the file descriptor manager: + // 1) If the fdManager is deleted and there are still + // fdReg objects attached + // 2) Immediately after calling "callBack()" if + // the constructor specified "onceOnly" + // + // fdReg::destroy() does a "delete this" + // + epicsShareFunc virtual void destroy (); private: enum state {active, pending, limbo}; - // - // called when there is activity on the fd - // NOTES - // 1) the fdManager will call this only once during the - // lifetime of a fdReg object if the constructor - // specified "onceOnly" - // - epicsShareFunc virtual void callBack ()=0; + // + // called when there is activity on the fd + // NOTES + // 1) the fdManager will call this only once during the + // lifetime of a fdReg object if the constructor + // specified "onceOnly" + // + epicsShareFunc virtual void callBack ()=0; - unsigned char state; // state enums go here - unsigned char onceOnly; - fdManager &manager; + unsigned char state; // state enums go here + unsigned char onceOnly; + fdManager &manager; }; // @@ -189,16 +189,16 @@ inline resTableIndex fdRegId::hash (unsigned) const hashid = intId ::hashEngine(this->fd); - // - // also evenly distribute based on the type of fdRegType - // - hashid ^= this->type; + // + // also evenly distribute based on the type of fdRegType + // + hashid ^= this->type; - // - // the result here is always masked to the - // proper size after it is returned to the resource class - // - return hashid; + // + // the result here is always masked to the + // proper size after it is returned to the resource class + // + return hashid; } //