Main MRPT website > C++ reference for MRPT 1.9.9
CObservationRawDAQ.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 #include <iostream>
15 
16 using namespace mrpt::obs;
17 using namespace mrpt::utils;
18 using namespace mrpt::poses;
19 using namespace std;
20 
21 // This must be added to any CSerializable class implementation file.
23 
24 /*---------------------------------------------------------------
25  Implements the writing to a CStream capability of CSerializable objects
26  ---------------------------------------------------------------*/
27 void CObservationRawDAQ::writeToStream(
28  mrpt::utils::CStream& out, int* version) const
29 {
30  if (version)
31  *version = 0;
32  else
33  {
34  out << sensorLabel << timestamp << sample_rate << AIN_8bits
35  << AIN_16bits << AIN_32bits << AIN_float << AIN_double
36  << AIN_channel_count << AIN_interleaved << AOUT_8bits << AOUT_16bits
37  << AOUT_float << AOUT_double << DIN << DOUT << CNTRIN_32bits
38  << CNTRIN_double;
39  }
40 }
41 
42 /*---------------------------------------------------------------
43  Implements the reading from a CStream capability of CSerializable objects
44  ---------------------------------------------------------------*/
46 {
47  switch (version)
48  {
49  case 0:
50  {
51  in >> sensorLabel >> timestamp >> sample_rate >> AIN_8bits >>
52  AIN_16bits >> AIN_32bits >> AIN_float >> AIN_double >>
53  AIN_channel_count >> AIN_interleaved >> AOUT_8bits >>
54  AOUT_16bits >> AOUT_float >> AOUT_double >> DIN >> DOUT >>
55  CNTRIN_32bits >> CNTRIN_double;
56  }
57  break;
58  default:
60  };
61 }
62 
63 void CObservationRawDAQ::getDescriptionAsText(std::ostream& o) const
64 {
65  using namespace std;
67 
68  cout << "Sample rate : " << sample_rate << " Hz" << endl;
69  cout << "Analog IN Channel count : " << AIN_channel_count << endl;
70  cout << "Analog IN interleaved? : " << (AIN_interleaved ? "yes" : "no")
71  << endl;
72 
73 #define RAWDAQ_SHOW_FIRSTS(_VEC) \
74  cout << "Raw data in " #_VEC " (" << _VEC.size() \
75  << " entries): First values ["; \
76  if (!_VEC.empty()) \
77  { \
78  for (size_t i = 1; \
79  i <= std::min(_VEC.size(), static_cast<size_t>(10)); i++) \
80  cout << _VEC[i - 1] << " "; \
81  cout << " ... "; \
82  } \
83  cout << "]\n";
84 
85  RAWDAQ_SHOW_FIRSTS(AIN_8bits)
86  RAWDAQ_SHOW_FIRSTS(AIN_16bits)
87  RAWDAQ_SHOW_FIRSTS(AIN_32bits)
88  RAWDAQ_SHOW_FIRSTS(AIN_float)
89  RAWDAQ_SHOW_FIRSTS(AIN_double)
90  RAWDAQ_SHOW_FIRSTS(AOUT_8bits)
91  RAWDAQ_SHOW_FIRSTS(AOUT_16bits)
92  RAWDAQ_SHOW_FIRSTS(AOUT_float)
93  RAWDAQ_SHOW_FIRSTS(AOUT_double)
95  RAWDAQ_SHOW_FIRSTS(DOUT)
96  RAWDAQ_SHOW_FIRSTS(CNTRIN_32bits)
97  RAWDAQ_SHOW_FIRSTS(CNTRIN_double)
98 
99  cout << endl;
100 }
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
#define RAWDAQ_SHOW_FIRSTS(_VEC)
STL namespace.
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This namespace contains representation of robot actions and observations.
Store raw data from a Data Acquisition (DAQ) device, such that input or output analog and digital cha...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:17
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:41
GLuint in
Definition: glext.h:7274
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...



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