All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WebRequestHandlePool.h
1 // Copyright eeGeo Ltd (2012-2015), All Rights Reserved
2 #pragma once
3 
4 #include "Types.h"
5 #include "Web.h"
6 
7 #include <string>
8 #include <vector>
9 #include <queue>
10 
11 namespace Eegeo
12 {
13  namespace Web
14  {
16  {
17  public:
18  WebRequestHandlePool(const int poolSize, const std::string& caCertFilePath);
20 
21  bool HasCapacity() const;
22 
23  bool TryGetHandle(WebRequestHandle*& pOutHandle);
24  void ReturnHandle(WebRequestHandle* pHandle);
25 
26  const std::vector<WebRequestHandle*>& GetHandlesInUse() const;
27  private:
28  std::vector<WebRequestHandle*> m_handlesInUse;
29  std::queue<WebRequestHandle*> m_handlesFree;
30  std::vector<WebRequestHandle*> m_handles; // debugging aid -- use to track handle in order of allocation (so we can say "slot 1 completed request, etc.")
31  };
32  }
33 }