Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic-graph
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
dynamic-graph
Commits
f69fa1da
Commit
f69fa1da
authored
14 years ago
by
Nicolas Mansard
Browse files
Options
Downloads
Patches
Plain Diff
Added command 3 params.
parent
ff0fe104
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/dynamic-graph/command-bind.h
+87
-0
87 additions, 0 deletions
include/dynamic-graph/command-bind.h
with
87 additions
and
0 deletions
include/dynamic-graph/command-bind.h
+
87
−
0
View file @
f69fa1da
...
@@ -247,6 +247,93 @@ namespace dynamicgraph {
...
@@ -247,6 +247,93 @@ namespace dynamicgraph {
}
// namespace command
}
// namespace command
}
// namespace dynamicgraph
}
// namespace dynamicgraph
/* --- FUNCTION 3 ARGS ------------------------------------------------------ */
namespace
dynamicgraph
{
namespace
command
{
template
<
class
E
,
typename
T1
,
typename
T2
,
typename
T3
>
struct
CommandVoid3
:
public
Command
{
typedef
boost
::
function
<
void
(
const
T1
&
,
const
T2
&
,
const
T3
&
)
>
function_t
;
typedef
boost
::
function
<
void
(
E
*
,
const
T1
&
,
const
T2
&
,
const
T3
&
)
>
memberFunction_t
;
typedef
void
(
E
::*
memberFunction_ptr_t
)
(
const
T1
&
,
const
T2
&
,
const
T3
);
CommandVoid3
(
E
&
entity
,
function_t
function
,
const
std
::
string
&
docString
)
:
Command
(
entity
,
boost
::
assign
::
list_of
(
ValueHelper
<
T1
>::
TypeID
)
(
ValueHelper
<
T2
>::
TypeID
)
(
ValueHelper
<
T3
>::
TypeID
),
docString
)
,
fptr
(
function
)
{}
protected
:
virtual
Value
doExecute
()
{
assert
(
getParameterValues
().
size
()
==
3
);
T1
val1
=
getParameterValues
()[
0
].
value
();
T2
val2
=
getParameterValues
()[
1
].
value
();
T3
val3
=
getParameterValues
()[
2
].
value
();
fptr
(
val1
,
val2
,
val3
);
return
Value
();
// void
}
private
:
function_t
fptr
;
};
template
<
class
E
,
typename
T1
,
typename
T2
,
typename
T3
>
CommandVoid3
<
E
,
T1
,
T2
,
T3
>*
makeCommandVoid3
(
E
&
entity
,
typename
CommandVoid3
<
E
,
T1
,
T2
,
T3
>::
function_t
function
,
const
std
::
string
&
docString
)
{
return
new
CommandVoid3
<
E
,
T1
,
T2
,
T3
>
(
entity
,
function
,
docString
);
}
template
<
class
E
,
typename
T1
,
typename
T2
,
typename
T3
>
CommandVoid3
<
E
,
T1
,
T2
,
T3
>*
makeCommandVoid3
(
E
&
entity
,
// The following syntaxt don't compile when not specializing the template
// arg... why ???
//typename CommandVoid3<E,T1,T2>::memberFunction_t function ,
boost
::
function
<
void
(
E
*
,
const
T1
&
,
const
T2
&
,
const
T3
&
)
>
function
,
const
std
::
string
&
docString
)
{
return
new
CommandVoid3
<
E
,
T1
,
T2
,
T3
>
(
entity
,
boost
::
bind
(
function
,
&
entity
,
_1
,
_2
,
_3
),
docString
);
}
template
<
class
E
,
typename
T1
,
typename
T2
,
typename
T3
>
CommandVoid3
<
E
,
T1
,
T2
,
T3
>*
makeCommandVoid3
(
E
&
entity
,
void
(
E
::*
function
)
(
const
T1
&
,
const
T2
&
,
const
T3
&
),
const
std
::
string
&
docString
)
{
return
new
CommandVoid3
<
E
,
T1
,
T2
,
T3
>
(
entity
,
boost
::
bind
(
function
,
&
entity
,
_1
,
_2
,
_3
),
docString
);
return
NULL
;
}
std
::
string
docCommandVoid3
(
const
std
::
string
&
doc
,
const
std
::
string
&
type1
,
const
std
::
string
&
type2
,
const
std
::
string
&
type3
)
{
return
(
std
::
string
(
"
\n
"
)
+
doc
+
"
\n\n
"
+
"Input:
\n
- A "
+
type1
+
".
\n
"
+
"Input:
\n
- A "
+
type2
+
".
\n
"
+
"Input:
\n
- A "
+
type3
+
".
\n
"
+
"Void return.
\n\n
"
);
}
}
// namespace command
}
// namespace dynamicgraph
/* --- FUNCTION VERBOSE ----------------------------------------------------- */
/* --- FUNCTION VERBOSE ----------------------------------------------------- */
/* This bind a function void f( ostream& ) that display some results into
/* This bind a function void f( ostream& ) that display some results into
* a string f( void ) that return some string results. */
* a string f( void ) that return some string results. */
...
...
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