Skip to content

Commit a2bedc9

Browse files
authored
Merge pull request #3250 from SergioRAgostinho/tuple
Transition from boost::tuple to std::tuple.
2 parents 72404e3 + a0c7010 commit a2bedc9

File tree

10 files changed

+90
-82
lines changed

10 files changed

+90
-82
lines changed

io/include/pcl/io/boost.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
#include <boost/numeric/conversion/cast.hpp>
4848
#include <boost/filesystem.hpp>
4949
#include <boost/cstdint.hpp>
50-
#include <boost/tuple/tuple.hpp>
5150
#include <boost/shared_ptr.hpp>
5251
#include <boost/weak_ptr.hpp>
5352
#include <boost/mpl/fold.hpp>

io/include/pcl/io/ply/ply_parser.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@
4040

4141
#pragma once
4242

43-
#include <fstream>
44-
#include <iostream>
45-
#include <istream>
46-
#include <memory>
47-
#include <sstream>
48-
#include <string>
49-
#include <vector>
50-
5143
#ifdef BUILD_Maintainer
5244
# if defined __GNUC__
5345
# pragma GCC system_header
@@ -57,11 +49,19 @@
5749
#endif
5850

5951
#include <pcl/io/boost.h>
60-
6152
#include <pcl/io/ply/ply.h>
6253
#include <pcl/io/ply/io_operators.h>
6354
#include <pcl/pcl_macros.h>
6455

56+
#include <fstream>
57+
#include <iostream>
58+
#include <istream>
59+
#include <memory>
60+
#include <sstream>
61+
#include <string>
62+
#include <tuple>
63+
#include <vector>
64+
6565
namespace pcl
6666
{
6767
namespace io
@@ -90,7 +90,7 @@ namespace pcl
9090

9191
using begin_element_callback_type = std::function<void ()>;
9292
using end_element_callback_type = std::function<void ()>;
93-
using element_callbacks_type = boost::tuple<begin_element_callback_type, end_element_callback_type>;
93+
using element_callbacks_type = std::tuple<begin_element_callback_type, end_element_callback_type>;
9494
using element_definition_callback_type = std::function<element_callbacks_type (const std::string&, std::size_t)>;
9595

9696
template <typename ScalarType>
@@ -191,7 +191,7 @@ namespace pcl
191191
using list_property_begin_callback_type = typename list_property_begin_callback_type<SizeType, ScalarType>::type;
192192
using list_property_element_callback_type = typename list_property_element_callback_type<SizeType, ScalarType>::type;
193193
using list_property_end_callback_type = typename list_property_end_callback_type<SizeType, ScalarType>::type;
194-
using type = std::function<boost::tuple<
194+
using type = std::function<std::tuple<
195195
list_property_begin_callback_type,
196196
list_property_element_callback_type,
197197
list_property_end_callback_type
@@ -515,12 +515,12 @@ inline void pcl::io::ply::ply_parser::parse_list_property_definition (const std:
515515
using list_property_begin_callback_type = typename list_property_begin_callback_type<size_type, scalar_type>::type;
516516
using list_property_element_callback_type = typename list_property_element_callback_type<size_type, scalar_type>::type;
517517
using list_property_end_callback_type = typename list_property_end_callback_type<size_type, scalar_type>::type;
518-
boost::tuple<list_property_begin_callback_type, list_property_element_callback_type, list_property_end_callback_type> list_property_callbacks;
518+
std::tuple<list_property_begin_callback_type, list_property_element_callback_type, list_property_end_callback_type> list_property_callbacks;
519519
if (list_property_definition_callback)
520520
{
521521
list_property_callbacks = list_property_definition_callback (current_element_->name, property_name);
522522
}
523-
if (!boost::get<0> (list_property_callbacks) || !boost::get<1> (list_property_callbacks) || !boost::get<2> (list_property_callbacks))
523+
if (!std::get<0> (list_property_callbacks) || !std::get<1> (list_property_callbacks) || !std::get<2> (list_property_callbacks))
524524
{
525525
if (warning_callback_)
526526
{
@@ -533,9 +533,9 @@ inline void pcl::io::ply::ply_parser::parse_list_property_definition (const std:
533533
}
534534
current_element_->properties.emplace_back (new list_property<size_type, scalar_type> (
535535
property_name,
536-
boost::get<0> (list_property_callbacks),
537-
boost::get<1> (list_property_callbacks),
538-
boost::get<2> (list_property_callbacks)));
536+
std::get<0> (list_property_callbacks),
537+
std::get<1> (list_property_callbacks),
538+
std::get<2> (list_property_callbacks)));
539539
}
540540

541541
template <typename ScalarType>

io/include/pcl/io/ply_io.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444
#include <pcl/io/file_io.h>
4545
#include <pcl/io/ply/ply_parser.h>
4646
#include <pcl/PolygonMesh.h>
47+
4748
#include <sstream>
49+
#include <tuple>
4850

4951
namespace pcl
5052
{
@@ -284,7 +286,7 @@ namespace pcl
284286
* \param[in] element_name element name
285287
* \param[in] count number of instances
286288
*/
287-
boost::tuple<std::function<void ()>, std::function<void ()> >
289+
std::tuple<std::function<void ()>, std::function<void ()> >
288290
elementDefinitionCallback (const std::string& element_name, std::size_t count);
289291

290292
bool
@@ -302,7 +304,7 @@ namespace pcl
302304
* \param[in] property_name list property name
303305
*/
304306
template <typename SizeType, typename ScalarType>
305-
boost::tuple<std::function<void (SizeType)>, std::function<void (ScalarType)>, std::function<void ()> >
307+
std::tuple<std::function<void (SizeType)>, std::function<void (ScalarType)>, std::function<void ()> >
306308
listPropertyDefinitionCallback (const std::string& element_name, const std::string& property_name);
307309

308310
/** \brief function called at the beginning of a list property parsing.

io/src/ply/ply_parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ bool pcl::io::ply::ply_parser::parse (const std::string& filename)
203203
{
204204
element_callbacks = element_definition_callbacks_ (name, count);
205205
}
206-
elements.emplace_back(new element (name, count, boost::get<0>(element_callbacks), boost::get<1>(element_callbacks)));
206+
elements.emplace_back(new element (name, count, std::get<0>(element_callbacks), std::get<1>(element_callbacks)));
207207
current_element_ = elements.back ().get ();
208208
}
209209

io/src/ply_io.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@
4747
#include <map>
4848
#include <sstream>
4949
#include <string>
50+
#include <tuple>
5051

5152
// https://www.boost.org/doc/libs/1_70_0/libs/filesystem/doc/index.htm#Coding-guidelines
5253
#define BOOST_FILESYSTEM_NO_DEPRECATED
5354
#include <boost/filesystem.hpp>
5455

5556
namespace fs = boost::filesystem;
5657

57-
boost::tuple<std::function<void ()>, std::function<void ()> >
58+
std::tuple<std::function<void ()>, std::function<void ()> >
5859
pcl::PLYReader::elementDefinitionCallback (const std::string& element_name, std::size_t count)
5960
{
6061
if (element_name == "vertex")
@@ -71,14 +72,14 @@ pcl::PLYReader::elementDefinitionCallback (const std::string& element_name, std:
7172
cloud_->point_step = 0;
7273
cloud_->row_step = 0;
7374
vertex_count_ = 0;
74-
return (boost::tuple<std::function<void ()>, std::function<void ()> > (
75+
return (std::tuple<std::function<void ()>, std::function<void ()> > (
7576
[this] { vertexBeginCallback (); },
7677
[this] { vertexEndCallback (); }));
7778
}
7879
if ((element_name == "face") && polygons_)
7980
{
8081
polygons_->reserve (count);
81-
return (boost::tuple<std::function<void ()>, std::function<void ()> > (
82+
return (std::tuple<std::function<void ()>, std::function<void ()> > (
8283
[this] { faceBeginCallback (); },
8384
[this] { faceEndCallback (); }));
8485
}
@@ -90,7 +91,7 @@ pcl::PLYReader::elementDefinitionCallback (const std::string& element_name, std:
9091
if (element_name == "range_grid")
9192
{
9293
range_grid_->reserve (count);
93-
return (boost::tuple<std::function<void ()>, std::function<void ()> > (
94+
return (std::tuple<std::function<void ()>, std::function<void ()> > (
9495
[this] { rangeGridBeginCallback (); },
9596
[this] { rangeGridEndCallback (); }));
9697
}
@@ -309,20 +310,20 @@ namespace pcl
309310
}
310311

311312
template <>
312-
boost::tuple<std::function<void (pcl::io::ply::uint8)>, std::function<void (pcl::io::ply::int32)>, std::function<void ()> >
313+
std::tuple<std::function<void (pcl::io::ply::uint8)>, std::function<void (pcl::io::ply::int32)>, std::function<void ()> >
313314
pcl::PLYReader::listPropertyDefinitionCallback (const std::string& element_name, const std::string& property_name)
314315
{
315316
if ((element_name == "range_grid") && (property_name == "vertex_indices" || property_name == "vertex_index"))
316317
{
317-
return boost::tuple<std::function<void (pcl::io::ply::uint8)>, std::function<void (pcl::io::ply::int32)>, std::function<void ()> > (
318+
return std::tuple<std::function<void (pcl::io::ply::uint8)>, std::function<void (pcl::io::ply::int32)>, std::function<void ()> > (
318319
[this] (pcl::io::ply::uint8 size) { rangeGridVertexIndicesBeginCallback (size); },
319320
[this] (pcl::io::ply::int32 vertex_index) { rangeGridVertexIndicesElementCallback (vertex_index); },
320321
[this] { rangeGridVertexIndicesEndCallback (); }
321322
);
322323
}
323324
if ((element_name == "face") && (property_name == "vertex_indices" || property_name == "vertex_index") && polygons_)
324325
{
325-
return boost::tuple<std::function<void (pcl::io::ply::uint8)>, std::function<void (pcl::io::ply::int32)>, std::function<void ()> > (
326+
return std::tuple<std::function<void (pcl::io::ply::uint8)>, std::function<void (pcl::io::ply::int32)>, std::function<void ()> > (
326327
[this] (pcl::io::ply::uint8 size) { faceVertexIndicesBeginCallback (size); },
327328
[this] (pcl::io::ply::int32 vertex_index) { faceVertexIndicesElementCallback (vertex_index); },
328329
[this] { faceVertexIndicesEndCallback (); }
@@ -341,7 +342,7 @@ namespace pcl
341342
else
342343
cloud_->point_step = static_cast<uint32_t> (std::numeric_limits<uint32_t>::max ());
343344
do_resize_ = true;
344-
return boost::tuple<std::function<void (pcl::io::ply::uint8)>, std::function<void (pcl::io::ply::int32)>, std::function<void ()> > (
345+
return std::tuple<std::function<void (pcl::io::ply::uint8)>, std::function<void (pcl::io::ply::int32)>, std::function<void ()> > (
345346
std::bind (&pcl::PLYReader::vertexListPropertyBeginCallback<pcl::io::ply::uint8>, this, property_name, std::placeholders::_1),
346347
[this] (pcl::io::ply::int32 value) { vertexListPropertyContentCallback<pcl::io::ply::int32> (value); },
347348
[this] { vertexListPropertyEndCallback (); }
@@ -351,7 +352,7 @@ namespace pcl
351352
}
352353

353354
template <typename SizeType, typename ContentType>
354-
boost::tuple<std::function<void (SizeType)>, std::function<void (ContentType)>, std::function<void ()> >
355+
std::tuple<std::function<void (SizeType)>, std::function<void (ContentType)>, std::function<void ()> >
355356
pcl::PLYReader::listPropertyDefinitionCallback (const std::string& element_name, const std::string& property_name)
356357
{
357358
if (element_name == "vertex")
@@ -367,7 +368,7 @@ namespace pcl
367368
else
368369
cloud_->point_step = static_cast<uint32_t> (std::numeric_limits<uint32_t>::max ());
369370
do_resize_ = true;
370-
return boost::tuple<std::function<void (SizeType)>, std::function<void (ContentType)>, std::function<void ()> > (
371+
return std::tuple<std::function<void (SizeType)>, std::function<void (ContentType)>, std::function<void ()> > (
371372
std::bind (&pcl::PLYReader::vertexListPropertyBeginCallback<SizeType>, this, property_name, std::placeholders::_1),
372373
[this] (ContentType value) { vertexListPropertyContentCallback (value); },
373374
[this] { vertexListPropertyEndCallback (); }

io/tools/ply/ply2obj.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@
3838
*
3939
*/
4040

41+
#include <pcl/io/boost.h>
42+
#include <pcl/io/ply/ply_parser.h>
43+
4144
#include <cstdlib>
4245
#include <cstring>
4346
#include <fstream>
4447
#include <iostream>
45-
46-
#include <pcl/io/boost.h>
47-
#include <pcl/io/ply/ply_parser.h>
48+
#include <tuple>
4849

4950
/** \class ply_to_obj_converter
5051
* Convert a PLY file, optionally meshed to an OBJ file.
@@ -81,13 +82,13 @@ class ply_to_obj_converter
8182
void
8283
error_callback (const std::string& filename, std::size_t line_number, const std::string& message);
8384

84-
boost::tuple<std::function<void ()>, std::function<void ()> >
85+
std::tuple<std::function<void ()>, std::function<void ()> >
8586
element_definition_callback (const std::string& element_name, std::size_t count);
8687

8788
template <typename ScalarType> std::function<void (ScalarType)>
8889
scalar_property_definition_callback (const std::string& element_name, const std::string& property_name);
8990

90-
template <typename SizeType, typename ScalarType> boost::tuple<std::function<void (SizeType)>,
91+
template <typename SizeType, typename ScalarType> std::tuple<std::function<void (SizeType)>,
9192
std::function<void (ScalarType)>,
9293
std::function<void ()> >
9394
list_property_definition_callback (const std::string& element_name, const std::string& property_name);
@@ -155,19 +156,19 @@ ply_to_obj_converter::error_callback (const std::string& filename, std::size_t l
155156
std::cerr << filename << ":" << line_number << ": " << "error: " << message << std::endl;
156157
}
157158

158-
boost::tuple<std::function<void ()>, std::function<void ()> >
159+
std::tuple<std::function<void ()>, std::function<void ()> >
159160
ply_to_obj_converter::element_definition_callback (const std::string& element_name, std::size_t)
160161
{
161162
if (element_name == "vertex")
162163
{
163-
return boost::tuple<std::function<void ()>, std::function<void ()> > (
164+
return std::tuple<std::function<void ()>, std::function<void ()> > (
164165
[this] { vertex_begin (); },
165166
[this] { vertex_end (); }
166167
);
167168
}
168169
if (element_name == "face")
169170
{
170-
return boost::tuple<std::function<void ()>, std::function<void ()> > (
171+
return std::tuple<std::function<void ()>, std::function<void ()> > (
171172
[this] { face_begin (); },
172173
[this] { face_end (); }
173174
);
@@ -192,11 +193,11 @@ ply_to_obj_converter::scalar_property_definition_callback (const std::string& el
192193
return {};
193194
}
194195

195-
template <> boost::tuple<std::function<void (pcl::io::ply::uint8)>, std::function<void (pcl::io::ply::int32)>, std::function<void ()> >
196+
template <> std::tuple<std::function<void (pcl::io::ply::uint8)>, std::function<void (pcl::io::ply::int32)>, std::function<void ()> >
196197
ply_to_obj_converter::list_property_definition_callback (const std::string& element_name, const std::string& property_name)
197198
{
198199
if ((element_name == "face") && (property_name == "vertex_indices")) {
199-
return boost::tuple<std::function<void (pcl::io::ply::uint8)>, std::function<void (pcl::io::ply::int32)>, std::function<void ()> > (
200+
return std::tuple<std::function<void (pcl::io::ply::uint8)>, std::function<void (pcl::io::ply::int32)>, std::function<void ()> > (
200201
[this] (pcl::io::ply::uint8 p){ face_vertex_indices_begin (p); },
201202
[this] (pcl::io::ply::int32 vertex_index) { face_vertex_indices_element (vertex_index); },
202203
[this] { face_vertex_indices_end (); }

io/tools/ply/ply2ply.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@
3737
*
3838
*/
3939

40+
#include <pcl/io/boost.h>
41+
#include <pcl/io/ply/ply_parser.h>
42+
4043
#include <cstdlib>
4144
#include <cstring>
4245
#include <fstream>
4346
#include <iostream>
44-
45-
#include <pcl/io/boost.h>
46-
#include <pcl/io/ply/ply_parser.h>
47+
#include <tuple>
4748

4849
/** \class ply_to_ply_converter
4950
* Converts a PLY file with format FORMAT_IN to PLY file with format FORMAT_OUT.
@@ -95,7 +96,7 @@ class ply_to_ply_converter
9596
void
9697
element_end_callback();
9798

98-
boost::tuple<std::function<void()>, std::function<void()> >
99+
std::tuple<std::function<void()>, std::function<void()> >
99100
element_definition_callback(const std::string& element_name, std::size_t count);
100101

101102
template <typename ScalarType> void
@@ -113,7 +114,7 @@ class ply_to_ply_converter
113114
template <typename SizeType, typename ScalarType> void
114115
list_property_end_callback();
115116

116-
template <typename SizeType, typename ScalarType> boost::tuple<std::function<void (SizeType)>,
117+
template <typename SizeType, typename ScalarType> std::tuple<std::function<void (SizeType)>,
117118
std::function<void (ScalarType)>,
118119
std::function<void ()> >
119120
list_property_definition_callback(const std::string& element_name, const std::string& property_name);
@@ -211,10 +212,10 @@ ply_to_ply_converter::element_end_callback()
211212
}
212213
}
213214

214-
boost::tuple<std::function<void()>, std::function<void()> > ply_to_ply_converter::element_definition_callback(const std::string& element_name, std::size_t count)
215+
std::tuple<std::function<void()>, std::function<void()> > ply_to_ply_converter::element_definition_callback(const std::string& element_name, std::size_t count)
215216
{
216217
(*ostream_) << "element " << element_name << " " << count << "\n";
217-
return boost::tuple<std::function<void()>, std::function<void()> >(
218+
return std::tuple<std::function<void()>, std::function<void()> >(
218219
[this] { element_begin_callback (); },
219220
[this] { element_end_callback (); }
220221
);
@@ -300,13 +301,13 @@ template <typename SizeType, typename ScalarType> void
300301
ply_to_ply_converter::list_property_end_callback() {}
301302

302303
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
303-
template <typename SizeType, typename ScalarType> boost::tuple<std::function<void (SizeType)>,
304+
template <typename SizeType, typename ScalarType> std::tuple<std::function<void (SizeType)>,
304305
std::function<void (ScalarType)>,
305306
std::function<void ()> >
306307
ply_to_ply_converter::list_property_definition_callback (const std::string&, const std::string& property_name)
307308
{
308309
(*ostream_) << "property list " << pcl::io::ply::type_traits<SizeType>::old_name() << " " << pcl::io::ply::type_traits<ScalarType>::old_name() << " " << property_name << "\n";
309-
return boost::tuple<std::function<void (SizeType)>, std::function<void (ScalarType)>, std::function<void ()> >(
310+
return std::tuple<std::function<void (SizeType)>, std::function<void (ScalarType)>, std::function<void ()> >(
310311
[this] (SizeType size) { list_property_begin_callback<SizeType, ScalarType> (size); },
311312
[this] (ScalarType scalar) { list_property_element_callback<SizeType, ScalarType> (scalar); },
312313
[this] { list_property_end_callback<SizeType, ScalarType> (); }

0 commit comments

Comments
 (0)