All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ResourceStreamBase.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "LoggingResourceStream.h"
6 #include "Streaming.h"
7 #include "Resources.h"
8 #include "CoverageTrees.h"
9 #include "PrioritisedBlockCoverageTreeList.h"
10 
11 #include <string>
12 #include <map>
13 #include <vector>
14 
15 namespace Eegeo
16 {
17  namespace Streaming
18  {
20  {
21  private:
22 
23  std::map<std::string, Resources::IResourceBuilder*> m_keyedResourceBuilders;
24 
25  Resources::IPlaceholderBuilder *m_pPlaceholderBuilder;
26 
27  uint m_priority;
28 
29  std::vector<IStreamingObserver*> m_streamingObservers;
30 
32 
33  ResourceStreamComponent* m_defaultComponent;
34 
35  std::vector<ResourceStreamComponent*> m_resourceStreamComponents;
36 
37  protected:
38  void registerPlaceholderBuilder(Resources::IPlaceholderBuilder *placeholderBuilder);
39 
40  public:
41  uint priority() const { return m_priority; }
42 
44  ResourceStreamComponent* defaultComponent,
45  IStreamingObserver *pStreamingObserver,
46  uint priority
47  );
48 
50 
51  void AddStreamingObserver(IStreamingObserver *pStreamingObserver);
52  void RemoveStreamingObserver(IStreamingObserver *pStreamingObserver);
53  void NotifyStreamingObserversResourceAdded(const MortonKey& key);
54  void NotifyStreamingObserversResourceRemoved(const MortonKey& key);
55 
56  ResourceStreamComponent* resourceStreamComponentFor(const MortonKey& key) const;
57  bool HasResourceStreamComponentFor(const MortonKey& key) const;
58 
59  Resources::IPlaceholderBuilder* placeholderBuilder();
60 
61  BlockCoverageTrees::PrioritisedBlockCoverageTreeList& GetCoverageTreeList() const { return *m_coverageTreeList; }
62  void SetCoverageTreeList(BlockCoverageTrees::PrioritisedBlockCoverageTreeList* pCoverageTreeList)
63  {
64  Eegeo_DELETE m_coverageTreeList;
65  m_coverageTreeList = pCoverageTreeList;
66  }
67 
68  Resources::IResourceBuilder* GetDefaultResourceBuilder();
69 
70  void AddResourceBuilderByKey(const std::string& key, Resources::IResourceBuilder* builder);
71  void RemoveResourceBuilderByKey(const std::string& key, Resources::IResourceBuilder* builder);
72  Resources::IResourceBuilder* GetResourceBuilderByKey(const std::string& key);
73 
74  void AddResourceStreamComponent(ResourceStreamComponent* resourceStream);
75  void ClearResourceStreamComponents();
76  ResourceStreamComponent* FindResourceStreamComponent(const std::string& name) const;
77  bool IsValid() const;
78  };
79  }
80 }
81 
82