A class that implements a scene node streamer.
The streamer class manages a list of streamable items. When these items are in the 'streaming region', they get streamed in. When these items are out of the 'streaming region', they get streamed out. The streaming region (and whether a given item is within the streaming region or not) is defined by the subclass implementation of CYIStreamer.
The streamable items are created automatically when an instance of CYINodeAdapter is assigned to the streamer. New items are also created (or removed) as needed when the adapter notifies that new items have been added. If the associated adapter is removed from the streamer, all existing streamable items are removed.
When a streamable item is streamed in, the associated CYINodeAdapter instance is used to create a scene node for it. When a streamable item is streamed out, that scene node is released back to the associated CYINodeAdapter instance.
In order to use a CYIStreamer object, a subclass must be made that implements the pure virtual functions. These functions handle the actual attachment of scene nodes to a scene tree. Typically, the class that implements a streamer would be a subclass of CYISceneNode. The subclass of CYIStreamer must call CYIStreamer::Init to initialize the streamer.
#include <streamer/YiStreamer.h>

Public Member Functions | |
| CYIStreamer () | |
| virtual | ~CYIStreamer () |
| void | SetAdapter (std::unique_ptr< CYINodeAdapter > pAdapter) |
| const CYINodeAdapter * | GetAdapter () const |
| CYINodeAdapter * | GetAdapter () |
| bool | RequestFocusOnItem (uint32_t uIndex, CYIFocus::FOCUS_DIRECTION eDirection=CYIFocus::FOCUS_FORWARD, CYIFocus::FOCUS_ROOT_RULE eFocusRootRule=CYIFocus::FOCUS_ROOT_DESCENDANTS_UPDATE_CONTEXT, const CYIAABB &previousFocusRect=CYIAABB()) |
| bool | IsStreamedIn (uint32_t uIndex) const |
| CYISceneNode * | GetStreamedNode (uint32_t uIndex) const |
| uint32_t | GetItemIndex (CYISceneNode *pStreamableItem) const |
Protected Member Functions | |
| void | Init (CYISceneManager *pSceneManager) |
| void | UpdateStreamedStateOfAllItems () |
| virtual void | StreamedIn (uint32_t uIndex, CYISceneNode *pStreamedItem) |
| virtual void | OnStreamedIn (uint32_t uIndex, CYISceneNode *pStreamedItem) |
| virtual void | StreamedOut (uint32_t uIndex, CYISceneNode *pStreamedItem) |
| virtual void | OnStreamedOut (uint32_t uIndex, CYISceneNode *pStreamedItem) |
| virtual void | InsertItem (uint32_t uIndex, std::unique_ptr< CYISceneNode > pItem)=0 |
| virtual std::unique_ptr< CYISceneNode > | RemoveItem (uint32_t uIndex, CYISceneNode *pItem)=0 |
| virtual void | ReorderItem (uint32_t uFromIndex, uint32_t uToIndex, CYISceneNode *pItem)=0 |
| virtual bool | IsItemInStreamingRegion (CYISceneNode *pItem) const =0 |
| virtual CYISceneNode * | GetItem (uint32_t uIndex) const =0 |
| virtual bool | CanBeStreamedOut (uint32_t uIndex, CYISceneNode *pNode) const =0 |
| virtual void | OnFocusGainedForItem (uint32_t uIndex) |
| virtual void | FocusGainedForItem (uint32_t uIndex) |
| virtual void | OnFocusLostForItem (uint32_t uIndex) |
| virtual void | FocusLostForItem (uint32_t uIndex) |
Friends | |
| class | CYIStreamerSlots |
| class | CYIStreamableView |
| CYIStreamer::CYIStreamer | ( | ) |
|
virtual |
|
protectedpure virtual |
Checks if the streamable item at index uIndex can be streamed out. The implementation may require some nodes to remain streamed in, even if the node is outside of the streaming region.
|
protectedvirtual |
A function called when focus enters the tree rooted at the item at index uIndex.
Reimplemented in CYIListView.
|
protectedvirtual |
A function called when focus leaves the tree rooted at the item at index uIndex.
Reimplemented in CYIListView.
| const CYINodeAdapter* CYIStreamer::GetAdapter | ( | ) | const |
| CYINodeAdapter* CYIStreamer::GetAdapter | ( | ) |
|
protectedpure virtual |
Fetches and returns the streamable item at index uIndex.
| uint32_t CYIStreamer::GetItemIndex | ( | CYISceneNode * | pStreamableItem | ) | const |
Returns the index of the streamable item pStreamableItem. If pStreamableItem is not a streamable item, std::numeric_limits<uint32_t>::max() is returned.
| CYISceneNode* CYIStreamer::GetStreamedNode | ( | uint32_t | uIndex | ) | const |
Returns the streamed node for index uIndex. Returns nullptr if the item at index uIndex is not currently streamed in, or if uIndex is out-of-bounds.
|
protected |
Initializes this streamer using the scene manager pSceneManager.
|
protectedpure virtual |
Inserts the streamable item pItem at index uIndex.
|
protectedpure virtual |
Checks if the streamable item pItem is currently in the streaming region.
| bool CYIStreamer::IsStreamedIn | ( | uint32_t | uIndex | ) | const |
Returns true if the item at index uIndex is currently streamed in, false otherwise. false is also returned if uIndex is out-of-bounds.
|
protectedvirtual |
A function called when focus enters the tree rooted at the item at index uIndex.
Reimplemented in CYIListView.
|
protectedvirtual |
A function called when focus leaves the tree rooted at the item at index uIndex.
Reimplemented in CYIListView.
|
protectedvirtual |
A function called when the item at index uIndex is streamed in. The streamed node (as provided by the associated adapter) is provided as pStreamedItem. This function is called after the item has been attached to the scene tree. Subclasses can override this function to perform post-streaming logic.
Reimplemented in CYIListView.
|
protectedvirtual |
A function called when the item at index uIndex is streamed out. The streamed node (as provided by the associated adapter) is provided as pStreamedItem. This function is called before the item has been detached from the scene tree. Subclasses can override this function to perform post-streaming logic.
Reimplemented in CYIListView.
|
protectedpure virtual |
Removes the streamable item pItem from the CYIStreamer implementation. The item pItem is expected to be at index uIndex.
|
protectedpure virtual |
Moves the streamable item pItem from index uFromIndex to index uToIndex.
| bool CYIStreamer::RequestFocusOnItem | ( | uint32_t | uIndex, |
| CYIFocus::FOCUS_DIRECTION | eDirection = CYIFocus::FOCUS_FORWARD, |
||
| CYIFocus::FOCUS_ROOT_RULE | eFocusRootRule = CYIFocus::FOCUS_ROOT_DESCENDANTS_UPDATE_CONTEXT, |
||
| const CYIAABB & | previousFocusRect = CYIAABB() |
||
| ) |
Assigns focus within the streamable item at uIndex. Returns false if uIndex does not represent a streamable item or the streamable item at uIndex does not contain a focusable view.
| void CYIStreamer::SetAdapter | ( | std::unique_ptr< CYINodeAdapter > | pAdapter | ) |
Sets an adapter for use with this streamer.
When a new adapter is set, n new items are created in the streamer (where n matches the value returned by the adapter's GetItemsCount() function).
|
protectedvirtual |
A function called when the item at index uIndex is streamed in. The streamed node (as provided by the associated adapter) is provided as pStreamedItem. This function is called after the item has been attached to the scene tree. Subclasses can override this function to perform post-streaming logic.
|
protectedvirtual |
A function called when the item at index uIndex is streamed out. The streamed node (as provided by the associated adapter) is provided as pStreamedItem. This function is called before the item has been detached from the scene tree. Subclasses can override this function to perform post-streaming logic.
|
protected |
Causes the streamer to re-check the streamed state of all exiting items. Items that are now in the streaming region will be streamed in, and items that are no longer in the streaming region will be streamed out.
|
friend |
|
friend |