Sound Bakery  v0.1.0
Open-source audio middleware for games
Loading...
Searching...
No Matches
object_owner.h
1#pragma once
2
3#include "sound_bakery/pch.h"
4
5namespace sbk::core
6{
12 class SB_CLASS object_owner
13 {
14 public:
15 [[nodiscard]] auto create_runtime_object(const rttr::type& type) -> std::shared_ptr<object>;
16
21 [[nodiscard]] auto create_database_object(const rttr::type& type,
22 bool addToDatabase = true) -> std::shared_ptr<database_object>;
23
24 template <typename T>
25 [[nodiscard]] auto create_runtime_object() -> std::shared_ptr<T>;
26
27 template <typename T>
28 [[nodiscard]] auto create_database_object(bool addToDatabase = true) -> std::shared_ptr<T>;
29
30 auto add_reference_to_object(std::shared_ptr<database_object>& object) -> void;
31
32 auto remove_object(const std::shared_ptr<object>& object) -> std::vector<std::shared_ptr<sbk::core::object>>::iterator;
33
34 auto destroy_all() -> void;
35
36 [[nodiscard]] auto get_objects() -> std::vector<std::shared_ptr<object>>&;
37 [[nodiscard]] auto get_objects() const -> const std::vector<std::shared_ptr<object>>&;
38 [[nodiscard]] auto get_objects_size() const -> std::size_t; //< Get number of objects this object owns
39
40 private:
41 std::vector<std::shared_ptr<object>> m_objects;
42 };
43
44#include "object_owner.inl"
45} // namespace sbk::core
Creates, owns and tracks objects.
Definition object_owner.h:13