Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
RobotAPI
Commits
d11c236f
Commit
d11c236f
authored
2 years ago
by
Fabian Reister
Browse files
Options
Downloads
Patches
Plain Diff
SkillProviderComponentPlugin: addSkill with template param
parent
faf4451e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/RobotAPI/libraries/skills/provider/SkillProviderComponentPlugin.h
+13
-0
13 additions, 0 deletions
.../libraries/skills/provider/SkillProviderComponentPlugin.h
with
13 additions
and
0 deletions
source/RobotAPI/libraries/skills/provider/SkillProviderComponentPlugin.h
+
13
−
0
View file @
d11c236f
...
...
@@ -4,6 +4,7 @@
#include
<queue>
#include
<thread>
#include
<functional>
#include
<type_traits>
#include
<ArmarXCore/core/ComponentPlugin.h>
#include
<ArmarXCore/core/ManagedIceObject.h>
...
...
@@ -66,6 +67,18 @@ namespace armarx
void
addSkill
(
const
skills
::
LambdaSkill
::
FunT
&
,
const
skills
::
SkillDescription
&
);
void
addSkill
(
std
::
unique_ptr
<
skills
::
Skill
>&&
);
template
<
typename
T
>
T
*
addSkill
()
{
static_assert
(
std
::
is_base_of
<
skills
::
Skill
,
T
>::
value
,
"T must be derived from skills::Skill!"
);
static_assert
(
std
::
is_default_constructible
<
T
>::
value
,
"T must be default constructible!"
);
auto
skill
=
std
::
make_unique
<
T
>
();
auto
*
skillPtr
=
skill
.
get
();
addSkill
(
std
::
move
(
skill
));
return
static_cast
<
T
*>
(
skillPtr
);
}
private
:
armarx
::
plugins
::
SkillProviderComponentPlugin
*
plugin
=
nullptr
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment