Main MRPT website > C++ reference for MRPT 1.5.7
CStdOutStream.h
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 #ifndef CSTDOUTSTREAM_H
10 #define CSTDOUTSTREAM_H
11 
12 #include <mrpt/utils/CStream.h>
13 
14 namespace mrpt
15 {
16 namespace utils
17 {
18  /** This CStdOutStream derived class allow printing to standard out, normally
19  * the console text output. Please notice CStdOutStream's are binary streams,
20  * so "char *" data types only should be used if textual outputs are
21  * desired.
22  *
23  * \sa CStream
24  * \ingroup mrpt_base_grp
25  */
27  {
28  protected:
29  /** Method responsible for reading from the stream. in this class it has no effect */
30  size_t Read(void *Buffer, size_t Count) MRPT_OVERRIDE {
31  MRPT_UNUSED_PARAM(Buffer); MRPT_UNUSED_PARAM(Count);
32  THROW_EXCEPTION("Read-only stream");
33  }
34  /** Method responsible for writing to the stream.
35  * Write attempts to write up to Count bytes to Buffer, and returns the number of bytes actually written. */
36  size_t Write(const void *Buffer,size_t Count) MRPT_OVERRIDE;
37  public:
39  virtual ~CStdOutStream() { }
40  /** It has no efect in this class */
41  uint64_t Seek(int64_t Offset, CStdOutStream::TSeekOrigin Origin = sFromBeginning) MRPT_OVERRIDE { MRPT_UNUSED_PARAM(Offset); MRPT_UNUSED_PARAM(Origin); THROW_EXCEPTION("Invalid operation for this kind of stream"); }
42  /** It has no efect in this class */
43  uint64_t getTotalBytesCount() MRPT_OVERRIDE { THROW_EXCEPTION("Invalid operation for this kind of stream"); }
44  /** It has no efect in this class */
45  uint64_t getPosition() MRPT_OVERRIDE { THROW_EXCEPTION("Invalid operation for this kind of stream"); }
46  }; // End of class def.
47 } // End of namespace
48 } // End of namespace
49 #endif
TSeekOrigin
Used in CStream::Seek.
Definition: CStream.h:42
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
uint64_t getTotalBytesCount() MRPT_OVERRIDE
It has no efect in this class.
Definition: CStdOutStream.h:43
size_t Read(void *Buffer, size_t Count) MRPT_OVERRIDE
Method responsible for reading from the stream.
Definition: CStdOutStream.h:30
#define THROW_EXCEPTION(msg)
This CStdOutStream derived class allow printing to standard out, normally the console text output...
Definition: CStdOutStream.h:26
uint64_t Seek(int64_t Offset, CStdOutStream::TSeekOrigin Origin=sFromBeginning) MRPT_OVERRIDE
It has no efect in this class.
Definition: CStdOutStream.h:41
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
__int64 int64_t
Definition: rptypes.h:51
unsigned __int64 uint64_t
Definition: rptypes.h:52
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
uint64_t getPosition() MRPT_OVERRIDE
It has no efect in this class.
Definition: CStdOutStream.h:45



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