Main MRPT website > C++ reference for MRPT 1.9.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 #define MRPT_NO_WARN_BIG_HDR // Yes, we really want to include all classes.
11 #include <mrpt/maps.h>
12 
14 #include <gtest/gtest.h>
15 #include <mrpt/utils/CTraitsTest.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 #define TEST_CLASS_MOVE_COPY_CTORS(_classname) \
24  template class mrpt::utils::CTraitsTest<_classname>
25 
37 
38 MRPT_TODO("liboctomap doesn't work nice with move ctors...");
39 // TEST_CLASS_MOVE_COPY_CTORS(COctoMap);
40 // TEST_CLASS_MOVE_COPY_CTORS(CColouredOctoMap);
41 
42 // Create a set of classes, then serialize and deserialize to test possible
43 // bugs:
44 TEST(SerializeTestMaps, WriteReadToMem)
45 {
60 
61  for (size_t i = 0; i < sizeof(lstClasses) / sizeof(lstClasses[0]); i++)
62  {
63  try
64  {
65  CMemoryStream buf;
66  {
67  CSerializable* o =
68  static_cast<CSerializable*>(lstClasses[i]->createObject());
69  buf << *o;
70  delete o;
71  }
72 
73  CSerializable::Ptr recons;
74  buf.Seek(0);
75  buf >> recons;
76  }
77  catch (std::exception& e)
78  {
79  GTEST_FAIL() << "Exception during serialization test for class '"
80  << lstClasses[i]->className << "':\n"
81  << e.what() << endl;
82  }
83  }
84 }
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.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:44
uint64_t Seek(uint64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning) override
Introduces a pure virtual method for moving to a specified position in the streamed resource...
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
STL namespace.
MRPT_TODO("liboctomap doesn't work nice with move ctors...")
const mrpt::utils::TRuntimeClassId * lstClasses[]
A 2D grid map representing the reflectivity of the environment (for example, measured with an IR prox...
#define TEST_CLASS_MOVE_COPY_CTORS(_classname)
CWirelessPowerGridMap2D represents a PDF of wifi concentrations over a 2D area.
mrpt::utils::CObject * createObject() const
Definition: CObject.cpp:93
#define CLASS_ID(T)
Access to runtime class ID for a defined class name.
Definition: CObject.h:85
This CStream derived class allow using a memory buffer as a CStream.
Definition: CMemoryStream.h:27
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).
Definition: CBeaconMap.h:46
A three-dimensional probabilistic occupancy grid, implemented as an octo-tree with the "octomap" C++ ...
Definition: COctoMap.h:33
A map of 2D/3D points with individual colours (RGB).
std::shared_ptr< CSerializable > Ptr
Definition: CSerializable.h:47
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. ...
CGasConcentrationGridMap2D represents a PDF of gas concentrations over a 2D area. ...
A structure that holds runtime class type information.
Definition: CObject.h:31
const char * className
Definition: CObject.h:34
A three-dimensional probabilistic occupancy grid, implemented as an octo-tree with the "octomap" C++ ...
TEST(SerializeTestMaps, WriteReadToMem)
The class for storing individual "beacon landmarks" under a variety of 3D position PDF distributions...
Definition: CBeacon.h:42



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019