Point Cloud Library (PCL)  1.14.1-dev
tar.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2012, Willow Garage, Inc.
6  *
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  */
37 
38 #pragma once
39 
40 #include <pcl/point_cloud.h>
41 
42 namespace pcl
43 {
44  namespace io
45  {
46  /** \brief A TAR file's header, as described on
47  * https://en.wikipedia.org/wiki/Tar_%28file_format%29.
48  */
49  struct TARHeader
50  {
51  char file_name[100];
52  char file_mode[8];
53  char uid[8];
54  char gid[8];
55  char file_size[12];
56  char mtime[12];
57  char chksum[8];
58  char file_type[1];
59  char link_file_name[100];
60  char ustar[6];
61  char ustar_version[2];
62  char uname[32];
63  char gname[32];
64  char dev_major[8];
65  char dev_minor[8];
66  char file_name_prefix[155];
67  char _padding[12];
68 
69  /** \brief get file size */
70  unsigned int
72  {
73  unsigned int output = 0;
74  char *str = file_size;
75  for (int i = 0; i < 11; i++)
76  {
77  output = output * 8 + *str - '0';
78  str++;
79  }
80  return (output);
81  }
82  };
83 
84  /** \brief Save a PointCloud dataset into a TAR file.
85  * Append if the file exists, or create a new one if not.
86  * \remark till implemented will return FALSE
87  */
88  // param[in] tar_filename the name of the TAR file to save the cloud to
89  // param[in] cloud the point cloud dataset to save
90  // param[in] pcd_filename the internal name of the PCD file that should be stored in the TAR header
91  template <typename PointT> bool
92  saveTARPointCloud (const std::string& /*tar_filename*/,
93  const PointCloud<PointT>& /*cloud*/,
94  const std::string& /*pcd_filename*/)
95  {
96  return (false);
97  }
98  }
99 }
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: point_cloud.h:173
bool saveTARPointCloud(const std::string &, const PointCloud< PointT > &, const std::string &)
Save a PointCloud dataset into a TAR file.
Definition: tar.h:92
A TAR file's header, as described on https://en.wikipedia.org/wiki/Tar_%28file_format%29.
Definition: tar.h:50
char file_name_prefix[155]
Definition: tar.h:66
char link_file_name[100]
Definition: tar.h:59
char uname[32]
Definition: tar.h:62
char file_size[12]
Definition: tar.h:55
char file_name[100]
Definition: tar.h:51
unsigned int getFileSize()
get file size
Definition: tar.h:71
char file_mode[8]
Definition: tar.h:52
char gid[8]
Definition: tar.h:54
char ustar_version[2]
Definition: tar.h:61
char ustar[6]
Definition: tar.h:60
char mtime[12]
Definition: tar.h:56
char gname[32]
Definition: tar.h:63
char uid[8]
Definition: tar.h:53
char file_type[1]
Definition: tar.h:58
char chksum[8]
Definition: tar.h:57
char _padding[12]
Definition: tar.h:67
char dev_minor[8]
Definition: tar.h:65
char dev_major[8]
Definition: tar.h:64