Loading...
Searching...
No Matches
EntityBase.hpp
1#pragma once
2
3#include <score/model/Component.hpp>
4#include <score/model/IdentifiedObject.hpp>
5#include <score/model/ModelMetadata.hpp>
6
7#include <ossia/network/base/name_validation.hpp>
8namespace score
9{
22template <typename T>
23class Entity : public IdentifiedObject<T>
24{
25public:
26 static const constexpr bool entity_tag = true;
27 using entity_type = Entity<T>;
28
29 Entity(Id<T> id, const QString& name, QObject* parent) noexcept
30 : IdentifiedObject<T>{std::move(id), name, parent}
31 {
32 m_metadata.setParent(this);
33 }
34
35 template <typename Visitor>
36 Entity(Visitor&& vis, QObject* parent) noexcept
37 : IdentifiedObject<T>{std::forward<Visitor>(vis), parent}
38 {
39 using vis_type = typename std::remove_reference_t<Visitor>::type;
40 m_metadata.setParent(this);
41 TSerializer<vis_type, Entity<T>>::writeTo(vis, *this);
42 }
43
44 const score::Components& components() const noexcept { return m_components; }
45 score::Components& components() noexcept { return m_components; }
46 const score::ModelMetadata& metadata() const noexcept { return m_metadata; }
47 score::ModelMetadata& metadata() noexcept { return m_metadata; }
48
49private:
50 score::Components m_components;
51 ModelMetadata m_metadata;
52};
53}
The IdentifiedObject class.
Definition IdentifiedObject.hpp:19
The id_base_t class.
Definition Identifier.hpp:57
Base for complex model objects.
Definition EntityBase.hpp:24
The ModelMetadata class.
Definition ModelMetadata.hpp:22
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition VisitorInterface.hpp:13
Definition lib/score/model/Component.hpp:41