8#ifndef SEN_CORE_META_PROPERTY_H
9#define SEN_CORE_META_PROPERTY_H
47 std::vector<std::string>
tags = {})
61 return lhs.name == rhs.name && lhs.description == rhs.description && lhs.category == rhs.category &&
62 lhs.transportMode == rhs.transportMode && lhs.tags == rhs.tags && lhs.checkedSet == rhs.checkedSet &&
73 std::vector<std::string>
tags;
94 [[nodiscard]] std::string_view
getName() const noexcept;
139 [[nodiscard]]
bool operator==(const
Property& other) const noexcept;
142 [[nodiscard]]
bool operator!=(const
Property& other) const noexcept;
151 std::shared_ptr<const
Method> setterMethod_;
152 std::shared_ptr<const
Method> getterMethod_;
153 std::shared_ptr<const
Event> changeEvent_;
168 auto result =
hashCombine(
hashSeed, spec.name, spec.category, spec.transportMode, spec.type->getHash());
170 for (
const auto& tag: spec.tags)
Here we define a set of template meta-programming helpers to let the compiler take some decisions bas...
Represents an event.
Definition core/include/sen/core/meta/event.h:34
Represents a method.
Definition method.h:96
bool getCheckedSet() const noexcept
If true, the user will validate sets to the property value.
const std::vector< std::string > & getTags() const noexcept
Any user-defined tags.
static std::shared_ptr< Property > make(PropertySpec spec)
Factory function that validates the spec and creates a property. Throws std::exception if the spec is...
static std::string makeChangeNotificationEventName(const PropertySpec &spec)
Utility function that creates the name of a change notification event. Throws std::exception if the s...
Property(PropertySpec spec, Private notUsable)
std::string_view getName() const noexcept
The name of the property.
TransportMode getTransportMode() const noexcept
Gets the transport mode for this property.
MemberHash getHash() const noexcept
Returns a unique hash for the Property computed at compile time.
const Method & getSetterMethod() const noexcept
The setter method.
static std::string makeGetterMethodName(const PropertySpec &spec)
Utility function that creates the name of a getter method. Throws std::exception if the spec has an e...
PropertyCategory getCategory() const noexcept
Gets the property category.
const Event & getChangeEvent() const noexcept
The change notification event.
std::string_view getDescription() const noexcept
The documentation of the property.
ConstTypeHandle getType() const noexcept
Gets the return type of the method (nullptr means void).
MemberHash getId() const noexcept
The propety id.
const Method & getGetterMethod() const noexcept
The getter method.
static std::string makeSetterMethodName(const PropertySpec &spec)
Utility function that creates the name of a setter method. Throws std::exception if the spec has an e...
constexpr u32 hashSeed
Initial seed for all hashes.
Definition hash32.h:33
u32 hashCombine(u32 seed, const Types &... args) noexcept
Combines the hash of different values into a single 32-bit hash.
Definition hash32.h:214
#define SEN_PRIVATE_TAG
Definition compiler_macros.h:490
PropertyCategory
How a property is seen by others.
Definition property.h:31
TypeHandle< const T > ConstTypeHandle
Definition type.h:319
TransportMode
How to transport information.
Definition type.h:56
@ staticRO
Does not change over time, can only be set via code.
Definition property.h:32
@ staticRW
Does not change over time, can be set via code and configuration.
Definition property.h:33
@ dynamicRO
May change over time, cannot be set from outside.
Definition property.h:35
@ dynamicRW
May change over time, can be set from outside.
Definition property.h:34
@ multicast
Directed to all receivers, unreliable, unordered, no congestion control.
Definition type.h:58
uint32_t u32
Definition numbers.h:25
The hash of a member.
Definition type.h:39
Data of a property.
Definition property.h:40
PropertyCategory category
Definition property.h:70
TransportMode transportMode
Definition property.h:72
ConstTypeHandle type
Definition property.h:71
friend bool operator!=(const PropertySpec &lhs, const PropertySpec &rhs) noexcept
Definition property.h:65
friend bool operator==(const PropertySpec &lhs, const PropertySpec &rhs) noexcept
Definition property.h:59
std::string description
Definition property.h:69
std::vector< std::string > tags
Definition property.h:73
std::string name
Definition property.h:68
bool checkedSet
Definition property.h:74
PropertySpec(std::string name, std::string description, ConstTypeHandle<> type, PropertyCategory category=PropertyCategory::dynamicRO, TransportMode transportMode=TransportMode::multicast, bool checkedSet=false, std::vector< std::string > tags={})
Definition property.h:41