#pragma once
//forward references
class DoublyLinkedList;
class ILockable;
class DoublyLinkedListItem
{
	friend class DoublyLinkedList;
private:
	DoublyLinkedListItem(void){};
public:
	DoublyLinkedListItem(DoublyLinkedList *list);
	DoublyLinkedListItem(DoublyLinkedList *list, int id);
	virtual ~DoublyLinkedListItem(void);
	
	// Id
	int  Id;
	DoublyLinkedListItem* Next() { return pNextItem;}
	DoublyLinkedListItem* Prev() { return pPrevItem;}
protected:
	// doubly linked list of objects of a given type
	DoublyLinkedListItem* pNextItem;
	DoublyLinkedListItem* pPrevItem;
	DoublyLinkedList *pList;
};
class DoublyLinkedList
{
private:
	DoublyLinkedList(void){};
public:
	DoublyLinkedList(ILockable* locker);
	virtual ~DoublyLinkedList(void);
	
	void Add(DoublyLinkedListItem* object);
	void Remove(DoublyLinkedListItem* object, int deleteObj = 1);
	void Remove(int Id);
	DoublyLinkedListItem* Find(int Id);
	const DoublyLinkedListItem* First() const { return pFirstItem;}
	const DoublyLinkedListItem* Last() const { return pLastItem;}
	int Count() { return itemCount; }
	//CRITICAL_SECTION CriticalSection; 
protected:
	// Maintain a list of items
	DoublyLinkedListItem* pFirstItem;
	DoublyLinkedListItem* pLastItem;
	int disposed;
	int itemCount;
	ILockable* Locker;
};
                     
                                
                    
                
            
                | # | 
                Change | 
                User | 
                Description | 
                Committed | 
                 | 
            
        
        
        
        
            
                | 
                    
                        #3                    
                 | 
                
                    28480                 | 
                
                    eskopljak                 | 
                
                    submit                 | 
                
                    
                 | 
                
                                            
                                                                
                                                                
                                                         | 
            
        
            
                | 
                    
                        #2                    
                 | 
                
                    28479                 | 
                
                    eskopljak                 | 
                
                    submit                 | 
                
                    
                 | 
                
                                                                                                        
                                     | 
            
        
            
                | 
                    
                        #1                    
                 | 
                
                    28441                 | 
                
                    eskopljak                 | 
                
                    Merging using p4api.net_branch                 | 
                
                    
                 | 
                
                                            
                                                                
                                                                
                                                         | 
            
                
    
                
            
                | 
                    
                    //guest/perforce_software/p4api-net/main/p4bridge/DoublyLinkedList.h                 | 
            
        
        
        
        
            
                | 
                    
                        #1                    
                 | 
                
                    19043                 | 
                
                    Liz Lam                 | 
                
                    Rename p4api.net to p4api-net                 | 
                
                    
                 | 
                
                                            
                                                                
                                                                
                                                         | 
            
                
    
                
            
                | 
                    
                    //guest/perforce_software/p4api.net/main/p4bridge/DoublyLinkedList.h                 | 
            
        
        
        
        
            
                | 
                    
                        #1                    
                 | 
                
                    19042                 | 
                
                    Liz Lam                 | 
                
                    Rename/move file(s) to proper main branch.                 | 
                
                    
                 | 
                
                                            
                                                                
                                                                
                                                         | 
            
                
    
                
            
                | 
                    
                    //guest/perforce_software/p4api.net/p4bridge/DoublyLinkedList.h                 | 
            
        
        
        
        
            
                | 
                    
                        #4                    
                 | 
                
                    11220                 | 
                
                    Matt Attaway                 | 
                
                    Update Workshop version with most recent 14.2 patch of p4api.net                 | 
                
                    
                 | 
                
                                            
                                                                
                                                                
                                                         | 
            
        
            
                | 
                    
                        #3                    
                 | 
                
                    10191                 | 
                
                    Matt Attaway                 | 
                
                    Bring Workshop version of p4api.net up-to-date with the 14.2 release.                 | 
                
                    
                 | 
                
                                            
                                                                
                                                                
                                                         | 
            
        
            
                | 
                    
                        #2                    
                 | 
                
                    8964                 | 
                
                    Bill                 | 
                
                    fix line endings                 | 
                
                    
                 | 
                
                                            
                                                                
                                                                
                                                         | 
            
        
            
                | 
                    
                        #1                    
                 | 
                
                    8873                 | 
                
                    Matt Attaway                 | 
                
                    Initial add of the P4API.NET source code                 | 
                
                    
                 | 
                
                                            
                                                                
                                                                
                                                         |