Main MRPT website > C++ reference for MRPT 1.5.6
CObservationReflectivity.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 #include "obs-precomp.h" // Precompiled headers
11 
13 #include <mrpt/utils/CStream.h>
14 
15 using namespace mrpt::obs;
16 using namespace mrpt::utils;
17 using namespace mrpt::poses;
18 
19 // This must be added to any CSerializable class implementation file.
21 
22 
23 /** Default constructor.
24  */
26  reflectivityLevel ( 0.5f ),
27  sensorPose(),
28  sensorStdNoise( 0.2f )
29 {
30 }
31 
33 {
34 }
35 
36 /*---------------------------------------------------------------
37  Implements the writing to a CStream capability of CSerializable objects
38  ---------------------------------------------------------------*/
40 {
41  if (version)
42  *version = 0;
43  else
44  {
45  out << reflectivityLevel << sensorPose;
46  out << sensorLabel
47  << timestamp;
48  }
49 }
50 
51 /*---------------------------------------------------------------
52  Implements the reading from a CStream capability of CSerializable objects
53  ---------------------------------------------------------------*/
55 {
56  switch(version)
57  {
58  case 0:
59  {
60  in >> reflectivityLevel >> sensorPose;
61  in >> sensorLabel
62  >> timestamp;
63  } break;
64  default:
66  };
67 }
68 
70 {
72 
73 }
74 
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
Declares a class derived from "CObservation" that encapsules a single short-range reflectivity measur...
GLuint in
Definition: glew.h:7146
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
int version
Definition: mrpt_jpeglib.h:898
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
Declares a class that represents any robot's observation.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
void getDescriptionAsText(std::ostream &o) const MRPT_OVERRIDE
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble f
Definition: glew.h:5092



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018