Go to the documentation of this file.00001
00008 #ifndef UOSIO_H_
00009 #define UOSIO_H_
00010
00011 #include <string>
00012 #include <iomanip>
00013 #include <iostream>
00014 #include <cmath>
00015 #include <fstream>
00016
00017 using std::string;
00018 using std::fstream;
00019
00020 namespace lssr
00021 {
00033 template<typename T>
00034 class UosIO
00035 {
00036 public:
00037
00041 UosIO() : m_firstScan(-1), m_lastScan(-1) {}
00042
00050 T** read(string dir, size_t &n);
00051
00056 void setFirstScan(int n) { m_firstScan = n;}
00057
00062 void setLastScan(int n) {m_lastScan = n;}
00063
00064 private:
00065
00073 T** readNewFormat(string dir, int first, int last, size_t &n);
00074
00082 T** readOldFormat(string dir, int first, int last, size_t &n);
00083
00091 Matrix4<float> parseFrameFile(ifstream& frameFile);
00092
00093 inline std::string to_string(const T& t, int width)
00094 {
00095 stringstream ss;
00096 ss << std::setfill('0') << std::setw(width) << t;
00097 return ss.str();
00098 }
00099
00100 inline std::string to_string(const T& t)
00101 {
00102 stringstream ss;
00103 ss << t;
00104 return ss.str();
00105 }
00106
00116 inline T rad(const T deg)
00117 {
00118 return ( (2 * M_PI * deg) / 360 );
00119 }
00120
00127 inline T deg(const T rad)
00128 {
00129 return ( (rad * 360) / (2 * M_PI) );
00130 }
00131
00132
00134 int m_firstScan;
00135
00137 int m_lastScan;
00138 };
00139
00140 }
00141
00142 #include "UosIO.tcc"
00143
00144 #endif