ModelFactory.hpp
1 #pragma once
2 #include <score/plugins/Interface.hpp>
3 
4 namespace score
5 {
6 template <typename Component_T, typename ComponentFactoryBase_T>
7 class GenericComponentFactoryImpl : public ComponentFactoryBase_T
8 {
9  using model_type = typename Component_T::model_type;
10  using base_model_type = typename ComponentFactoryBase_T::base_model_type;
11  using system_type = typename ComponentFactoryBase_T::system_type;
12  using component_type = Component_T;
13  using ConcreteKey = typename ComponentFactoryBase_T::ConcreteKey;
14  using ComponentFactoryBase_T::ComponentFactoryBase_T;
15 
16  static constexpr auto static_concreteKey() noexcept
17  {
18  return Component_T::static_key().impl();
19  }
20 
21  constexpr ConcreteKey concreteKey() const noexcept final override
22  {
23  return Component_T::static_key().impl(); // Note : here there is a
24  // conversion between
25  // UuidKey<Component> and
26  // ConcreteKey
27  }
28 
29  bool matches(const base_model_type& p) const final override
30  {
31  return dynamic_cast<const model_type*>(&p);
32  }
33 };
34 }
Definition: ModelFactory.hpp:8
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: ObjectMatches.hpp:6