8#ifndef SEN_CORE_OBJ_OBJECT_H
9#define SEN_CORE_OBJ_OBJECT_H
38template <
typename... T>
40void writeAllPropertiesToStream(
const Object* instance,
OutputStream& out);
75class SEN_EXPORT
Object:
public std::enable_shared_from_this<Object>
85 [[nodiscard]]
virtual const std::string&
getName() const noexcept = 0;
88 [[nodiscard]] virtual ObjectId
getId() const noexcept = 0;
101 [[nodiscard]]
virtual impl::ProxyObject*
asProxyObject() noexcept {
return nullptr; }
104 [[nodiscard]]
virtual const impl::ProxyObject*
asProxyObject() const noexcept {
return nullptr; }
107 [[nodiscard]]
virtual const std::string&
getLocalName() const noexcept = 0;
146 template <
typename... T>
147 friend class impl::EventBuffer;
Represents an event.
Definition core/include/sen/core/meta/event.h:34
Represents a method.
Definition method.h:96
An object instantiated in this process. This is the base class for all user-implemented objects.
Definition native_object.h:63
virtual const std::string & getName() const noexcept=0
The name given to the object upon construction.
virtual void senImplWriteDynamicPropertiesToStream(OutputStream &out) const =0
Writes all dynamic properties to out.
virtual void invokeAllPropertyCallbacks()=0
Helper method that invokes all the registered property callbacks, even if/when the property has not c...
virtual void senImplRemoveUntypedConnection(ConnId id, MemberHash memberHash)=0
virtual ~Object()=default
ObjectId senImplMakeId(std::string_view objectName) const
Creates a unique id.
virtual NativeObject * asNativeObject() noexcept
Helper that checks if the object is local (without dynamic casts).
Definition object.h:95
virtual void senImplRemoveTypedConnection(ConnId id)=0
virtual TimeStamp getLastCommitTime() const noexcept=0
The point in time when the last commit was called.
virtual ConnectionGuard onPropertyChangedUntyped(const Property *prop, EventCallback< VarList > &&callback)=0
Reflection-based interface for detecting property changes.
virtual ConstTypeHandle< ClassType > getClass() const noexcept=0
Reflection information.
friend class ConnectionGuard
Definition object.h:141
virtual ObjectId getId() const noexcept=0
Global unique object identification.
virtual const NativeObject * asNativeObject() const noexcept
Helper that checks if the object is local (without dynamic casts).
Definition object.h:98
virtual ConnectionGuard onEventUntyped(const Event *ev, EventCallback< VarList > &&callback)=0
Reflection-based interface for reacting to events.
virtual void senImplEventEmitted(MemberHash id, std::function< VarList()> &&argsGetter, const EventInfo &info)=0
virtual const std::string & getLocalName() const noexcept=0
An alias used as an alternate way of identifying this object locally.
virtual impl::ProxyObject * asProxyObject() noexcept
Helper that checks if the object is a proxy (without dynamic casts).
Definition object.h:101
virtual void senImplWriteStaticPropertiesToStream(OutputStream &out) const =0
Writes all static properties to out.
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....
ConnectionGuard senImplMakeConnectionGuard(ConnId id, MemberHash member, bool typed)
Creates a guard for a callback.
virtual const impl::ProxyObject * asProxyObject() const noexcept
Helper that checks if the object is a proxy (without dynamic casts).
Definition object.h:104
static void senImplValidateName(std::string_view name)
Throws std::exception if the name is not valid.
virtual void senImplWriteAllPropertiesToStream(OutputStream &out) const =0
Writes all properties to out.
virtual Var getPropertyUntyped(const Property *prop) const =0
Variant-based property getter.
static std::string senImplComputeLocalName(std::string_view name, std::string_view prefix)
The name, with a prefix (if any).
Represents a property.
Definition property.h:79
A point in time.
Definition timestamp.h:26
Emit
How to emit an event.
Definition object.h:51
Callback< MethodCallInfo, MethodResult< R > > MethodCallback
A method callback.
Definition callback.h:212
Callback< EventInfo, Args... > EventCallback
An event callback.
Definition callback.h:208
@ onCommit
When commit is called.
Definition object.h:53
@ now
Directly when it happens.
Definition object.h:52
Information about an event emission.
Definition callback.h:50
std::vector< Var > VarList
A list of vars to represent sequences.
Definition var.h:104
TypeHandle< const T > ConstTypeHandle
Definition type.h:319
OutputStreamTemplate< LittleEndian > OutputStream
Definition output_stream.h:64
#define SEN_STRONG_TYPE_HASHABLE(name)
Makes your strong type std::hashable. NOLINTNEXTLINE.
Definition strong_type.h:188
#define SEN_STRONG_TYPE(name, native_type)
Helper macro to define strong types. NOLINTNEXTLINE.
Definition strong_type.h:179
The hash of a member.
Definition type.h:39
Utility to indicate that your class wants to be passed by value in some of the library calls.
Definition class_helpers.h:34
Can hold any supported value type. Wraps std::variant to allow recursion and implements some helpers.
Definition var.h:119