Scene Fusion 2 API Reference
KS::SceneFusion2::sfObject Class Referenceabstract

#include <sfObject.h>

Inheritance diagram for KS::SceneFusion2::sfObject:
KS::ksHierarchyObject< sfObject >

Public Types

enum  ObjectFlags : uint8_t { NoFlags = 0 , OptionalChildren = 1 << 1 , Transient = 1 << 2 }
 
typedef std::shared_ptr< sfObjectSPtr
 
- Public Types inherited from KS::ksHierarchyObject< sfObject >
typedef std::function< bool(std::shared_ptr< sfObject >)> ForEachCallback
 

Public Member Functions

virtual ~sfObject ()
 
virtual std::string ToString ()=0
 
virtual const uint32_t & Id () const =0
 
virtual const sfNameType () const =0
 
virtual const ObjectFlags Flags () const =0
 
virtual sfProperty::SPtr Property ()=0
 
virtual void SetProperty (sfProperty::SPtr propertyPtr)=0
 
virtual std::shared_ptr< sfSessionSession ()=0
 
virtual bool IsSyncing ()=0
 
virtual bool IsCreated ()=0
 
virtual bool IsCreatePending ()=0
 
virtual bool IsUnsubscriptionPending ()=0
 
virtual bool IsDeletePending ()=0
 
virtual sfUser::SPtr LockOwner ()=0
 
virtual bool CanEdit ()=0
 
virtual bool CanEditChildren ()=0
 
virtual bool IsLocked ()=0
 
virtual bool IsLockPending ()=0
 
virtual bool IsFullyLocked ()=0
 
virtual bool IsPartiallyLocked ()=0
 
virtual bool IsLockedDirectly ()=0
 
virtual void RequestLock ()=0
 
virtual void ReleaseLock ()=0
 
virtual bool SetChildIndex (int index)=0
 
- Public Member Functions inherited from KS::ksHierarchyObject< sfObject >
 ksHierarchyObject ()
 
virtual ~ksHierarchyObject ()
 
std::shared_ptr< sfObject > Parent ()
 
const std::list< std::shared_ptr< sfObject > > & Children ()
 
std::shared_ptr< sfObject > Child (size_t index)
 
int IndexOfChild (std::shared_ptr< sfObject > childPtr)
 
void Detach ()
 
bool IsDescendantOf (std::shared_ptr< sfObject > objPtr)
 
virtual bool AddChild (std::shared_ptr< sfObject > childPtr)
 
virtual bool InsertChild (int index, std::shared_ptr< sfObject > childPtr)
 
virtual bool RemoveChild (std::shared_ptr< sfObject > childPtr)
 
void ForEachDescendant (ForEachCallback callback)
 
void ForSelfAndDescendants (ForEachCallback callback)
 
AncestorIter< std::shared_ptr< sfObject > > SelfAndAncestors ()
 
AncestorIter< std::shared_ptr< sfObject > > Ancestors ()
 
DescendantIter< std::shared_ptr< sfObject > > SelfAndDescendants ()
 
DescendantIter< std::shared_ptr< sfObject > > Descendants ()
 

Static Public Member Functions

static SPtr Create (const sfName &type, sfProperty::SPtr propertyPtr=nullptr, ObjectFlags flags=NoFlags)
 

Additional Inherited Members

- Protected Member Functions inherited from KS::ksHierarchyObject< sfObject >
virtual bool MoveChild (std::shared_ptr< sfObject > childPtr, int newIndex)
 
virtual bool PerformAddChild (std::shared_ptr< sfObject > childPtr)
 
virtual bool PerformInsertChild (int index, std::shared_ptr< sfObject > childPtr)
 
virtual bool PerformRemoveChild (std::shared_ptr< sfObject > childPtr)
 
void PerformDetach ()
 
- Protected Attributes inherited from KS::ksHierarchyObject< sfObject >
std::weak_ptr< sfObject > m_parentPtr
 
std::list< std::shared_ptr< sfObject > > m_children
 

Detailed Description

Objects are synced between server and clients. Objects have an id, a user-defined string type, and a property which may be a collection of properties. Objects are arranged in a hierarchy and can be locked by users. When objects are constructed they are not automatically synced. To begin syncing an object, call sfSession.Create(sfObject::SPtr).

Member Enumeration Documentation

◆ ObjectFlags

Object flags.

OptionalChildren: Clients will not receive children for this object unless they subscribe to it using sfSession::SubscribeToChildren Transient: The object will be deleted when the user who created it leaves the session.

Constructor & Destructor Documentation

◆ ~sfObject()

virtual KS::SceneFusion2::sfObject::~sfObject ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ CanEdit()

virtual bool KS::SceneFusion2::sfObject::CanEdit ( )
pure virtual

Can we edit the object? Objects cannot be edited if they are locked by another user, if they are deleted locally and we're waiting for the server to resolve the delete request, or while applying changes from the server.

Returns
bool

◆ CanEditChildren()

virtual bool KS::SceneFusion2::sfObject::CanEditChildren ( )
pure virtual

Can we edit the children of this object? Objects cannot have their children edited if they are fully locked by another user (meaning that user directly locked the object or one of its ancestors), if they are deleted locally and we're waiting for the server to resolve the delete request, or while applying changes from the server.

Returns
bool

◆ Create()

static SPtr KS::SceneFusion2::sfObject::Create ( const sfName type,
sfProperty::SPtr  propertyPtr = nullptr,
ObjectFlags  flags = NoFlags 
)
static

Shared pointer constructor.

Parameters
constsfName& - type of object.
sfProperty::SPtr- property for the object.
ObjectFlags- flags.

◆ Flags()

virtual const ObjectFlags KS::SceneFusion2::sfObject::Flags ( ) const
pure virtual

Object flags.

Returns
ObjectFlags

◆ Id()

virtual const uint32_t& KS::SceneFusion2::sfObject::Id ( ) const
pure virtual

Object id.

Returns
const uint32_t&

◆ IsCreated()

virtual bool KS::SceneFusion2::sfObject::IsCreated ( )
pure virtual

Is the object created on the server? This differs slightly from IsSyncing. When we send a create request, IsSyncing becomes true, but IsCreated becomes true when the server acknowledges the creation. Similarly when we send a delete request, IsSyncing becomes false but IsCreated becomes false when the server acknowledges the deletion.

Returns
bool

◆ IsCreatePending()

virtual bool KS::SceneFusion2::sfObject::IsCreatePending ( )
pure virtual

Are we waiting for the server to create this object?

Returns
bool

◆ IsDeletePending()

virtual bool KS::SceneFusion2::sfObject::IsDeletePending ( )
pure virtual

Are we waiting for the server to delete this object?

Returns
bool

◆ IsFullyLocked()

virtual bool KS::SceneFusion2::sfObject::IsFullyLocked ( )
pure virtual

Is the object fully locked? Locked objects are either fully locked or partially locked. Partially locked objects can have their children edited and full locked objects cannot. An object is fully locked if it or one of its ancestors is locked directly. Otherwise if a descendant is locked directly, the object is partially locked.

Returns
bool

◆ IsLocked()

virtual bool KS::SceneFusion2::sfObject::IsLocked ( )
pure virtual

Is the object locked directly or indirectly by another user?

Returns
bool

◆ IsLockedDirectly()

virtual bool KS::SceneFusion2::sfObject::IsLockedDirectly ( )
pure virtual

Is this object locked directly? An object is locked directly if another user called RequestLock() on the object.

Returns
bool

◆ IsLockPending()

virtual bool KS::SceneFusion2::sfObject::IsLockPending ( )
pure virtual

Are we waiting to acquire a lock on this object?

Returns
bool

◆ IsPartiallyLocked()

virtual bool KS::SceneFusion2::sfObject::IsPartiallyLocked ( )
pure virtual

Is the object partially locked? Locked objects are either fully locked or partially locked. Partially locked objects can have their children edited and fully locked objects cannot. An object is fully locked if it or one of its ancestors is locked directly. Otherwise if a descendant is locked directly, the object is partially locked.

Returns
bool

◆ IsSyncing()

virtual bool KS::SceneFusion2::sfObject::IsSyncing ( )
pure virtual

Are changes to the object being synced? To begin syncing an object, call sfSession.Create(sfObject).

Returns
bool

◆ IsUnsubscriptionPending()

virtual bool KS::SceneFusion2::sfObject::IsUnsubscriptionPending ( )
pure virtual

Are we waiting for the server to unsubscribe the local player from this object's children?

Returns
bool

◆ LockOwner()

virtual sfUser::SPtr KS::SceneFusion2::sfObject::LockOwner ( )
pure virtual

The user who owns the lock on this object, either directly or indirectly. A user will indirectly own a lock if they directly lock an ancestor of the object. Null if no user owns a lock on this object. The object may still be indirectly locked without a lock owner if one or more users own locks on descendants of the object.

Returns
sfUser::SPtr

◆ Property()

virtual sfProperty::SPtr KS::SceneFusion2::sfObject::Property ( )
pure virtual

Object property.

Returns
sfProperty::SPtr

◆ ReleaseLock()

virtual void KS::SceneFusion2::sfObject::ReleaseLock ( )
pure virtual

Releases the lock on this object, or stops trying to acquire the lock if we do not own the lock on this object.

◆ RequestLock()

virtual void KS::SceneFusion2::sfObject::RequestLock ( )
pure virtual

Requests a lock on this object. If the object is locked by another user, tries to acquire the lock when it becomes unlocked. If the object is not syncing, call this before calling sfSession.Create to create the object with a lock.

◆ Session()

virtual std::shared_ptr<sfSession> KS::SceneFusion2::sfObject::Session ( )
pure virtual

The session the object belongs to.

Returns
std::shared_ptr<sfSession>

◆ SetChildIndex()

virtual bool KS::SceneFusion2::sfObject::SetChildIndex ( int  index)
pure virtual

Sets the child index, changing the object's placement in its parent's child list. Does nothing if the object has no parent, the object is locked, the index is out of bounds, or the child is already at the given index.

Parameters
int- index to move child to.
Returns
bool - true if the child was moved successfully. Note that this does not wait for a response from the server, so it may return true and be reverted later if another user gets a lock that prevents the child move. If the child was already at the given index, returns false.

◆ SetProperty()

virtual void KS::SceneFusion2::sfObject::SetProperty ( sfProperty::SPtr  propertyPtr)
pure virtual

Set the property used by this object.

Parameters
sfProperty::SPtr- property

◆ ToString()

virtual std::string KS::SceneFusion2::sfObject::ToString ( )
pure virtual

String representation of this object.

Returns
std::string

◆ Type()

virtual const sfName& KS::SceneFusion2::sfObject::Type ( ) const
pure virtual

User-defined object type.

Returns
const sfName&

The documentation for this class was generated from the following file: