#ifndef U_CORE_OBJECTS_CONTEXT_H #define U_CORE_OBJECTS_CONTEXT_H #include "Core/Object.h" #include namespace uLib { /** * @brief ObjectsContext represents a collection of Object instances. */ class ObjectsContext : public Object { public: ObjectsContext(); virtual ~ObjectsContext(); virtual const char * GetClassName() const { return "ObjectsContext"; } /** * @brief Adds an object to the context. * @param obj Pointer to the object to add. */ virtual void AddObject(Object* obj); /** * @brief Removes an object from the context. * @param obj Pointer to the object to remove. */ virtual void RemoveObject(Object* obj); /** * @brief Clears all objects from the context. */ void Clear(); /** * @brief Returns the collection of objects. * @return Const reference to the vector of object pointers. */ const std::vector& GetObjects() const; signals: /** @brief Signal emitted when an object is added. */ virtual void ObjectAdded(Object* obj); /** @brief Signal emitted when an object is removed. */ virtual void ObjectRemoved(Object* obj); /** * @brief Returns the number of objects in the context. * @return Size of the collection. */ size_t GetCount() const; /** * @brief Returns an object by index. * @param index The index of the object. * @return Pointer to the object or nullptr if index is out of bounds. */ Object* GetObject(size_t index) const; private: std::vector m_objects; }; } // namespace uLib #endif // U_CORE_OBJECTS_CONTEXT_H