Loading...
Searching...
No Matches
HierarchicalModel.hpp
1#pragma once
2#include <score/model/Component.hpp>
3namespace score
4{
8template <typename Model, typename T, T Model::*ptr>
10{
11 using model_type = Model;
12 using child_type = T;
13 static const constexpr auto member = ptr;
14};
15
16template <typename Model, typename... Args>
18
19template <typename Model, typename Arg, typename... Args>
20struct HierarchicModel<Model, Arg, Args...> : public HierarchicModel<Model, Args...>
21{
22public:
23 using HierarchicModel<Model, Args...>::HierarchicModel;
24
25 virtual ~HierarchicModel()
26 {
27 auto& member = this->*Arg::ptr;
28 for(auto elt : member->map().get())
29 {
30 delete elt;
31 }
32 member->map().clear();
33 }
34};
35
36template <typename Model, typename Arg>
37struct HierarchicModel<Model, Arg> : public Model
38{
39public:
40 using Model::Model;
41
42 virtual ~HierarchicModel()
43 {
44 auto& member = this->*Arg::ptr;
45 for(auto elt : member->map().get())
46 {
47 delete elt;
48 }
49 member->map().clear();
50 }
51};
52
53// Special case for the common components case :
54
55template <typename Model>
58}
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition HierarchicalModel.hpp:17
Definition HierarchicalModel.hpp:10