Main MRPT website > C++ reference for MRPT 1.9.9
CDynamicGrid.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "containers-precomp.h" // Precompiled headers
11 
13 #include <mrpt/core/format.h>
14 #include <fstream>
15 
17  const std::string& fileName) const
18 {
19  std::ofstream f;
20  f.open(fileName.c_str(), std::ofstream::out);
21  if (!f.is_open()) return false;
22  const unsigned int sy = getSizeY(), sx = getSizeX();
23  for (unsigned int cy = 0; cy < sy; cy++)
24  {
25  for (unsigned int cx = 0; cx < sx; cx++)
26  f << mrpt::format("%f ", getCellAsFloat(cx, cy));
27  f << "\n";
28  }
29  return true;
30 }
mrpt::containers::internal::dynamic_grid_txt_saver::getSizeX
virtual unsigned int getSizeX() const =0
mrpt::containers::internal::dynamic_grid_txt_saver::getCellAsFloat
virtual float getCellAsFloat(unsigned int cx, unsigned int cy) const =0
format.h
mrpt::containers::internal::dynamic_grid_txt_saver::getSizeY
virtual unsigned int getSizeY() const =0
CDynamicGrid.h
mrpt::format
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:16
mrpt::containers::internal::dynamic_grid_txt_saver::saveToTextFile
bool saveToTextFile(const std::string &fileName) const
Definition: CDynamicGrid.cpp:16
containers-precomp.h
string
GLsizei const GLchar ** string
Definition: glext.h:4101



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST