34#include "DesignProperties.h"
35#include <NDEVR/DesignObjectBase.h>
36#include <NDEVR/RWLock.h>
37#include <NDEVR/TranslatedString.h>
160 template<
class t_type,
class t_property_type>
161 [[nodiscard]]
constexpr decltype(
auto)
get(t_property_type property)
const
163 return PropertyInterface<t_property_type>::template Get<t_type>(
this, property);
172 template<auto t_property,
class t_type>
173 [[nodiscard]]
constexpr decltype(
auto)
get()
const
175 using t_property_type = std::decay_t<
decltype(t_property)>;
176 return PropertyInterface<t_property_type>::template Get<t_property, t_type>(
this);
185 template<auto t_property>
186 [[nodiscard]]
constexpr decltype(
auto)
get()
const
188 using t_property_type = std::decay_t<
decltype(t_property)>;
189 return PropertyInterface<t_property_type>::template Get<t_property>(
this);
199 template<
class t_type,
class t_property_type>
200 void set(t_property_type property,
const t_type& value)
211 template<auto t_property,
class t_type>
212 void set(
const t_type& value)
214 using t_property_type = std::decay_t<
decltype(t_property)>;
215 PropertyInterface<t_property_type>::template
Set<t_property>(
this, value);
228 template<
class t_type,
class t_property_type>
229 bool update(t_property_type property,
const t_type& value,
const void* lock =
nullptr)
231 if (!
is(property, value))
234 set(property, value);
250 template<auto t_property,
class t_type>
251 bool update(
const t_type& value,
const void* lock =
nullptr)
270 template<
class t_type,
class t_design_type>
283 template<
class t_property_type>
284 [[nodiscard]]
bool is(t_property_type property,
const StringView& value)
const
296 template<
class t_property_type>
297 [[nodiscard]]
bool is(t_property_type property,
const char* value)
const
309 template<
class t_property_type>
310 [[nodiscard]]
bool is(t_property_type property,
const String& value)
const
323 template<
class t_property_type,
class t_type>
324 [[nodiscard]]
typename std::enable_if<!ObjectInfo<t_type>::String,
bool>::type
is(t_property_type property,
const t_type& value)
const
335 template<auto t_property>
338 using t_property_type = std::decay_t<
decltype(t_property)>;
348 template<auto t_property>
349 [[nodiscard]]
bool is(
const char* value)
const
351 using t_property_type = std::decay_t<
decltype(t_property)>;
361 template<auto t_property>
364 using t_property_type = std::decay_t<
decltype(t_property)>;
375 template<auto t_property,
class t_type>
376 [[nodiscard]]
typename std::enable_if<!ObjectInfo<t_type>::String,
bool>::type
is(
const t_type& value)
const
390 return m_base->design_properties[eint01(property)]->beginsWith(
index(), value, ignore_case);
402 return m_base->design_properties[eint01(property)]->contains(
index(), value, ignore_case);
412 template<
class t_type>
421 return parent.
get<t_type>(property);
729 template<
class t_type>
732 m_base->design_properties[eint01(property)]->set(
m_index, value);
736 static_assert(
sizeof(DesignObject) == 16,
"DesignObject size incorrect");
738 template class NDEVR_DESIGN_API StringStream<NDPO>;
758 static const bool Enum =
false;
779 struct hash<DesignObject>
786 std::size_t operator()(
const DesignObject& d)
const noexcept
789 std::size_t value = 0;
790 for (
uint01 i = 0; i < 8; i++)
792 value = value * 256 + (s[i + 0U] ^ s[i + 8U]);
Forward declaration of the central design object registry.
uint04 m_index
Row index of this object within the property database.
uint04 m_design_index
Index of the parent design that owns this object.
DesignObjectBase * m_base
Pointer to the owning DesignObjectBase property database.
Provides the underlying data storage for the NDEVR Scene Model hierarchy.
A low-level database object that can be used to access general stored properties within the NDEVR Mod...
DesignObject()=default
Creates an "invalid" design object.
void setActiveFilters(const JSONNode &node)
Sets the active filters on this design object from a JSON structure.
constexpr decltype(auto) get(t_property_type property) const
Retrieves a property value from the database, cast to the requested type.
void scale(Vector< 3, fltp08 > scale, Vertex< 3, fltp08 > center_of_scale=Constant< Vertex< 3, fltp08 > >::Invalid)
Scales this design object's geometry and transform by the given scale factors around a center point.
void appendData(const StringView &data, bool compressed)
Appends data to this design object's data storage.
bool operator!=(const DesignObject &object) const
Checks inequality with another DesignObject.
void setMetaData(const StringView &index, const bool &data)
Sets a metadata entry at the given key to a boolean value.
bool hasProperty(t_design_type property) const
Checks whether a property has a valid (non-default) value.
std::enable_if<!ObjectInfo< t_type >::String, bool >::type is(const t_type &value) const
Checks whether a compile-time property matches a non-string value using equality comparison.
bool is(t_property_type property, const char *value) const
Checks whether a string property matches the given C-string value.
bool operator==(const DesignObject &object) const
Checks equality with another DesignObject by comparing base pointers and indices.
uint04 index() const
Returns the primary row index of this object within the DesignObjectBase property table.
void set(const t_type &value)
Sets a property value in the database using a compile-time property constant.
void set(t_property_type property, const t_type &value)
Sets a property value in the database.
bool update(const t_type &value, const void *lock=nullptr)
Updates a property using a compile-time property constant, only if the new value differs.
constexpr decltype(auto) get() const
Retrieves a property value using a compile-time property constant, cast to the requested type.
void clearMetaData(const StringView &index)
Removes a specific metadata entry by key.
void scale(Vector< 3, fltp08 > scale, Vertex< 3, fltp08 > center_of_scale, const Matrix< fltp08 > &transform)
Scales this design object's geometry by the given scale factors around a center point,...
void copyFrom(const DesignObject &object)
Copies all properties from the given design object into this one.
bool is(const char *value) const
Checks whether a compile-time property matches the given C-string value.
bool is(const String &value) const
Checks whether a compile-time property matches the given String value.
DesignObject(uint04 index, DesignObjectBase *base)
Sets a DesignObject up to be a pointer to an existing object in the database.
bool hasMetaData(const StringView &index) const
Checks whether a metadata entry exists for the given key.
void offsetDesign(const Vector< 3, fltp08 > &offset)
Translates this design object by the given offset vector.
const JSONNode & metaData() const
Retrieves the entire metadata tree for this design object.
void setMetaData(const StringView &index, const uint01 &data)
Sets a metadata entry at the given key to a uint01 value.
bool is(t_property_type property, const String &value) const
Checks whether a string property matches the given String value.
void _setProperty(NDPO property, const t_type &value)
Low-level property setter that directly writes to the design properties table without triggering side...
constexpr decltype(auto) get() const
Retrieves a property value using a compile-time property constant, with the type deduced from Propert...
const Table & propertyTable() const
Returns a const reference to the property table that stores this object's properties.
decltype(auto) getInheritedProperty(NDPO property) const
Retrieves a property value, walking up the parent hierarchy if the property is not set on this object...
Scene getScene() const
Retrieves the Scene that this design object belongs to.
void setMetaData(const StringView &index, const StringView &data)
Sets a metadata entry at the given key to a StringView value.
void setMetaData(const StringView &index, const JSONNode &node)
Sets a metadata entry at the given key to the specified JSON node value.
std::enable_if<!ObjectInfo< t_type >::String, bool >::type is(t_property_type property, const t_type &value) const
Checks whether a non-string property matches the given value using equality comparison.
File file() const
Returns the file path associated with this design object as a File object.
Table & propertyTable()
Returns a mutable reference to the property table that stores this object's properties.
static constexpr StringView FilePathDesignNameVariable()
Returns the placeholder variable string used in file paths to represent the design name.
bool isDesignType(DesignObjectType mode) const
Checks whether this object has the specified design type flag set.
bool isValid() const
Checks whether this design object has a valid index into the database.
void setMetaData(const JSONNode &node)
Replaces the entire metadata tree with the given JSON node.
DesignObject(DesignObjectBase *base)
Creates an new design object within the given DesignObjectBase.
bool isDesignType(uint04 mode) const
Checks whether this object has the specified design type flag set, using a raw integer value.
bool validateDesignObject() const
Validates the internal state of this design object, ensuring indices and base pointer are consistent.
bool is(t_property_type property, const StringView &value) const
Checks whether a string property matches the given StringView value.
DesignObjectBase & base() const
Returns a reference to the underlying DesignObjectBase database.
void removeMetaData(const StringView &index, const void *lock_ptr=nullptr)
Removes a metadata entry by key, with optional write lock support.
void updateMetaData(const StringView &index, const String &data, const void *lock_ptr=nullptr)
Updates a metadata entry only if the new value differs from the current value.
void setDesignType(DesignObjectType mode, bool is_type)
Sets or clears a design type flag on this object.
const JSONNode & metaData(const StringView &index) const
Retrieves a specific metadata entry by key.
bool doesPropertyContain(NDPO property, const StringView &value, bool ignore_case) const
Checks whether a string property's value contains the given substring.
void updateMetaData(const StringView &index, const StringView &data, const void *lock_ptr=nullptr)
Updates a metadata entry only if the new value differs from the current value.
bool doesPropertyBeginWith(NDPO property, const StringView &value, bool ignore_case) const
Checks whether a string property's value begins with the given substring.
DesignObject getDesignParent() const
Retrieves the parent design object of this object in the model hierarchy.
void clearAllMetaData()
Removes all metadata entries from this design object.
void setMetaData(const StringView &index, const uint04 &data)
Sets a metadata entry at the given key to a uint04 value.
bool update(t_property_type property, const t_type &value, const void *lock=nullptr)
Updates a property only if the new value differs from the current value.
void initDesignObject()
Initializes default property values for this design object after construction.
void setMetaData(const StringView &index, const String &data)
Sets a metadata entry at the given key to a String value.
StringView getIcon() const
Retrieves the icon identifier string associated with this design object.
void setMetaData(const StringView &index, const fltp08 &data)
Sets a metadata entry at the given key to a 64-bit floating point value.
void updateCreatedTime()
Sets the creation time stamp for this design object to the current system time.
JSONNode activeFilters() const
Retrieves the active filters applied to this design object as a JSON structure.
uint04 designIndex() const
Returns the design-specific index used to access type-specific properties (e.g., model,...
bool updateDesignVisible(bool is_visible, const void *lock=nullptr)
Updates the spatial visibility of this design object if it differs from the current value.
void updateDesignModifiedTime(Time time=Time::SystemTime())
Updates the modified time stamp for this design object.
void updateMetaData(const StringView &index, const bool &data, const void *lock_ptr=nullptr)
Updates a metadata entry only if the new value differs from the current value.
void updateMetaData(const StringView &index, const fltp08 &data, const void *lock_ptr=nullptr)
Updates a metadata entry only if the new value differs from the current value.
bool is(const StringView &value) const
Checks whether a compile-time property matches the given StringView value.
bool operator<(const DesignObject &object) const
Less-than comparison for ordering DesignObjects (e.g., for sorted containers).
DesignObject(const DesignInfo &info)
Constructs a DesignObject from an existing DesignInfo, sharing the same base and indices.
bool operator>(const DesignObject &object) const
Greater-than comparison for ordering DesignObjects (e.g., for sorted containers).
void updateDesignTransform(const Matrix< fltp08 > &transform, const void *lock=nullptr)
Updates the transform of this design object if it differs from the current value.
A core class that provides a dynamic effect to an object in a model hierarchy.
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
A core class within the model hierarchy containing vertex-based data (Usually 3D data) within a set c...
JavaScript Object Notation or JSON is an open - standard file format that uses human - readable text ...
Container responsible for storing and setting the appearance of a Model or Geometry within the NDEVR ...
Templated logic for doing matrix multiplication.
A core class that represents a node on model hierarchy.
static void Set(DesignInfo *object, t_property_enum property, const t_value_type &value)
Sets the value of a property on a design object using a runtime property enum.
static bool IsSame(const DesignInfo *object, t_value_type property, const StringView &value)
Checks whether a property's stored value matches a given string representation.
The root Model that is responsible for storing the underlying data for all Scene Models.
Responsible for turning a user interaction into a selection within a DesignObjectLookup.
Container that stores unique elements in no particular order, and which allow for fast retrieval or i...
The core String View class for the NDEVR API.
The core String class for the NDEVR API.
Represents a timestamp with utilities for manipulation and conversion.
static Time SystemTime()
Retrieves the current system time which is a combination of std::chrono::steady_clock to ensure smoot...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
A point in N-dimensional space, used primarily for spatial location information.
Used to lock a particular variable for writing.
The primary namespace for the NDEVR SDK.
static constexpr bool IsValid(const Angle< t_type > &value)
Checks whether the given Angle holds a valid value.
PrimitiveAlignedBuffer< Effect, 16 > EffectBuffer
Aligned buffer of Effect objects with 16-byte alignment.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
NDPO
NDPO - NDEVR Design Property Object: Values stored in the property database.
@ guid
A 128-bit globally unique identifier for the object.
@ file
The source file path associated with this object.
PrimitiveAlignedBuffer< Model, 16 > ModelBuffer
Aligned buffer of Model objects with 16-byte alignment.
PrimitiveAlignedBuffer< Geometry, 16 > GeometryBuffer
Aligned buffer of Geometry objects with 16-byte alignment.
PrimitiveAlignedBuffer< Material, 16 > MaterialBuffer
Aligned buffer of Material objects with 16-byte alignment.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
static const bool Float
Whether this type is a floating-point type.
static const bool Unsigned
Whether this type is unsigned.
static const bool Integer
Whether this type is an integer type.
static const bool String
Whether this type is a string type.
static const uint01 Dimensions
Number of vector dimensions (0 for scalar types).
static const bool Number
Whether this type is a numeric type.
static const bool Primitive
Whether this type is a primitive type.
static const bool Enum
Whether this type is an enum type.
static const bool Pointer
Whether this type is a pointer type.
static const bool Color
Whether this type is a color type.
static const bool Vector
Whether this type is a vector type.
static constexpr ObjectInfo< DesignObject, false, false > VectorSub()
Returns the ObjectInfo for the sub-element type when this type is used as a vector.
static const bool Boolean
Whether this type is a boolean type.
static const bool Buffer
Whether this type is a buffer type.
Information about the object.