Point Cloud Library (PCL)
1.14.0
Loading...
Searching...
No Matches
pcl
io
ply
io_operators.h
Go to the documentation of this file.
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2007-2012, Ares Lagae
6
* Copyright (c) 2012, Willow Garage, Inc.
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* * Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* * Redistributions in binary form must reproduce the above
16
* copyright notice, this list of conditions and the following
17
* disclaimer in the documentation and/or other materials provided
18
* with the distribution.
19
* * Neither the name of the copyright holder(s) nor the names of its
20
* contributors may be used to endorse or promote products derived
21
* from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*
36
* $Id$
37
*
38
*/
39
40
#pragma once
41
42
#include <istream>
43
#include <limits>
44
#include <ostream>
45
46
namespace
pcl
47
{
48
namespace
io
49
{
50
namespace
ply
51
{
52
/** \file io_operators.h
53
* defines output operators for int8 and uint8
54
* \author Ares Lagae as part of libply, Nizar Sallem
55
* \ingroup io
56
*/
57
namespace
io_operators
58
{
59
60
inline
std::istream&
operator>>
(std::istream& istream,
int8
&value)
61
{
62
int16
tmp;
63
if
(istream >> tmp)
64
{
65
if
(tmp <= std::numeric_limits<int8>::max ())
66
value =
static_cast<
int8
>
(tmp);
67
else
68
istream.setstate (std::ios_base::failbit);
69
}
70
return
(istream);
71
}
72
73
inline
std::istream&
operator>>
(std::istream& istream,
uint8
&value)
74
{
75
uint16
tmp;
76
if
(istream >> tmp)
77
{
78
if
(tmp <= std::numeric_limits<uint8>::max ())
79
value =
static_cast<
uint8
>
(tmp);
80
else
81
istream.setstate (std::ios_base::failbit);
82
}
83
return
(istream);
84
}
85
86
inline
std::ostream&
operator<<
(std::ostream& ostream,
int8
value)
87
{
88
return
(ostream <<
static_cast<
int16
>
(value));
89
}
90
91
inline
std::ostream&
operator<<
(std::ostream& ostream,
uint8
value)
92
{
93
return
(ostream <<
static_cast<
uint16
>
(value));
94
}
95
96
}
// namespace io_operators
97
}
// namespace ply
98
}
// namespace io
99
}
// namespace pcl
pcl::io::ply::io_operators::operator>>
std::istream & operator>>(std::istream &istream, int8 &value)
Definition
io_operators.h:60
pcl::io::ply::io_operators::operator<<
std::ostream & operator<<(std::ostream &ostream, int8 value)
Definition
io_operators.h:86
pcl::io::ply::int16
std::int16_t int16
Definition
ply.h:59
pcl::io::ply::uint16
std::uint16_t uint16
Definition
ply.h:62
pcl::io::ply::uint8
std::uint8_t uint8
Definition
ply.h:61
pcl::io::ply::int8
std::int8_t int8
Definition
ply.h:58
pcl
Definition
convolution.h:46