Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenMesh
OpenMesh
Commits
d28df7ed
Commit
d28df7ed
authored
Sep 03, 2019
by
Jan Möbius
Browse files
PLY: convert readInteger into a template
parent
d91986fc
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
src/OpenMesh/Core/IO/reader/PLYReader.cc
View file @
d28df7ed
...
...
@@ -971,8 +971,10 @@ void _PLYReader_::readValue(ValueType _type, std::istream& _in, int& _value) con
//-----------------------------------------------------------------------------
template
<
typename
T
>
void
_PLYReader_
::
readInteger
(
ValueType
_type
,
std
::
istream
&
_in
,
T
&
_value
)
const
{
void
_PLYReader_
::
readInteger
(
ValueType
_type
,
std
::
istream
&
_in
,
int
&
_value
)
const
{
static_assert
(
std
::
is_integral
<
T
>::
value
,
"Integral required."
);
int32_t
tmp_int32_t
;
uint32_t
tmp_uint32_t
;
...
...
@@ -1020,71 +1022,12 @@ void _PLYReader_::readInteger(ValueType _type, std::istream& _in, int& _value) c
default:
_value
=
0
;
std
::
cerr
<<
"unsupported conversion type to int: "
<<
_type
<<
std
::
endl
;
break
;
}
}
//-----------------------------------------------------------------------------
void
_PLYReader_
::
readInteger
(
ValueType
_type
,
std
::
istream
&
_in
,
unsigned
int
&
_value
)
const
{
int32_t
tmp_int32_t
;
uint32_t
tmp_uint32_t
;
int8_t
tmp_char
;
uint8_t
tmp_uchar
;
switch
(
_type
)
{
case
ValueTypeUINT
:
case
ValueTypeUINT32
:
restore
(
_in
,
tmp_uint32_t
,
options_
.
check
(
Options
::
MSB
));
_value
=
tmp_uint32_t
;
break
;
case
ValueTypeINT
:
case
ValueTypeINT32
:
restore
(
_in
,
tmp_int32_t
,
options_
.
check
(
Options
::
MSB
));
_value
=
tmp_int32_t
;
break
;
case
ValueTypeUCHAR
:
case
ValueTypeUINT8
:
restore
(
_in
,
tmp_uchar
,
options_
.
check
(
Options
::
MSB
));
_value
=
tmp_uchar
;
break
;
case
ValueTypeCHAR
:
case
ValueTypeINT8
:
restore
(
_in
,
tmp_char
,
options_
.
check
(
Options
::
MSB
));
_value
=
tmp_char
;
break
;
default:
_value
=
0
;
std
::
cerr
<<
"unsupported conversion type to unsigned int: "
<<
_type
<<
std
::
endl
;
std
::
cerr
<<
"unsupported conversion type to integral: "
<<
_type
<<
std
::
endl
;
break
;
}
}
//------------------------------------------------------------------------------
...
...
src/OpenMesh/Core/IO/reader/PLYReader.cc.orig
0 → 100644
View file @
d28df7ed
This diff is collapsed.
Click to expand it.
src/OpenMesh/Core/IO/reader/PLYReader.hh
View file @
d28df7ed
...
...
@@ -139,8 +139,8 @@ private:
void
readValue
(
ValueType
_type
,
std
::
istream
&
_in
,
short
&
_value
)
const
;
void
readValue
(
ValueType
_type
,
std
::
istream
&
_in
,
signed
char
&
_value
)
const
;
void
readInteger
(
ValueType
_type
,
std
::
istream
&
_in
,
int
&
_value
)
const
;
void
readInteger
(
ValueType
_type
,
std
::
istream
&
_in
,
unsigned
int
&
_value
)
const
;
template
<
typename
T
>
void
readInteger
(
ValueType
_type
,
std
::
istream
&
_in
,
T
&
_value
)
const
;
/// Read unsupported properties in PLY file
void
consume_input
(
std
::
istream
&
_in
,
int
_count
)
const
{
...
...
@@ -223,7 +223,7 @@ private:
{
_in
>>
_value
;
}
//read and assign custom properties with the given type. Also creates property, if not exist
template
<
bool
binary
,
typename
T
,
typename
Handle
>
void
readCreateCustomProperty
(
std
::
istream
&
_in
,
BaseImporter
&
_bi
,
Handle
_h
,
const
std
::
string
&
_propName
,
const
ValueType
_valueType
,
const
ValueType
_listType
)
const
;
...
...
Write
Preview
Supports
Markdown
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