Main MRPT website > C++ reference for MRPT 1.5.7
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(mrpt::utils::CStream &out, int *version) const
28 {
29  if (version)
30  *version = 0;
31  else
32  {
33  out << sensorLabel << timestamp << sample_rate
34  << AIN_8bits << AIN_16bits << AIN_32bits << AIN_float << AIN_double
35  << AIN_channel_count << AIN_interleaved
36  << AOUT_8bits << AOUT_16bits << AOUT_float << AOUT_double << DIN << DOUT << CNTRIN_32bits << CNTRIN_double;
37  }
38 }
39 
40 /*---------------------------------------------------------------
41  Implements the reading from a CStream capability of CSerializable objects
42  ---------------------------------------------------------------*/
44 {
45  switch(version)
46  {
47  case 0:
48  {
49  in >> sensorLabel >> timestamp >> sample_rate
50  >> AIN_8bits >> AIN_16bits >> AIN_32bits >> AIN_float >> AIN_double
51  >> AIN_channel_count >> AIN_interleaved
52  >> AOUT_8bits >> AOUT_16bits >> AOUT_float >> AOUT_double >> DIN >> DOUT >> CNTRIN_32bits >> CNTRIN_double;
53  } break;
54  default:
56 
57  };
58 
59 }
60 
61 void CObservationRawDAQ::getDescriptionAsText(std::ostream &o) const
62 {
63  using namespace std;
65 
66  cout << "Sample rate : " << sample_rate << " Hz" << endl;
67  cout << "Analog IN Channel count : " << AIN_channel_count << endl;
68  cout << "Analog IN interleaved? : " << (AIN_interleaved ? "yes":"no")<< endl;
69 
70 #define RAWDAQ_SHOW_FIRSTS(_VEC) \
71  cout << "Raw data in " #_VEC " ("<< _VEC.size() <<" entries): First values ["; \
72  if (!_VEC.empty()) { \
73  for (size_t i=1;i<=std::min(_VEC.size(),static_cast<size_t>(10));i++) \
74  cout << _VEC[i-1] << " "; \
75  cout << " ... "; \
76  } \
77  cout << "]\n";
78 
79  RAWDAQ_SHOW_FIRSTS(AIN_8bits)
80  RAWDAQ_SHOW_FIRSTS(AIN_16bits)
81  RAWDAQ_SHOW_FIRSTS(AIN_32bits)
82  RAWDAQ_SHOW_FIRSTS(AIN_float)
83  RAWDAQ_SHOW_FIRSTS(AIN_double)
84  RAWDAQ_SHOW_FIRSTS(AOUT_8bits)
85  RAWDAQ_SHOW_FIRSTS(AOUT_16bits)
86  RAWDAQ_SHOW_FIRSTS(AOUT_float)
87  RAWDAQ_SHOW_FIRSTS(AOUT_double)
89  RAWDAQ_SHOW_FIRSTS(DOUT)
90  RAWDAQ_SHOW_FIRSTS(CNTRIN_32bits)
91  RAWDAQ_SHOW_FIRSTS(CNTRIN_double)
92 
93  cout << endl;
94 }
95 
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...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
#define RAWDAQ_SHOW_FIRSTS(_VEC)
STL namespace.
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.
This namespace contains representation of robot actions and observations.
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...
int version
Definition: mrpt_jpeglib.h:898
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.
GLuint in
Definition: glext.h:6301
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
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.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019