You.i Engine
YiPooledViewRecycler.h
Go to the documentation of this file.
1 // © You i Labs Inc. All rights reserved.
2 #ifndef _YI_POOLED_VIEW_RECYCLER_H_
3 #define _YI_POOLED_VIEW_RECYCLER_H_
4 
6 
7 #include <map>
8 
10 class CYISceneView;
11 class CYISceneManager;
12 class CYIViewTemplate;
13 
27 {
28 public:
30  virtual ~CYIPooledViewRecycler();
31 
38  virtual std::unique_ptr<CYISceneView> TakeView(const std::shared_ptr<CYIAssetViewTemplate> &pAssetViewTemplate, CYISceneManager *pSceneManager, const CYIRuntimeTypeInfo *pViewType = nullptr) override;
39 
43  virtual void RecycleView(std::unique_ptr<CYISceneView> pView) override;
44 
45 private:
46  CYIString GetViewPoolID(const std::shared_ptr<CYIAssetViewTemplate> &pAssetViewTemplate, const CYIRuntimeTypeInfo *pViewType) const;
47  void AddViewTypeToPool(const CYIString &viewPoolID);
48 
49  std::unique_ptr<CYISceneView> TakeViewFromPool(const CYIString &viewPoolID);
50  void AddViewToPool(const CYIString &viewPoolID, CYISceneView *pView);
51 
52  typedef std::map<CYISceneView *, bool> ViewMap;
53  typedef std::map<CYIString, ViewMap> TypeMap;
55  TypeMap m_pool;
56 };
57 
60 #endif // _YI_POOLED_VIEW_RECYCLER_H_
virtual ~CYIPooledViewRecycler()
Scene trees composed of CYISceneNode objects are registered with the scene manager in order for them ...
Definition: YiSceneManager.h:82
The base class for all view types. Views are containers of renderable elements that often define inte...
Definition: YiSceneView.h:47
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:32
virtual std::unique_ptr< CYISceneView > TakeView(const std::shared_ptr< CYIAssetViewTemplate > &pAssetViewTemplate, CYISceneManager *pSceneManager, const CYIRuntimeTypeInfo *pViewType=nullptr) override
A view template defines information about a view, so it can be built automatically.
Definition: YiViewTemplate.h:29
Definition: YiPooledViewRecycler.h:26
The abstract runtime representation of a C++ type.
Definition: YiRtti.h:58
Definition: YiCreateDeleteViewRecycler.h:22
virtual void RecycleView(std::unique_ptr< CYISceneView > pView) override