classutil_1_1FileIO.tex 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. \hypertarget{classutil_1_1FileIO}{}\section{util\+:\+:File\+IO Class Reference}
  2. \label{classutil_1_1FileIO}\index{util\+::\+File\+IO@{util\+::\+File\+IO}}
  3. {\ttfamily \#include $<$File\+I\+O.\+h$>$}
  4. \subsection*{Static Public Member Functions}
  5. \begin{DoxyCompactItemize}
  6. \item
  7. static void \hyperlink{classutil_1_1FileIO_ae31b9e693316483eda89df8463ea0d0a}{Read\+C\+SV} (Vector3d \&values, const std\+::string \&file\+\_\+name, char delimiter)
  8. \item
  9. static void \hyperlink{classutil_1_1FileIO_a49f014af1e0f03d290f00049e082d9c6}{Read\+C\+SV} (Vector2d \&values, const std\+::string \&file\+\_\+name, char delimiter)
  10. \item
  11. static void \hyperlink{classutil_1_1FileIO_a6e290e22083d49619b757bfca96a51fa}{List\+Files} (const std\+::string \&folder, std\+::vector$<$ std\+::string $>$ \&file\+\_\+names, bool sort=true)
  12. \item
  13. static void \hyperlink{classutil_1_1FileIO_a5f2730a95e0801faa32e49dae9b86544}{Write\+C\+S\+V\+Matlab} (Directed\+Graph \&graph, const std\+::string \&file\+\_\+name)
  14. \item
  15. static void \hyperlink{classutil_1_1FileIO_a2833554dcdf4a04f9fe67a324b5815ff}{Write\+C\+S\+V\+Matlab} (Multi\+Predecessor\+Map \&map, Vertex \&source, Vertex \&sink, const std\+::string \&file\+\_\+name)
  16. \item
  17. static void \hyperlink{classutil_1_1FileIO_a642616eb6f07c71bd8dcb1585a532d92}{Read\+C\+SV} (Value\+Map\+Vector \&values, const std\+::string \&file\+\_\+name, char delimiter)
  18. \item
  19. static void \hyperlink{classutil_1_1FileIO_a59b96733490d7b60e4f107da84efb245}{Read\+C\+SV} (Value\+Map\+Vector \&values, const std\+::string \&header, const std\+::string \&file\+\_\+name, char delimiter)
  20. \item
  21. static void {\bfseries Write\+Tracks} (std\+::vector$<$ core\+::\+Tracklet\+Ptr $>$ \&tracks, const std\+::string \&file\+\_\+name, char delimiter)\hypertarget{classutil_1_1FileIO_a57059c9b52e86c753db5da6281cf23c6}{}\label{classutil_1_1FileIO_a57059c9b52e86c753db5da6281cf23c6}
  22. \item
  23. static void {\bfseries Read\+Tracks} (std\+::vector$<$ core\+::\+Tracklet\+Ptr $>$ \&tracks, const std\+::string \&file\+\_\+name, char delimiter)\hypertarget{classutil_1_1FileIO_aa6294f669bdb86510c8b6cefed9ac44b}{}\label{classutil_1_1FileIO_aa6294f669bdb86510c8b6cefed9ac44b}
  24. \item
  25. static std\+::vector$<$ std\+::string $>$ {\bfseries split} (const std\+::string \&input, char delimiter)\hypertarget{classutil_1_1FileIO_aa79e018874aa1da4d0b2cd1e5b7d2e01}{}\label{classutil_1_1FileIO_aa79e018874aa1da4d0b2cd1e5b7d2e01}
  26. \end{DoxyCompactItemize}
  27. \subsection{Detailed Description}
  28. Utility class for file in-\/ and output.
  29. \subsection{Member Function Documentation}
  30. \index{util\+::\+File\+IO@{util\+::\+File\+IO}!List\+Files@{List\+Files}}
  31. \index{List\+Files@{List\+Files}!util\+::\+File\+IO@{util\+::\+File\+IO}}
  32. \subsubsection[{\texorpdfstring{List\+Files(const std\+::string \&folder, std\+::vector$<$ std\+::string $>$ \&file\+\_\+names, bool sort=true)}{ListFiles(const std::string &folder, std::vector< std::string > &file_names, bool sort=true)}}]{\setlength{\rightskip}{0pt plus 5cm}void util\+::\+File\+I\+O\+::\+List\+Files (
  33. \begin{DoxyParamCaption}
  34. \item[{const std\+::string \&}]{folder, }
  35. \item[{std\+::vector$<$ std\+::string $>$ \&}]{file\+\_\+names, }
  36. \item[{bool}]{sort = {\ttfamily true}}
  37. \end{DoxyParamCaption}
  38. )\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{classutil_1_1FileIO_a6e290e22083d49619b757bfca96a51fa}{}\label{classutil_1_1FileIO_a6e290e22083d49619b757bfca96a51fa}
  39. Lists all file names in the given folder.
  40. \begin{DoxyParams}{Parameters}
  41. {\em folder} & The folder to look into \\
  42. \hline
  43. {\em file\+\_\+names} & The name of the files in the folder \\
  44. \hline
  45. {\em sort} & True, if the files should be sorted alphabetically \\
  46. \hline
  47. \end{DoxyParams}
  48. \index{util\+::\+File\+IO@{util\+::\+File\+IO}!Read\+C\+SV@{Read\+C\+SV}}
  49. \index{Read\+C\+SV@{Read\+C\+SV}!util\+::\+File\+IO@{util\+::\+File\+IO}}
  50. \subsubsection[{\texorpdfstring{Read\+C\+S\+V(\+Vector3d \&values, const std\+::string \&file\+\_\+name, char delimiter)}{ReadCSV(Vector3d &values, const std::string &file_name, char delimiter)}}]{\setlength{\rightskip}{0pt plus 5cm}void util\+::\+File\+I\+O\+::\+Read\+C\+SV (
  51. \begin{DoxyParamCaption}
  52. \item[{Vector3d \&}]{values, }
  53. \item[{const std\+::string \&}]{file\+\_\+name, }
  54. \item[{char}]{delimiter}
  55. \end{DoxyParamCaption}
  56. )\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{classutil_1_1FileIO_ae31b9e693316483eda89df8463ea0d0a}{}\label{classutil_1_1FileIO_ae31b9e693316483eda89df8463ea0d0a}
  57. Reads a C\+SV file and stores the values in a 3D array. The first dimension is the first value of each row, used as a index to bundle multiple rows with the same first value into a single vector. The second dimension is the row in the row bundle. The third dimension is the value in that row.
  58. \begin{DoxyParams}{Parameters}
  59. {\em values} & The 3D array of values to store the read values in \\
  60. \hline
  61. {\em file\+\_\+name} & The name of the file to read \\
  62. \hline
  63. {\em delimiter} & The value delimiter of the file \\
  64. \hline
  65. \end{DoxyParams}
  66. \index{util\+::\+File\+IO@{util\+::\+File\+IO}!Read\+C\+SV@{Read\+C\+SV}}
  67. \index{Read\+C\+SV@{Read\+C\+SV}!util\+::\+File\+IO@{util\+::\+File\+IO}}
  68. \subsubsection[{\texorpdfstring{Read\+C\+S\+V(\+Vector2d \&values, const std\+::string \&file\+\_\+name, char delimiter)}{ReadCSV(Vector2d &values, const std::string &file_name, char delimiter)}}]{\setlength{\rightskip}{0pt plus 5cm}void util\+::\+File\+I\+O\+::\+Read\+C\+SV (
  69. \begin{DoxyParamCaption}
  70. \item[{Vector2d \&}]{values, }
  71. \item[{const std\+::string \&}]{file\+\_\+name, }
  72. \item[{char}]{delimiter}
  73. \end{DoxyParamCaption}
  74. )\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{classutil_1_1FileIO_a49f014af1e0f03d290f00049e082d9c6}{}\label{classutil_1_1FileIO_a49f014af1e0f03d290f00049e082d9c6}
  75. Reads a C\+SV file and stores the values in a 2D array. The first dimension is the row and the second the value in that row.
  76. \begin{DoxyParams}{Parameters}
  77. {\em values} & The 2D array of values to store the read values in \\
  78. \hline
  79. {\em file\+\_\+name} & The name of the file to read \\
  80. \hline
  81. {\em delimiter} & The value delimiter of the file \\
  82. \hline
  83. \end{DoxyParams}
  84. \index{util\+::\+File\+IO@{util\+::\+File\+IO}!Read\+C\+SV@{Read\+C\+SV}}
  85. \index{Read\+C\+SV@{Read\+C\+SV}!util\+::\+File\+IO@{util\+::\+File\+IO}}
  86. \subsubsection[{\texorpdfstring{Read\+C\+S\+V(\+Value\+Map\+Vector \&values, const std\+::string \&file\+\_\+name, char delimiter)}{ReadCSV(ValueMapVector &values, const std::string &file_name, char delimiter)}}]{\setlength{\rightskip}{0pt plus 5cm}void util\+::\+File\+I\+O\+::\+Read\+C\+SV (
  87. \begin{DoxyParamCaption}
  88. \item[{Value\+Map\+Vector \&}]{values, }
  89. \item[{const std\+::string \&}]{file\+\_\+name, }
  90. \item[{char}]{delimiter}
  91. \end{DoxyParamCaption}
  92. )\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{classutil_1_1FileIO_a642616eb6f07c71bd8dcb1585a532d92}{}\label{classutil_1_1FileIO_a642616eb6f07c71bd8dcb1585a532d92}
  93. Reads a C\+SV file. The first line of the C\+SV file is a header specifying the keys. The values are stored with their specified key into one map per line.
  94. \begin{DoxyParams}{Parameters}
  95. {\em values} & A vector of maps to store the key-\/value pairs into \\
  96. \hline
  97. {\em file\+\_\+name} & The name of the file to read \\
  98. \hline
  99. {\em delimiter} & The value delimiter of the file \\
  100. \hline
  101. \end{DoxyParams}
  102. \index{util\+::\+File\+IO@{util\+::\+File\+IO}!Read\+C\+SV@{Read\+C\+SV}}
  103. \index{Read\+C\+SV@{Read\+C\+SV}!util\+::\+File\+IO@{util\+::\+File\+IO}}
  104. \subsubsection[{\texorpdfstring{Read\+C\+S\+V(\+Value\+Map\+Vector \&values, const std\+::string \&header, const std\+::string \&file\+\_\+name, char delimiter)}{ReadCSV(ValueMapVector &values, const std::string &header, const std::string &file_name, char delimiter)}}]{\setlength{\rightskip}{0pt plus 5cm}void util\+::\+File\+I\+O\+::\+Read\+C\+SV (
  105. \begin{DoxyParamCaption}
  106. \item[{Value\+Map\+Vector \&}]{values, }
  107. \item[{const std\+::string \&}]{header, }
  108. \item[{const std\+::string \&}]{file\+\_\+name, }
  109. \item[{char}]{delimiter}
  110. \end{DoxyParamCaption}
  111. )\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{classutil_1_1FileIO_a59b96733490d7b60e4f107da84efb245}{}\label{classutil_1_1FileIO_a59b96733490d7b60e4f107da84efb245}
  112. Reads a C\+SV file. The header specifies the keys. The values are stored with their specified key into one map per line.
  113. \begin{DoxyParams}{Parameters}
  114. {\em values} & A vector of maps to store the key-\/value pairs into \\
  115. \hline
  116. {\em header} & A string containing the keys separated by the delimiter \\
  117. \hline
  118. {\em file\+\_\+name} & The name of the file to read \\
  119. \hline
  120. {\em delimiter} & The value delimiter of the file \\
  121. \hline
  122. \end{DoxyParams}
  123. \index{util\+::\+File\+IO@{util\+::\+File\+IO}!Write\+C\+S\+V\+Matlab@{Write\+C\+S\+V\+Matlab}}
  124. \index{Write\+C\+S\+V\+Matlab@{Write\+C\+S\+V\+Matlab}!util\+::\+File\+IO@{util\+::\+File\+IO}}
  125. \subsubsection[{\texorpdfstring{Write\+C\+S\+V\+Matlab(\+Directed\+Graph \&graph, const std\+::string \&file\+\_\+name)}{WriteCSVMatlab(DirectedGraph &graph, const std::string &file_name)}}]{\setlength{\rightskip}{0pt plus 5cm}void util\+::\+File\+I\+O\+::\+Write\+C\+S\+V\+Matlab (
  126. \begin{DoxyParamCaption}
  127. \item[{Directed\+Graph \&}]{graph, }
  128. \item[{const std\+::string \&}]{file\+\_\+name}
  129. \end{DoxyParamCaption}
  130. )\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{classutil_1_1FileIO_a5f2730a95e0801faa32e49dae9b86544}{}\label{classutil_1_1FileIO_a5f2730a95e0801faa32e49dae9b86544}
  131. Writes the specified graph into a C\+SV file with an format readable by Matlab.
  132. \begin{DoxyParams}{Parameters}
  133. {\em graph} & The graph to write \\
  134. \hline
  135. {\em file\+\_\+name} & The name of the file to write \\
  136. \hline
  137. \end{DoxyParams}
  138. \index{util\+::\+File\+IO@{util\+::\+File\+IO}!Write\+C\+S\+V\+Matlab@{Write\+C\+S\+V\+Matlab}}
  139. \index{Write\+C\+S\+V\+Matlab@{Write\+C\+S\+V\+Matlab}!util\+::\+File\+IO@{util\+::\+File\+IO}}
  140. \subsubsection[{\texorpdfstring{Write\+C\+S\+V\+Matlab(\+Multi\+Predecessor\+Map \&map, Vertex \&source, Vertex \&sink, const std\+::string \&file\+\_\+name)}{WriteCSVMatlab(MultiPredecessorMap &map, Vertex &source, Vertex &sink, const std::string &file_name)}}]{\setlength{\rightskip}{0pt plus 5cm}void util\+::\+File\+I\+O\+::\+Write\+C\+S\+V\+Matlab (
  141. \begin{DoxyParamCaption}
  142. \item[{Multi\+Predecessor\+Map \&}]{map, }
  143. \item[{Vertex \&}]{source, }
  144. \item[{Vertex \&}]{sink, }
  145. \item[{const std\+::string \&}]{file\+\_\+name}
  146. \end{DoxyParamCaption}
  147. )\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{classutil_1_1FileIO_a2833554dcdf4a04f9fe67a324b5815ff}{}\label{classutil_1_1FileIO_a2833554dcdf4a04f9fe67a324b5815ff}
  148. Writes the specified multi predecessor map into a C\+SV format readable by Matlab to display all paths in the corresponding graph.
  149. \begin{DoxyParams}{Parameters}
  150. {\em map} & The multi predecessor map to extract the paths from \\
  151. \hline
  152. {\em source} & The sink, this is the vertex where all paths begin \\
  153. \hline
  154. {\em sink} & The sink, this is the vertex where all paths end \\
  155. \hline
  156. {\em file\+\_\+name} & The name of the file to write \\
  157. \hline
  158. \end{DoxyParams}
  159. The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
  160. \item
  161. util/File\+I\+O.\+h\item
  162. util/File\+I\+O.\+cpp\end{DoxyCompactItemize}