Sen API
Sen Libraries
Loading...
Searching...
No Matches
sen::Object Class Referenceabstract

A sen object. More...

#include <object.h>

Inheritance diagram for sen::Object:

Public Member Functions

 Object ()=default
virtual ~Object ()=default
virtual const std::string & getName () const noexcept=0
 The name given to the object upon construction.
virtual ObjectId getId () const noexcept=0
 Global unique object identification.
virtual ConstTypeHandle< ClassType > getClass () const noexcept=0
 Reflection information.
virtual NativeObjectasNativeObject () noexcept
 Helper that checks if the object is local (without dynamic casts).
virtual const NativeObjectasNativeObject () const noexcept
 Helper that checks if the object is local (without dynamic casts).
virtual impl::ProxyObject * asProxyObject () noexcept
 Helper that checks if the object is a proxy (without dynamic casts).
virtual const impl::ProxyObject * asProxyObject () const noexcept
 Helper that checks if the object is a proxy (without dynamic casts).
virtual const std::string & getLocalName () const noexcept=0
 An alias used as an alternate way of identifying this object locally.
virtual TimeStamp getLastCommitTime () const noexcept=0
 The point in time when the last commit was called.
virtual Var getPropertyUntyped (const Property *prop) const =0
 Variant-based property getter.
virtual void invokeUntyped (const Method *method, const VarList &args, MethodCallback< Var > &&onDone={})=0
 Reflection- and variant- based interface for (asynchronously) invoking a method on this object. This mechanism is meant to be used only when the natively generated functions are not available or when performance or type safety are of no particular concern. NOLINTNEXTLINE(google-default-arguments).
virtual ConnectionGuard onPropertyChangedUntyped (const Property *prop, EventCallback< VarList > &&callback)=0
 Reflection-based interface for detecting property changes.
virtual ConnectionGuard onEventUntyped (const Event *ev, EventCallback< VarList > &&callback)=0
 Reflection-based interface for reacting to events.
virtual void invokeAllPropertyCallbacks ()=0
 Helper method that invokes all the registered property callbacks, even if/when the property has not changed. This might prove helpful in situations where the initialization code is similar to the one of these callbacks.

Protected Member Functions

virtual void senImplRemoveTypedConnection (ConnId id)=0
virtual void senImplRemoveUntypedConnection (ConnId id, MemberHash memberHash)=0
virtual void senImplEventEmitted (MemberHash id, std::function< VarList()> &&argsGetter, const EventInfo &info)=0
ObjectId senImplMakeId (std::string_view objectName) const
 Creates a unique id.
ConnectionGuard senImplMakeConnectionGuard (ConnId id, MemberHash member, bool typed)
 Creates a guard for a callback.
virtual void senImplWriteAllPropertiesToStream (OutputStream &out) const =0
 Writes all properties to out.
virtual void senImplWriteStaticPropertiesToStream (OutputStream &out) const =0
 Writes all static properties to out.
virtual void senImplWriteDynamicPropertiesToStream (OutputStream &out) const =0
 Writes all dynamic properties to out.

Static Protected Member Functions

static void senImplValidateName (std::string_view name)
 Throws std::exception if the name is not valid.
static std::string senImplComputeLocalName (std::string_view name, std::string_view prefix)
 The name, with a prefix (if any).

Friends

class ConnectionGuard
template<typename... T>
class impl::EventBuffer
void impl::writeAllPropertiesToStream (const Object *instance, OutputStream &out)

Detailed Description

A sen object.

Constructor & Destructor Documentation

◆ Object()

sen::Object::Object ( )
default

◆ ~Object()

virtual sen::Object::~Object ( )
virtualdefault

Member Function Documentation

◆ getName()

virtual const std::string & sen::Object::getName ( ) const
nodiscardpure virtualnoexcept

The name given to the object upon construction.

Implemented in sen::NativeObject.

◆ getId()

virtual ObjectId sen::Object::getId ( ) const
nodiscardpure virtualnoexcept

Global unique object identification.

Implemented in sen::NativeObject.

◆ getClass()

virtual ConstTypeHandle< ClassType > sen::Object::getClass ( ) const
nodiscardpure virtualnoexcept

Reflection information.

◆ asNativeObject() [1/2]

virtual NativeObject * sen::Object::asNativeObject ( )
inlinenodiscardvirtualnoexcept

Helper that checks if the object is local (without dynamic casts).

Reimplemented in sen::NativeObject.

◆ asNativeObject() [2/2]

virtual const NativeObject * sen::Object::asNativeObject ( ) const
inlinenodiscardvirtualnoexcept

Helper that checks if the object is local (without dynamic casts).

Reimplemented in sen::NativeObject.

◆ asProxyObject() [1/2]

virtual impl::ProxyObject * sen::Object::asProxyObject ( )
inlinenodiscardvirtualnoexcept

Helper that checks if the object is a proxy (without dynamic casts).

◆ asProxyObject() [2/2]

virtual const impl::ProxyObject * sen::Object::asProxyObject ( ) const
inlinenodiscardvirtualnoexcept

Helper that checks if the object is a proxy (without dynamic casts).

◆ getLocalName()

virtual const std::string & sen::Object::getLocalName ( ) const
nodiscardpure virtualnoexcept

An alias used as an alternate way of identifying this object locally.

Implemented in sen::NativeObject.

◆ getLastCommitTime()

virtual TimeStamp sen::Object::getLastCommitTime ( ) const
nodiscardpure virtualnoexcept

The point in time when the last commit was called.

Implemented in sen::NativeObject.

◆ getPropertyUntyped()

virtual Var sen::Object::getPropertyUntyped ( const Property * prop) const
nodiscardpure virtual

Variant-based property getter.

Implemented in sen::NativeObject.

◆ invokeUntyped()

virtual void sen::Object::invokeUntyped ( const Method * method,
const VarList & args,
MethodCallback< Var > && onDone = {} )
pure virtual

Reflection- and variant- based interface for (asynchronously) invoking a method on this object. This mechanism is meant to be used only when the natively generated functions are not available or when performance or type safety are of no particular concern. NOLINTNEXTLINE(google-default-arguments).

Implemented in sen::NativeObject.

◆ onPropertyChangedUntyped()

virtual ConnectionGuard sen::Object::onPropertyChangedUntyped ( const Property * prop,
EventCallback< VarList > && callback )
nodiscardpure virtual

Reflection-based interface for detecting property changes.

Note
Only one callback per property is stored. This mechanism is meant to be used only when the natively generated functions are not available or when performance or type safety are of no particular concern.

Implemented in sen::NativeObject.

◆ onEventUntyped()

virtual ConnectionGuard sen::Object::onEventUntyped ( const Event * ev,
EventCallback< VarList > && callback )
nodiscardpure virtual

Reflection-based interface for reacting to events.

Note
Only one callback per event is stored. This mechanism is meant to be used only when the natively generated functions are not available or when performance or type safety are of no particular concern.

Implemented in sen::NativeObject.

◆ invokeAllPropertyCallbacks()

virtual void sen::Object::invokeAllPropertyCallbacks ( )
pure virtual

Helper method that invokes all the registered property callbacks, even if/when the property has not changed. This might prove helpful in situations where the initialization code is similar to the one of these callbacks.

◆ senImplRemoveTypedConnection()

virtual void sen::Object::senImplRemoveTypedConnection ( ConnId id)
protectedpure virtual

◆ senImplRemoveUntypedConnection()

virtual void sen::Object::senImplRemoveUntypedConnection ( ConnId id,
MemberHash memberHash )
protectedpure virtual

Implemented in sen::NativeObject.

◆ senImplEventEmitted()

virtual void sen::Object::senImplEventEmitted ( MemberHash id,
std::function< VarList()> && argsGetter,
const EventInfo & info )
protectedpure virtual

Implemented in sen::NativeObject.

◆ senImplMakeId()

ObjectId sen::Object::senImplMakeId ( std::string_view objectName) const
nodiscardprotected

Creates a unique id.

◆ senImplMakeConnectionGuard()

ConnectionGuard sen::Object::senImplMakeConnectionGuard ( ConnId id,
MemberHash member,
bool typed )
nodiscardprotected

Creates a guard for a callback.

◆ senImplValidateName()

void sen::Object::senImplValidateName ( std::string_view name)
staticprotected

Throws std::exception if the name is not valid.

◆ senImplComputeLocalName()

std::string sen::Object::senImplComputeLocalName ( std::string_view name,
std::string_view prefix )
staticnodiscardprotected

The name, with a prefix (if any).

◆ senImplWriteAllPropertiesToStream()

virtual void sen::Object::senImplWriteAllPropertiesToStream ( OutputStream & out) const
protectedpure virtual

Writes all properties to out.

◆ senImplWriteStaticPropertiesToStream()

virtual void sen::Object::senImplWriteStaticPropertiesToStream ( OutputStream & out) const
protectedpure virtual

Writes all static properties to out.

◆ senImplWriteDynamicPropertiesToStream()

virtual void sen::Object::senImplWriteDynamicPropertiesToStream ( OutputStream & out) const
protectedpure virtual

Writes all dynamic properties to out.

◆ ConnectionGuard

friend class ConnectionGuard
friend

◆ impl::EventBuffer

template<typename... T>
friend class impl::EventBuffer
friend

◆ impl::writeAllPropertiesToStream

void impl::writeAllPropertiesToStream ( const Object * instance,
OutputStream & out )
friend

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