summaryrefslogtreecommitdiffstats
path: root/thirdparties/win32/include/directshow/wxlist.h
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparties/win32/include/directshow/wxlist.h')
-rwxr-xr-xthirdparties/win32/include/directshow/wxlist.h208
1 files changed, 128 insertions, 80 deletions
diff --git a/thirdparties/win32/include/directshow/wxlist.h b/thirdparties/win32/include/directshow/wxlist.h
index 931893d..fd8024f 100755
--- a/thirdparties/win32/include/directshow/wxlist.h
+++ b/thirdparties/win32/include/directshow/wxlist.h
@@ -27,30 +27,32 @@
#ifndef __WXLIST__
#define __WXLIST__
- /* A POSITION represents (in some fashion that's opaque) a cursor
- on the list that can be set to identify any element. NULL is
- a valid value and several operations regard NULL as the position
- "one step off the end of the list". (In an n element list there
- are n+1 places to insert and NULL is that "n+1-th" value).
- The POSITION of an element in the list is only invalidated if
- that element is deleted. Move operations may mean that what
- was a valid POSITION in one list is now a valid POSITION in
- a different list.
-
- Some operations which at first sight are illegal are allowed as
- harmless no-ops. For instance RemoveHead is legal on an empty
- list and it returns NULL. This allows an atomic way to test if
- there is an element there, and if so, get it. The two operations
- AddTail and RemoveHead thus implement a MONITOR (See Hoare's paper).
-
- Single element operations return POSITIONs, non-NULL means it worked.
- whole list operations return a BOOL. TRUE means it all worked.
-
- This definition is the same as the POSITION type for MFCs, so we must
- avoid defining it twice.
- */
+/* A POSITION represents (in some fashion that's opaque) a cursor
+ on the list that can be set to identify any element. NULL is
+ a valid value and several operations regard NULL as the position
+ "one step off the end of the list". (In an n element list there
+ are n+1 places to insert and NULL is that "n+1-th" value).
+ The POSITION of an element in the list is only invalidated if
+ that element is deleted. Move operations may mean that what
+ was a valid POSITION in one list is now a valid POSITION in
+ a different list.
+
+ Some operations which at first sight are illegal are allowed as
+ harmless no-ops. For instance RemoveHead is legal on an empty
+ list and it returns NULL. This allows an atomic way to test if
+ there is an element there, and if so, get it. The two operations
+ AddTail and RemoveHead thus implement a MONITOR (See Hoare's paper).
+
+ Single element operations return POSITIONs, non-NULL means it worked.
+ whole list operations return a BOOL. TRUE means it all worked.
+
+ This definition is the same as the POSITION type for MFCs, so we must
+ avoid defining it twice.
+*/
#ifndef __AFX_H__
-struct __POSITION { int unused; };
+struct __POSITION {
+ int unused;
+};
typedef __POSITION* POSITION;
#endif
@@ -61,22 +63,24 @@ const int DEFAULTCACHE = 10; /* Default node object cache size */
to the object that it looks after.
All of these pointers can be retrieved or set through member functions.
*/
-class CBaseList
+class CBaseList
#ifdef DEBUG
: public CBaseObject
#endif
{
/* Making these classes inherit from CBaseObject does nothing
functionally but it allows us to check there are no memory
- leaks in debug builds.
+ leaks in debug builds.
*/
public:
#ifdef DEBUG
- class CNode : public CBaseObject {
+ class CNode : public CBaseObject
+ {
#else
- class CNode {
+ class CNode
+ {
#endif
CNode *m_pPrev; /* Previous node in the list */
@@ -95,36 +99,48 @@ public:
/* Return the previous node before this one */
- __out CNode *Prev() const { return m_pPrev; };
+ __out CNode *Prev() const {
+ return m_pPrev;
+ };
/* Return the next node after this one */
- __out CNode *Next() const { return m_pNext; };
+ __out CNode *Next() const {
+ return m_pNext;
+ };
/* Set the previous node before this one */
- void SetPrev(__in_opt CNode *p) { m_pPrev = p; };
+ void SetPrev(__in_opt CNode *p) {
+ m_pPrev = p;
+ };
/* Set the next node after this one */
- void SetNext(__in_opt CNode *p) { m_pNext = p; };
+ void SetNext(__in_opt CNode *p) {
+ m_pNext = p;
+ };
/* Get the pointer to the object for this node */
- __out void *GetData() const { return m_pObject; };
+ __out void *GetData() const {
+ return m_pObject;
+ };
/* Set the pointer to the object for this node */
- void SetData(__in void *p) { m_pObject = p; };
+ void SetData(__in void *p) {
+ m_pObject = p;
+ };
};
class CNodeCache
{
public:
CNodeCache(INT iCacheSize) : m_iCacheSize(iCacheSize),
- m_pHead(NULL),
- m_iUsed(0)
- {};
+ m_pHead(NULL),
+ m_iUsed(0) {
+ };
~CNodeCache() {
CNode *pNode = m_pHead;
while (pNode) {
@@ -133,24 +149,24 @@ public:
delete pCurrent;
}
};
- void AddToCache(__inout CNode *pNode)
- {
+ void AddToCache(__inout CNode *pNode) {
if (m_iUsed < m_iCacheSize) {
pNode->SetNext(m_pHead);
m_pHead = pNode;
m_iUsed++;
- } else {
+ }
+ else {
delete pNode;
}
};
- CNode *RemoveFromCache()
- {
+ CNode *RemoveFromCache() {
CNode *pNode = m_pHead;
if (pNode != NULL) {
m_pHead = pNode->Next();
m_iUsed--;
ASSERT(m_iUsed >= 0);
- } else {
+ }
+ else {
ASSERT(m_iUsed == 0);
}
return pNode;
@@ -258,8 +274,7 @@ public:
in ALL cases. All the other arguments probably are reflections
of the algebraic point.
*/
- __out_opt POSITION Next(__in_opt POSITION pos) const
- {
+ __out_opt POSITION Next(__in_opt POSITION pos) const {
if (pos == NULL) {
return (POSITION) m_pFirst;
}
@@ -268,8 +283,7 @@ public:
} //Next
// See Next
- __out_opt POSITION Prev(__in_opt POSITION pos) const
- {
+ __out_opt POSITION Prev(__in_opt POSITION pos) const {
if (pos == NULL) {
return (POSITION) m_pLast;
}
@@ -380,9 +394,9 @@ public:
Return the position of the new object, NULL if it fails
Existing POSITIONs in *this are undisturbed, including p.
*/
- protected:
+protected:
__out_opt POSITION AddBeforeI(__in_opt POSITION p, __in void * pObj);
- public:
+public:
/* Add the list *pList to *this before position p in *this
AddAfter(NULL,x) adds x to the start - equivalent to AddHead
@@ -479,7 +493,7 @@ public:
/* set cursor to the position of each element of list in turn */
- #define TRAVERSELIST(list, cursor) \
+#define TRAVERSELIST(list, cursor) \
for ( cursor = (list).GetHeadPosition() \
; cursor!=NULL \
; cursor = (list).Next(cursor) \
@@ -489,7 +503,7 @@ public:
/* set cursor to the position of each element of list in turn
in reverse order
*/
- #define REVERSETRAVERSELIST(list, cursor) \
+#define REVERSETRAVERSELIST(list, cursor) \
for ( cursor = (list).GetTailPosition() \
; cursor!=NULL \
; cursor = (list).Prev(cursor) \
@@ -504,42 +518,76 @@ public:
INT iItems,
BOOL bLock = TRUE,
BOOL bAlert = FALSE) :
- CBaseList(pName, iItems) {
+ CBaseList(pName, iItems) {
UNREFERENCED_PARAMETER(bAlert);
UNREFERENCED_PARAMETER(bLock);
};
CGenericList(__in_opt LPCTSTR pName) :
- CBaseList(pName) {
+ CBaseList(pName) {
};
- __out_opt POSITION GetHeadPosition() const { return (POSITION)m_pFirst; }
- __out_opt POSITION GetTailPosition() const { return (POSITION)m_pLast; }
- int GetCount() const { return m_Count; }
-
- __out OBJECT *GetNext(__inout POSITION& rp) const { return (OBJECT *) GetNextI(rp); }
-
- __out_opt OBJECT *Get(__in_opt POSITION p) const { return (OBJECT *) GetI(p); }
- __out OBJECT *GetValid(__in POSITION p) const { return (OBJECT *) GetValidI(p); }
- __out_opt OBJECT *GetHead() const { return Get(GetHeadPosition()); }
-
- __out_opt OBJECT *RemoveHead() { return (OBJECT *) RemoveHeadI(); }
-
- __out_opt OBJECT *RemoveTail() { return (OBJECT *) RemoveTailI(); }
-
- __out_opt OBJECT *Remove(__in_opt POSITION p) { return (OBJECT *) RemoveI(p); }
- __out_opt POSITION AddBefore(__in_opt POSITION p, __in OBJECT * pObj) { return AddBeforeI(p, pObj); }
- __out_opt POSITION AddAfter(__in_opt POSITION p, __in OBJECT * pObj) { return AddAfterI(p, pObj); }
- __out_opt POSITION AddHead(__in OBJECT * pObj) { return AddHeadI(pObj); }
- __out_opt POSITION AddTail(__in OBJECT * pObj) { return AddTailI(pObj); }
- BOOL AddTail(__in CGenericList<OBJECT> *pList)
- { return CBaseList::AddTail((CBaseList *) pList); }
- BOOL AddHead(__in CGenericList<OBJECT> *pList)
- { return CBaseList::AddHead((CBaseList *) pList); }
- BOOL AddAfter(__in_opt POSITION p, __in CGenericList<OBJECT> *pList)
- { return CBaseList::AddAfter(p, (CBaseList *) pList); };
- BOOL AddBefore(__in_opt POSITION p, __in CGenericList<OBJECT> *pList)
- { return CBaseList::AddBefore(p, (CBaseList *) pList); };
- __out_opt POSITION Find( __in OBJECT * pObj) const { return FindI(pObj); }
+ __out_opt POSITION GetHeadPosition() const {
+ return (POSITION)m_pFirst;
+ }
+ __out_opt POSITION GetTailPosition() const {
+ return (POSITION)m_pLast;
+ }
+ int GetCount() const {
+ return m_Count;
+ }
+
+ __out OBJECT *GetNext(__inout POSITION& rp) const {
+ return (OBJECT *) GetNextI(rp);
+ }
+
+ __out_opt OBJECT *Get(__in_opt POSITION p) const {
+ return (OBJECT *) GetI(p);
+ }
+ __out OBJECT *GetValid(__in POSITION p) const {
+ return (OBJECT *) GetValidI(p);
+ }
+ __out_opt OBJECT *GetHead() const {
+ return Get(GetHeadPosition());
+ }
+
+ __out_opt OBJECT *RemoveHead() {
+ return (OBJECT *) RemoveHeadI();
+ }
+
+ __out_opt OBJECT *RemoveTail() {
+ return (OBJECT *) RemoveTailI();
+ }
+
+ __out_opt OBJECT *Remove(__in_opt POSITION p) {
+ return (OBJECT *) RemoveI(p);
+ }
+ __out_opt POSITION AddBefore(__in_opt POSITION p, __in OBJECT * pObj) {
+ return AddBeforeI(p, pObj);
+ }
+ __out_opt POSITION AddAfter(__in_opt POSITION p, __in OBJECT * pObj) {
+ return AddAfterI(p, pObj);
+ }
+ __out_opt POSITION AddHead(__in OBJECT * pObj) {
+ return AddHeadI(pObj);
+ }
+ __out_opt POSITION AddTail(__in OBJECT * pObj) {
+ return AddTailI(pObj);
+ }
+ BOOL AddTail(__in CGenericList<OBJECT> *pList) {
+ return CBaseList::AddTail((CBaseList *) pList);
+ }
+ BOOL AddHead(__in CGenericList<OBJECT> *pList) {
+ return CBaseList::AddHead((CBaseList *) pList);
+ }
+ BOOL AddAfter(__in_opt POSITION p, __in CGenericList<OBJECT> *pList) {
+ return CBaseList::AddAfter(p, (CBaseList *) pList);
+ };
+ BOOL AddBefore(__in_opt POSITION p, __in CGenericList<OBJECT> *pList) {
+ return CBaseList::AddBefore(p, (CBaseList *) pList);
+ };
+ __out_opt POSITION Find( __in OBJECT * pObj) const {
+ return FindI(pObj);
+ }
}; // end of class declaration
OpenPOWER on IntegriCloud