Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

UploadQueues.h

Go to the documentation of this file.
00001 //
00002 // UploadQueues.h
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 
00022 #pragma once
00023 
00024 class CUploadQueue;
00025 class CUploadTransfer;
00026 
00027 class CLibraryFile;
00028 class CDownload;
00029 
00030 
00031 class CUploadQueues
00032 {
00033 // Construction
00034 public:
00035         CUploadQueues();
00036         virtual ~CUploadQueues();
00037 
00038 // Attributes
00039 public:
00040         CCriticalSection        m_pSection;
00041         CUploadQueue*           m_pTorrentQueue;
00042         CUploadQueue*           m_pHistoryQueue;
00043 protected:
00044         CPtrList                        m_pList;
00045 
00046         BOOL                            m_bDonkeyLimited;
00047 
00048 // Operations
00049 public:
00050         BOOL    Enqueue(CUploadTransfer* pUpload, BOOL bForce = FALSE);
00051         BOOL    Dequeue(CUploadTransfer* pUpload);
00052         int             GetPosition(CUploadTransfer* pUpload, BOOL bStart);
00053         BOOL    StealPosition(CUploadTransfer* pTarget, CUploadTransfer* pSource);
00054 public:
00055         CUploadQueue*   Create(LPCTSTR pszName = NULL, BOOL bTop = FALSE);
00056         void                    Delete(CUploadQueue* pQueue);
00057         BOOL                    Reorder(CUploadQueue* pQueue, CUploadQueue* pBefore);
00058         CUploadQueue*   SelectQueue(PROTOCOLID nProtocol, CLibraryFile* pFile);
00059         CUploadQueue*   SelectQueue(PROTOCOLID nProtocol, CDownload* pFile);
00060         CUploadQueue*   SelectQueue(PROTOCOLID nProtocol, LPCTSTR pszName, QWORD nSize, BOOL bPartial, LPCTSTR pszShareTags = NULL);
00061 public:
00062         int             GetTotalBandwidthPoints( BOOL ActiveOnly = FALSE );
00063         int             GetQueueCapacity();
00064         int             GetQueuedCount();
00065         int             GetQueueRemaining();
00066         int             GetTransferCount();
00067         BOOL    IsTransferAvailable();
00068         DWORD   GetMinimumDonkeyBandwidth();
00069         DWORD   GetCurrentDonkeyBandwidth();
00070         BOOL    CanUpload(PROTOCOLID nProtocol, CLibraryFile *pFile, BOOL bCanQueue = FALSE );  // Can this file be uploaded with the current queue setup?
00071         int             QueueRank(PROTOCOLID nProtocol, CLibraryFile *pFile );  // What queue position would this file be in?
00072 
00073 public:
00074         void    Clear();
00075         BOOL    Load();
00076         BOOL    Save();
00077         void    CreateDefault();
00078         void    Validate();
00079 protected:
00080         void    Serialize(CArchive& ar);
00081 
00082 // Inline Access
00083 public:
00084         inline POSITION GetIterator() const
00085         {
00086                 return m_pList.GetHeadPosition();
00087         }
00088 
00089         inline CUploadQueue* GetNext(POSITION& pos) const
00090         {
00091                 return (CUploadQueue*)m_pList.GetNext( pos );
00092         }
00093 
00094         inline int GetCount() const
00095         {
00096                 return m_pList.GetCount();
00097         }
00098 
00099         inline BOOL Check(CUploadQueue* pQueue) const
00100         {
00101                 if ( pQueue == NULL ) return FALSE;
00102                 return m_pList.Find( pQueue ) != NULL;
00103         }
00104 
00105         inline BOOL     IsDonkeyRatioActive() const 
00106         { 
00107                 return ( m_bDonkeyLimited ); 
00108         }
00109 
00110 };
00111 
00112 extern CUploadQueues UploadQueues;

Generated on Thu Dec 15 10:39:50 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2