Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
alta
alta
Commits
1ae1adb7
Commit
1ae1adb7
authored
May 26, 2015
by
Ludovic Courtès
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
params: Implement proper params::output value-to-name mapping.
parent
dbd140ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
6 deletions
+40
-6
sources/core/params.cpp
sources/core/params.cpp
+38
-1
sources/core/params.h
sources/core/params.h
+2
-5
No files found.
sources/core/params.cpp
View file @
1ae1adb7
/* ALTA --- Analysis of Bidirectional Reflectance Distribution Functions
Copyright (C) 2014 CNRS
Copyright (C) 2013, 2014 Inria
Copyright (C) 2013, 2014
, 2015
Inria
This file is part of ALTA.
...
...
@@ -81,6 +81,31 @@ static const std::map<params::input, const param_info> input_map = create_map();
//};
//#endif
static
std
::
map
<
params
::
output
,
std
::
string
>
create_output_map
()
{
std
::
map
<
params
::
output
,
std
::
string
>
result
;
#define STRINGIFY_(x) #x
#define STRINGIFY(x) STRINGIFY_(x)
#define DEFINE_MAPPING(name) \
result[params::name] = STRINGIFY(name);
DEFINE_MAPPING
(
INV_STERADIAN
);
DEFINE_MAPPING
(
INV_STERADIAN_COSINE_FACTOR
);
DEFINE_MAPPING
(
ENERGY
);
DEFINE_MAPPING
(
RGB_COLOR
);
DEFINE_MAPPING
(
XYZ_COLOR
);
#undef DEFINE_MAPPING
#undef STRINGIFY
#undef STRINGIFY_
return
result
;
}
static
const
std
::
map
<
params
::
output
,
std
::
string
>
output_map
=
create_output_map
();
void
params
::
to_cartesian
(
const
double
*
invec
,
params
::
input
intype
,
double
*
outvec
)
{
...
...
@@ -566,6 +591,18 @@ std::string params::get_name(const params::input param)
return
std
::
string
(
"UNKNOWN_INPUT"
);
}
std
::
string
params
::
get_name
(
const
params
::
output
param
)
{
std
::
map
<
params
::
output
,
std
::
string
>::
const_iterator
it
=
output_map
.
find
(
param
);
if
(
it
!=
output_map
.
end
())
{
return
it
->
second
;
}
static
const
std
::
string
unknown
=
"UNKNOWN_OUTPUT"
;
return
unknown
;
}
int
params
::
dimension
(
params
::
input
t
)
{
std
::
map
<
params
::
input
,
const
param_info
>::
const_iterator
it
=
input_map
.
find
(
t
);
...
...
sources/core/params.h
View file @
1ae1adb7
/* ALTA --- Analysis of Bidirectional Reflectance Distribution Functions
Copyright (C) 2014 CNRS
Copyright (C) 2013, 2014 Inria
Copyright (C) 2013, 2014
, 2015
Inria
This file is part of ALTA.
...
...
@@ -135,10 +135,7 @@ class params
//! type.
//! \todo Finish this implementation. It requires another static
//! object.
static
std
::
string
get_name
(
const
params
::
output
)
{
return
std
::
string
(
"UNKNOWN_OUTPUT"
);
}
static
std
::
string
get_name
(
const
params
::
output
);
//! \brief static function for input type convertion. This
//! function allocate the resulting vector.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment