All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
NavigationGraphRepository.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "Navigation.h"
7 #include "MortonKey.h"
8 #include <map>
9 #include <vector>
10 
11 namespace Eegeo
12 {
13  namespace Resources
14  {
15  namespace Roads
16  {
17  namespace Navigation
18  {
20  {
21  public:
22  typedef std::map<Eegeo::Streaming::MortonKey, NavigationGraph*, Eegeo::Streaming::MortonKeyCompare> TMap;
23  typedef TMap::const_iterator TConstIterator;
24 
26  : m_linkManager(linkManager)
27  {
28 
29  }
30 
31  void Add(NavigationGraph& navGraph);
32  void Remove(const NavigationGraph& navigationGraph);
33  bool TryGetByMortonKey(const Eegeo::Streaming::MortonKey& key, NavigationGraph*& graph) const;
34 
35  void RegisterAddedCallback(INavigationGraphAddedCallback* callback);
36  void UnregisterAddedCallback(INavigationGraphAddedCallback* callback);
37  void RegisterRemovalCallback(INavigationGraphRemovalCallback* callback);
38  void UnregisterRemovalCallback(INavigationGraphRemovalCallback* callback);
39 
40  TConstIterator Begin() const { return m_storage.begin(); }
41  TConstIterator End() const { return m_storage.end(); }
42 
43  private:
44  void CallAddedCallbacks(const NavigationGraph& navGraph);
45  void CallRemovalCallbacks(const NavigationGraph& navGraph);
46 
47  TMap m_storage;
48  std::vector<INavigationGraphAddedCallback*> m_addedCallbacks;
49  std::vector<INavigationGraphRemovalCallback*> m_removalCallbacks;
50  NavigationGraphLinkManager& m_linkManager;
51  };
52  }
53  }
54  }
55 }