6#ifdef COMPONENT_THREAD_SAFE
15#define INVALID_PART_ID UINT64_MAX
32 explicit Part(std::shared_ptr<Context> context);
86 template <
typename,
typename>
friend class PartList;
89 static std::atomic<uint64_t> sNextPartId;
91 std::weak_ptr<Context> mContext;
92#ifdef COMPONENT_THREAD_SAFE
95 mutable std::mutex mContextMutex;
A thread-safe ordered list of Parts.
Definition PartList.h:114
Base class for all identifiable objects in the component system.
Definition Part.h:27
std::shared_ptr< Context > GetContext() const
Returns the Context this Part belongs to, or nullptr if unset.
bool operator==(const Part &other) const
Compares two Parts for equality by their unique IDs.
virtual void OnAdded(bool forced)
Called after this Part has been added to a PartList.
Part()
Constructs a Part and assigns it a unique ID.
uint64_t GetId() const
Returns the unique identifier for this Part.
Part(std::shared_ptr< Context > context)
Constructs a Part with an explicit Context reference and unique ID.
virtual void OnRemoved(bool forced)
Called after this Part has been removed from a PartList.
void SetContext(std::shared_ptr< Context > ctx)
Sets the Context this Part belongs to.
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14