![]() |
Scene Fusion 2 API Reference
|
#include <ksHierarchyObject.h>
Classes | |
class | AncestorIter |
class | DescendantIter |
Public Types | |
typedef std::function< bool(std::shared_ptr< T >)> | ForEachCallback |
Public Member Functions | |
ksHierarchyObject () | |
virtual | ~ksHierarchyObject () |
std::shared_ptr< T > | Parent () |
const std::list< std::shared_ptr< T > > & | Children () |
std::shared_ptr< T > | Child (size_t index) |
int | IndexOfChild (std::shared_ptr< T > childPtr) |
void | Detach () |
bool | IsDescendantOf (std::shared_ptr< T > objPtr) |
virtual bool | AddChild (std::shared_ptr< T > childPtr) |
virtual bool | InsertChild (int index, std::shared_ptr< T > childPtr) |
virtual bool | RemoveChild (std::shared_ptr< T > childPtr) |
void | ForEachDescendant (ForEachCallback callback) |
void | ForSelfAndDescendants (ForEachCallback callback) |
AncestorIter< std::shared_ptr< T > > | SelfAndAncestors () |
AncestorIter< std::shared_ptr< T > > | Ancestors () |
DescendantIter< std::shared_ptr< T > > | SelfAndDescendants () |
DescendantIter< std::shared_ptr< T > > | Descendants () |
Protected Member Functions | |
virtual bool | MoveChild (std::shared_ptr< T > childPtr, int newIndex) |
virtual bool | PerformAddChild (std::shared_ptr< T > childPtr) |
virtual bool | PerformInsertChild (int index, std::shared_ptr< T > childPtr) |
virtual bool | PerformRemoveChild (std::shared_ptr< T > childPtr) |
void | PerformDetach () |
Protected Attributes | |
std::weak_ptr< T > | m_parentPtr |
std::list< std::shared_ptr< T > > | m_children |
Templated base class for hierarchy objects that have a parent and a list of children of type T.
typedef std::function<bool(std::shared_ptr<T>)> KS::ksHierarchyObject< T >::ForEachCallback |
Callback for depth-first searches.
std::shared_ptr<T> | - pointer to the object being iterated. |
|
inline |
Constructor
|
inlinevirtual |
Destructor
|
inlinevirtual |
Adds a child to the object if that does not create a circular reference. If the child has another parent, removes it from its parent first. Throws std::invalid_argument exception if the child is null.
std::shared_ptr<T> | - pointer to the child to add. |
|
inline |
Get an ancestor iterator that does not include the current object.
|
inline |
Return a pointer to a child object at a specific index. If the index is out of bounds then a null pointer is returned.
size_t | - child index |
|
inline |
Return a reference to this object's children list
|
inline |
Get an descendant iterator that does not include the current object.
|
inline |
Removes the object from its parent. Does nothing if the object has no parent.
|
inline |
Iterates the descendants using depth-first search.
ForEachCallback | - callback to call on descendants. If it returns false, will not iterate children. |
|
inline |
Iterates this object and its descendants using depth-first search.
ForEachCallback | - callback to call on descendants. If it returns false, will not iterate children. |
|
inline |
Get the index of a child in this object. Return -1 if the child is not in the list of children
std::shared_ptr<T> | - pointer to the child object |
|
inlinevirtual |
Inserts a child at an index if that does not create a circular reference. If the child has another parent, removes it from its parent first. Throws std::invalid_argument exception if the child is null.
int | - index to insert at. |
std::shared_ptr<T> | - child to insert. |
|
inline |
Checks if an object is a descendant of this object.
std::shared_ptr<T> | - pointer to the object to check. |
|
inlineprotectedvirtual |
Moves a child to a new index. Throws std::invalid_argument exception if child is null.
std::shared_ptr<T> | - child to move. |
int | - new index |
|
inline |
Get a pointer to this object's parent object
|
inlineprotectedvirtual |
Protected implementation of AddChild. The public AddChild calls this one. Derived classes can override either to change public or internal behaviour.
Adds a child to the object if that does not create a circular reference. If the child has another parent, removes it from its parent first. Throws std::invalid_argument exception if the child is null.
std::shared_ptr<T> | - pointer to the child to add. |
|
inlineprotected |
Protected implementation of Detach.
Removes the object from its parent. Does nothing if the object has no parent.
|
inlineprotectedvirtual |
Protected implementation of InsertChild. The public InsertChild calls this one. Derived classes can override either to change public or internal behaviour.
Inserts a child at an index if that does not create a circular reference. If the child has another parent, removes it from its parent first. Throws std::invalid_argument exception if the child is null.
int | - index to insert at. |
std::shared_ptr<T> | - child to insert. |
|
inlineprotectedvirtual |
Protected implementation of RemoveChild. The public RemoveChild calls this one. Derived classes can override either to change public or internal behaviour.
Removes a child from this object. Throws std::invalid_argument exception if child is null.
std::shared_ptr<T> | - child to remove. |
|
inlinevirtual |
Removes a child from this object. Throws std::invalid_argument exception if child is null.
std::shared_ptr<T> | - child to remove. |
|
inline |
Get an ancestor iterator that includes the current object.
|
inline |
Get an descendant iterator that includes the current object.