LineReader.hpp
Go to the documentation of this file.
1 
28 /*
29  * LineReader.hpp
30  *
31  * Created on: Aug 15, 2017
32  * Author: Isaak Mitschke
33  */
34 
35 #ifndef LAS_VEGAS_LINEREADER_HPP
36 #define LAS_VEGAS_LINEREADER_HPP
37 
38 #include "DataStruct.hpp"
39 
40 #include <boost/shared_array.hpp>
41 #include <exception>
42 #include <string>
43 
44 namespace lvr2
45 {
46 
48 {
49  XYZ,
53 };
54 
56 {
57  std::string m_filePath;
58  size_t m_filePos;
62  bool m_ply;
63  bool m_binary;
65 };
66 
67 struct __attribute__((packed)) xyz
68 {
69  lvr2::coord<float> point;
70 };
71 
72 struct __attribute__((packed)) xyzn : xyz
73 {
74  lvr2::coord<float> normal;
75 };
76 
77 struct __attribute__((packed)) xyznc : xyzn
78 {
80 };
81 struct __attribute__((packed)) xyzc : xyz
82 {
84 };
85 
86 
88 {
89 public:
90  LineReader();
91  LineReader(std::string filePath);
92  LineReader(std::vector<std::string> filePaths);
93  void open(std::string filePath);
94  void open(std::vector<std::string> filePaths);
95  size_t getNumPoints();
96  bool getNextPoint(xyznc &point);
97  // boost::shared_array<xyzn> getNextPoints(size_t &return_amount, size_t amount =
98  // 1000000); boost::shared_array<xyzc> getNextPoints(size_t &return_amount, size_t amount
99  // = 1000000); boost::shared_array<xyznc> getNextPoints(size_t &return_amount, size_t
100  // amount = 1000000);
101  boost::shared_ptr<void> getNextPoints(size_t &return_amount, size_t amount = 1000000);
102  fileType getFileType(size_t i);
104  void rewind(size_t i);
105  void rewind();
106  bool ok();
107  bool isPly() { return m_ply; }
108 
109  class readException : public std::exception
110  {
111  public:
112  readException(std::string what) : error_msg(what) {}
113  virtual const char *what() const throw() { return error_msg.c_str(); }
114 
115  private:
116  std::string error_msg;
117  };
118 
119 private:
120  std::vector<std::string> m_filePaths;
121  std::vector<size_t> m_filePos;
125  bool m_ply;
126  bool m_binary;
128  size_t m_numFiles;
131  std::vector<fileAttribut> m_fileAttributes;
132 };
133 
134 } // namespace lvr2
135 
136 #endif // LAS_VEGAS_LINEREADER_H
lvr2::LineReader::readException
Definition: LineReader.hpp:109
lvr2::fileAttribut::m_PointBlockSize
size_t m_PointBlockSize
Definition: LineReader.hpp:61
lvr2::LineReader::m_filePos
std::vector< size_t > m_filePos
Definition: LineReader.hpp:121
lvr2::coord
Definition: DataStruct.hpp:55
lvr2::LineReader::isPly
bool isPly()
Definition: LineReader.hpp:107
lvr2::LineReader::m_line_element_amount
size_t m_line_element_amount
Definition: LineReader.hpp:127
lvr2::XYZNRGB
@ XYZNRGB
Definition: LineReader.hpp:52
lvr2::LineReader
Definition: LineReader.hpp:87
lvr2::LineReader::m_elementAmount
size_t m_elementAmount
Definition: LineReader.hpp:122
lvr2::XYZN
@ XYZN
Definition: LineReader.hpp:51
lvr2::fileAttribut::m_elementAmount
size_t m_elementAmount
Definition: LineReader.hpp:59
lvr2::fileAttribut::m_filePath
std::string m_filePath
Definition: LineReader.hpp:57
lvr2::LineReader::open
void open(std::string filePath)
Definition: LineReader.cpp:235
lvr2::color
Definition: DataStruct.hpp:81
lvr2::LineReader::getNextPoints
boost::shared_ptr< void > getNextPoints(size_t &return_amount, size_t amount=1000000)
Definition: LineReader.cpp:258
lvr2::fileAttribut::m_ply
bool m_ply
Definition: LineReader.hpp:62
lvr2::fileAttribut::m_fileType
fileType m_fileType
Definition: LineReader.hpp:60
lvr2::LineReader::readException::what
virtual const char * what() const
Definition: LineReader.hpp:113
lvr2::LineReader::m_currentReadFile
size_t m_currentReadFile
Definition: LineReader.hpp:129
lvr2::LineReader::m_ply
bool m_ply
Definition: LineReader.hpp:125
lvr2::LineReader::rewind
void rewind()
Definition: LineReader.cpp:504
lvr2::LineReader::m_filePaths
std::vector< std::string > m_filePaths
Definition: LineReader.hpp:120
lvr2::__attribute__
struct __attribute__((packed)) xyz
Definition: LineReader.hpp:67
lvr2::LineReader::m_PointBlockSize
size_t m_PointBlockSize
Definition: LineReader.hpp:124
lvr2::LineReader::m_fileType
fileType m_fileType
Definition: LineReader.hpp:123
lvr2::LineReader::m_numFiles
size_t m_numFiles
Definition: LineReader.hpp:128
lvr2::XYZRGB
@ XYZRGB
Definition: LineReader.hpp:50
lvr2::LineReader::readException::readException
readException(std::string what)
Definition: LineReader.hpp:112
lvr2::LineReader::ok
bool ok()
Definition: LineReader.cpp:256
lvr2::fileAttribut::m_filePos
size_t m_filePos
Definition: LineReader.hpp:58
DataStruct.hpp
Datastructures for holding loaded data.
lvr2::LineReader::m_binary
bool m_binary
Definition: LineReader.hpp:126
lvr2::LineReader::getNextPoint
bool getNextPoint(xyznc &point)
lvr2::LineReader::m_openNextFile
bool m_openNextFile
Definition: LineReader.hpp:130
lvr2::LineReader::getFileType
fileType getFileType()
Definition: LineReader.cpp:254
lvr2::LineReader::m_fileAttributes
std::vector< fileAttribut > m_fileAttributes
Definition: LineReader.hpp:131
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::LineReader::LineReader
LineReader()
Definition: LineReader.cpp:49
lvr2::LineReader::readException::error_msg
std::string error_msg
Definition: LineReader.hpp:116
lvr2::fileAttribut::m_line_element_amount
size_t m_line_element_amount
Definition: LineReader.hpp:64
lvr2::fileAttribut::m_binary
bool m_binary
Definition: LineReader.hpp:63
lvr2::XYZ
@ XYZ
Definition: LineReader.hpp:49
lvr2::fileType
fileType
Definition: LineReader.hpp:47
lvr2::LineReader::getNumPoints
size_t getNumPoints()
Definition: LineReader.cpp:63
lvr2::fileAttribut
Definition: LineReader.hpp:55


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:24