SkillFactory.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <tuple>
4 
6 
7 namespace armarx
8 {
9  namespace skills
10  {
12  {
13  public:
14  using FunctionTypeToCreateSkill = std::function<std::unique_ptr<Skill>()>;
15 
17  {
18  }
19 
21  {
22  }
23 
24  SkillBlueprint(const SkillBlueprint&) = default;
25 
26  virtual ~SkillBlueprint() = default;
27 
28  template <class _Skill, class... Args>
29  requires isSkill<_Skill>
30 
31  static std::unique_ptr<SkillBlueprint>
32  ForSkill(Args&&... args)
33  {
34  auto _createSkill = [=]()
35  {
36  auto ptr = std::make_unique<_Skill>(args...);
37  return ptr;
38  };
39 
40  auto ret = std::make_unique<SkillBlueprint>(std::move(_createSkill));
41  return ret;
42  }
43 
44  virtual std::unique_ptr<Skill>
45  createSkill(const skills::ProviderID& pid) const
46  {
47  auto s = _createSkill();
48  s->setProviderId(pid);
49  return s;
50  }
51 
52  virtual SkillDescription
54  {
55  auto s = createSkill(pid);
56  return s->getSkillDescription();
57  }
58 
59 
60  protected:
62  };
63 
64  template <class T>
66 
67  } // namespace skills
68 } // namespace armarx
armarx::aron::ret
ReaderT::InputType T & ret
Definition: rw.h:21
skills
This file is part of ArmarX.
armarx::skills::SkillBlueprint::~SkillBlueprint
virtual ~SkillBlueprint()=default
armarx::skills::SkillDescription
Definition: SkillDescription.h:18
armarx::requires
requires(!aron::detail::DtoAndBoAreSame< DtoT, BoT >) void toAron(std
Definition: aron_conversions.h:346
armarx::skills::SkillBlueprint::SkillBlueprint
SkillBlueprint(const FunctionTypeToCreateSkill &s)
Definition: SkillFactory.h:16
armarx::skills::SkillBlueprint::createSkillDescription
virtual SkillDescription createSkillDescription(const skills::ProviderID &pid) const
Definition: SkillFactory.h:53
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::skills::ProviderID
Definition: ProviderID.h:15
Skill.h
armarx::skills::isSkillBlueprint
concept isSkillBlueprint
Definition: SkillFactory.h:65
armarx::skills::SkillBlueprint::ForSkill
requires static isSkill< _Skill > std::unique_ptr< SkillBlueprint > ForSkill(Args &&... args)
Definition: SkillFactory.h:32
armarx::skills::SkillBlueprint::FunctionTypeToCreateSkill
std::function< std::unique_ptr< Skill >()> FunctionTypeToCreateSkill
Definition: SkillFactory.h:14
armarx::skills::SkillBlueprint::_createSkill
FunctionTypeToCreateSkill _createSkill
Definition: SkillFactory.h:61
armarx::skills::SkillBlueprint
Definition: SkillFactory.h:11
std
Definition: Application.h:66
armarx::skills::SkillBlueprint::createSkill
virtual std::unique_ptr< Skill > createSkill(const skills::ProviderID &pid) const
Definition: SkillFactory.h:45
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::skills::SkillBlueprint::SkillBlueprint
SkillBlueprint(FunctionTypeToCreateSkill &&s)
Definition: SkillFactory.h:20