Main MRPT website > C++ reference for MRPT 1.5.9
maps/src/maps/serializations_unittest.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-2017, 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 
11 #define MRPT_NO_WARN_BIG_HDR // Yes, we really want to include all classes.
12 #include <mrpt/maps.h>
13 
15 #include <gtest/gtest.h>
16 
17 using namespace mrpt;
18 using namespace mrpt::utils;
19 using namespace mrpt::maps;
20 using namespace mrpt::obs;
21 using namespace std;
22 
23 // Create a set of classes, then serialize and deserialize to test possible bugs:
24 TEST(SerializeTestMaps, WriteReadToMem)
25 {
27  CLASS_ID( CBeacon ),
39  };
40 
41  for (size_t i=0;i<sizeof(lstClasses)/sizeof(lstClasses[0]);i++)
42  {
43  try
44  {
45  CMemoryStream buf;
46  {
47  CSerializable* o = static_cast<CSerializable*>(lstClasses[i]->createObject());
48  buf << *o;
49  delete o;
50  }
51 
52  CSerializablePtr recons;
53  buf.Seek(0);
54  buf >> recons;
55  }
56  catch(std::exception &e)
57  {
58  GTEST_FAIL() <<
59  "Exception during serialization test for class '"<< lstClasses[i]->className <<"':\n" << e.what() << endl;
60  }
61  }
62 }
63 
Digital Elevation Model (DEM), a mesh or grid representation of a surface which keeps the estimated h...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:39
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
STL namespace.
const mrpt::utils::TRuntimeClassId * lstClasses[]
A 2D grid map representing the reflectivity of the environment (for example, measured with an IR prox...
CWirelessPowerGridMap2D represents a PDF of wifi concentrations over a 2D area.
mrpt::utils::CObject * createObject() const
Definition: CObject.cpp:88
This CStream derived class allow using a memory buffer as a CStream.
Definition: CMemoryStream.h:26
This namespace contains representation of robot actions and observations.
A class for storing a map of 3D probabilistic beacons, using a Montecarlo, Gaussian, or Sum of Gaussians (SOG) representation (for range-only SLAM).
A three-dimensional probabilistic occupancy grid, implemented as an octo-tree with the "octomap" C++ ...
Definition: maps/COctoMap.h:37
A map of 2D/3D points with individual colours (RGB).
#define CLASS_ID(class_name)
Access to runtime class ID for a defined class name.
Definition: CObject.h:82
A class for storing an occupancy grid map.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CRandomFieldGridMap3D represents a 3D regular grid where each voxel is associated one real-valued pro...
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
uint64_t Seek(int64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning) MRPT_OVERRIDE
Introduces a pure virtual method for moving to a specified position in the streamed resource...
CGasConcentrationGridMap2D represents a PDF of gas concentrations over a 2D area. ...
A structure that holds runtime class type information.
Definition: CObject.h:36
const char * className
Definition: CObject.h:38
TEST(SerializeTestMaps, WriteReadToMem)
The class for storing individual "beacon landmarks" under a variety of 3D position PDF distributions...
Definition: maps/CBeacon.h:40



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020