All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
PoiService.h
1 #pragma once
2 
3 #include "Types.h"
4 #include "IPoiService.h"
5 #include "PoiSearch.h"
6 #include "PoiSearchIdGenerator.h"
7 #include "IWebLoadRequestFactory.h"
8 #include "Web.h"
9 #include "WebLoadRequestCompletionCallback.h"
10 #include "LatLongAltitude.h"
11 #include "CallbackCollection.h"
12 #include "PoiServiceConfiguration.h"
13 #include <string>
14 #include <map>
15 
16 
17 namespace Eegeo
18 {
19  namespace PoiSearch
20  {
21  class PoiService: public IPoiService, protected Eegeo::NonCopyable
22  {
23  public:
24  PoiService(
25  const Web::ApiTokenModel& apiTokenModel,
26  Web::IWebLoadRequestFactory& webRequestFactory,
27  const PoiServiceConfiguration& config);
28 
29  ~PoiService();
30 
31  PoiSearchId BeginTextSearch(const TextSearchOptions& options) override;
32  PoiSearchId BeginTagSearch(const TagSearchOptions& options) override;
33  PoiSearchId BeginAutocompleteSearch(const AutocompleteOptions& options) override;
34  void CancelSearch(PoiSearchId poiSearchId) override;
35 
36  void RegisterSearchCompletedCallback(PoiSearchCompletedCallback& callback) override;
37  void UnregisterSearchCompletedCallback(PoiSearchCompletedCallback& callback) override;
38 
39  private:
40 
41  void OnSearchComplete(Web::IWebResponse& webResponse);
42 
43  PoiSearchId CreateSearch();
44 
45  const Web::ApiTokenModel& m_apiTokenModel;
46  Web::IWebLoadRequestFactory& m_webRequestFactory;
48  PoiSearchIdGenerator m_searchIdGenerator;
49  const PoiServiceConfiguration m_config;
50  std::map<PoiSearchId, Web::IWebLoadRequest*> m_webRequests;
52  };
53  }
54 }