/usr/include/sipxtapi/utl/UtlIterator.h is in libsipxtapi-dev 3.3.0~test17-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | //
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _UtlIterator_h_
#define _UtlIterator_h_
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include "utl/UtlDefs.h"
#include "os/OsBSem.h"
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
class UtlContainable ;
class UtlContainer;
/**
* UltIterator defines an abstract Iterator for walking through the elements
* of UtlContainer derived class.
*
* <p>
* Example Code:
* <pre>
* // Create an iterator that walks through the elements of myContentSource.
* FooIterator itor(myContentSource);
* MyObject* pObj;
* // Fetch a pointer to each element of myContentSource into pObj.
* while ((pObj = itor()))
* {
* // Do something to *pObj.
* }
* // Reset itor to its initial state, so itor() starts walking through the
* // elements of myContentSource all over again.
* itor.reset();
* while ((pObj = itor()))
* {
* // Do something else to *pObj.
* }
* </pre>
* (The extra parentheses in the while clauses are to mark that that
* operation is an assignment, not a comparison.)
*/
class UtlIterator
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/* ============================ CREATORS ================================== */
UtlIterator(const UtlContainer& container);
/**
* Destructor
*/
virtual ~UtlIterator() = 0;
/* ============================ MANIPULATORS ============================== */
/// Return the next element.
virtual UtlContainable* operator()() = 0 ;
/// Reset the iterator cursor so that it will again return all elements in the container.
virtual void reset() = 0 ;
/* ============================ ACCESSORS ================================= */
/* ============================ INQUIRY =================================== */
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
friend class UtlContainer;
/******************************************************************
* @par Removing Method - Variable Signature.
*
* All iterators must have a 'removing' method so that they can be notified
* by the container when an element is removed.
*
* There is no prototype for it here because the signature differs depending
* on the container type.
*
* removing is called by the UtlContainer when an element is about to be
* removed from the container. The iterator must ensure that the removed
* element is not returned by any subsequent call.
* if element != NULL, it points to the element to be removed.
* if element == NULL, means all elements to be removed.
*/
// virtual void removing( ... type depends on the class of the iterator... ) = 0;
void addToContainer(const UtlContainer* container);
/**
* invalidate is called by the UtlContainer from its destructor.
* It disconnects the iterator from its container object (sets
* mpContainerRef to NULL).
* Any subsequent invocation of this iterator (other than its
* destructor) must return an error.
*
* :NOTE: Both the sIiteratorListLock and the container lock must be held by the caller.
*/
virtual void invalidate();
/**
* The mContainerRefLock must be held whenever the mpMyContainer value
* is being used or modified. If the mpIteratorListLock in the container
* is also held, then the mpIteratorListLock must be taken first.
*/
OsBSem mContainerRefLock;
UtlContainer* mpMyContainer;
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
/**
* There is no copy constructor
*/
UtlIterator(const UtlIterator& noCopyAllowed);
/**
* There is no assignment operator
*/
UtlIterator& operator=(const UtlIterator& noCopyAllowed);
} ;
/* ============================ INLINE METHODS ============================ */
#endif // _UtlIterator_h_
|