3#include "sound_bakery/pch.h"
15 std::shared_ptr<object> create_runtime_object(
const rttr::type& type);
16 std::shared_ptr<object> load_object(YAML::Node& node);
21 std::shared_ptr<database_object> create_database_object(
const rttr::type& type,
bool addToDatabase =
true);
24 std::shared_ptr<T> create_runtime_object();
27 std::shared_ptr<T> create_database_object();
29 void remove_object(
const std::shared_ptr<object>&
object);
30 void destroy_all() { m_objects.clear(); }
32 std::vector<std::shared_ptr<object>>& get_objects() {
return m_objects; }
33 const std::vector<std::shared_ptr<object>>& get_objects()
const {
return m_objects; }
36 std::vector<std::shared_ptr<object>> m_objects;
40 std::shared_ptr<T> object_owner::create_runtime_object()
42 if (!rttr::type::get<T>().
is_derived_from(rttr::type::get<sbk::core::object>()))
44 SPDLOG_ERROR(
"Cannot create object. Objects must derive from the base object type");
48 if (std::shared_ptr<object>
object = create_runtime_object(rttr::type::get<T>()))
50 if (std::shared_ptr<T> castedObject = std::static_pointer_cast<T>(
object))
60 std::shared_ptr<T> object_owner::create_database_object()
62 if (!rttr::type::get<T>().is_derived_from(rttr::type::get<sbk::core::database_object>()))
64 SPDLOG_ERROR(
"Cannot create object. Database objects must derive from the base database object type");
70 if (std::shared_ptr<T> castedObject = std::static_pointer_cast<T>(
object))
Definition database_ptr.h:23
Creates, owns and tracks objects.
Definition object_owner.h:13
std::shared_ptr< database_object > create_database_object(const rttr::type &type, bool addToDatabase=true)
Definition object_owner.cpp:109