Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hydra-image-processor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
OpenSource
hydra-image-processor
Commits
ff5d9694
Commit
ff5d9694
authored
6 years ago
by
Mark Winter
Browse files
Options
Downloads
Patches
Plain Diff
Correctly select and load inputs/outputs for matlab frontend
parent
123a7fbf
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
src/c/Mex/MexArgConverter.h
+22
-10
22 additions, 10 deletions
src/c/Mex/MexArgConverter.h
with
22 additions
and
10 deletions
src/c/Mex/MexArgConverter.h
+
22
−
10
View file @
ff5d9694
...
...
@@ -65,12 +65,12 @@ namespace Script
throw
ArgError
(
"Invalid number of input arguments: at most %d inputs allowed"
,
InOptSel
::
seq
::
size
());
// Linkup output subset
loadSelected
(
OutputSel
::
se
q
{},
scriptPtrs
,
nlhs
,
plhs
);
loadSelected
(
OutputSel
::
se
lect
(
scriptPtrs
)
,
nlhs
,
plhs
);
// InOpt subset
// NOTE: Will set scriptPtrs to null if they are past end of prhs
// nullptrs are ignored during conversion, allowing optionals
loadSelected
(
InOptSel
::
se
q
{},
scriptPtrs
,
nrhs
,
prhs
);
loadSelected
(
InOptSel
::
se
lect
(
scriptPtrs
)
,
nrhs
,
prhs
);
}
...
...
@@ -133,29 +133,41 @@ namespace Script
template
<
typename
T
>
static
void
convert_impl
(
Script
::
ArrayType
*&
out
,
const
ImageView
<
T
>&
in
)
{
}
{}
private
:
template
<
std
::
size_t
...
Is
>
static
void
loadSelected
(
mph
::
index_sequence
<
Is
...
>
,
ScriptPtrs
&
script
Ptrs
,
mwSize
count
,
const
Script
::
ArrayType
*
args
[])
template
<
std
::
size_t
...
Is
,
typename
...
PtrTypes
>
static
void
loadSelected
_impl
(
mph
::
index_sequence
<
Is
...
>
,
std
::
tuple
<
PtrTypes
...
>&
sel
Ptrs
,
mwSize
count
,
const
Script
::
ArrayType
*
args
[])
{
(
void
)
std
::
initializer_list
<
int
>
{
// NOTE: Have to be careful to only hook up &args[i] for i < count
((
std
::
get
<
Is
>
(
s
cript
Ptrs
)
=
(
Is
<
count
)
?
(
&
args
[
Is
])
:
(
nullptr
)),
void
(),
0
)...
((
std
::
get
<
Is
>
(
s
el
Ptrs
)
=
(
Is
<
count
)
?
(
&
args
[
Is
])
:
(
nullptr
)),
void
(),
0
)...
};
}
template
<
std
::
size_t
...
Is
>
static
void
loadSelected
(
mph
::
index_sequence
<
Is
...
>
,
ScriptPtrs
&
script
Ptrs
,
mwSize
count
,
Script
::
ArrayType
*
args
[])
template
<
std
::
size_t
...
Is
,
typename
...
PtrTypes
>
static
void
loadSelected
_impl
(
mph
::
index_sequence
<
Is
...
>
,
std
::
tuple
<
PtrTypes
...
>&
sel
Ptrs
,
mwSize
count
,
Script
::
ArrayType
*
args
[])
{
(
void
)
std
::
initializer_list
<
int
>
{
// NOTE: Have to be careful to only hook up &args[i] for i < count
((
std
::
get
<
Is
>
(
s
cript
Ptrs
)
=
(
Is
<
count
)
?
(
&
args
[
Is
])
:
(
nullptr
)),
void
(),
0
)...
((
std
::
get
<
Is
>
(
s
el
Ptrs
)
=
(
Is
<
count
)
?
(
&
args
[
Is
])
:
(
nullptr
)),
void
(),
0
)...
};
}
// Only hook up selected subset of outputs/input pointers to arg set
template
<
typename
...
PtrTypes
>
static
void
loadSelected
(
std
::
tuple
<
PtrTypes
...
>&
selPtrs
,
mwSize
count
,
const
Script
::
ArrayType
*
args
[])
{
loadSelected_impl
(
mph
::
make_index_sequence
<
sizeof
...(
PtrTypes
)
>
{},
selPtrs
,
count
,
args
);
}
template
<
typename
...
PtrTypes
>
static
void
loadSelected
(
std
::
tuple
<
PtrTypes
...
>&
selPtrs
,
mwSize
count
,
Script
::
ArrayType
*
args
[])
{
loadSelected_impl
(
mph
::
make_index_sequence
<
sizeof
...(
PtrTypes
)
>
{},
selPtrs
,
count
,
args
);
}
};
};
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