Main MRPT website > C++ reference for MRPT 1.3.2
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-2015, 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 /*---------------------------------------------------------------
15  Class
16  ---------------------------------------------------------------*/
17 namespace mrpt
18 {
19 namespace utils
20 {
21  /** This CStdOutStream derived class allow printing to standard out, normally
22  * the console text output. Please notice CStdOutStream's are binary streams,
23  * so "char *" data types only should be used if textual outputs are
24  * desired.
25  *
26  * \sa CStream
27  * \ingroup mrpt_base_grp
28  */
30  {
31  protected:
32  /** Method responsible for reading from the stream:
33  * In this class it has no effect.
34  */
35  size_t Read(void *Buffer, size_t Count) {
36  MRPT_UNUSED_PARAM(Buffer); MRPT_UNUSED_PARAM(Count);
37  THROW_EXCEPTION("Read-only stream");
38  }
39 
40  /** Method responsible for writing to the stream.
41  * Write attempts to write up to Count bytes to Buffer, and returns the number of bytes actually written.
42  */
43  size_t Write(const void *Buffer,size_t Count);
44 
45  public:
46  /** Constructor
47  */
49 
50  /** Destructor
51  */
52  virtual ~CStdOutStream() { }
53 
54  /** It has no efect in this class.
55  */
56  uint64_t Seek(uint64_t Offset, CStdOutStream::TSeekOrigin Origin = sFromBeginning) {
57  MRPT_UNUSED_PARAM(Offset); MRPT_UNUSED_PARAM(Origin);
58  THROW_EXCEPTION("Invalid operation for this kind of stream");
59  }
60 
61  /** It has no efect in this class.
62  */
63  uint64_t getTotalBytesCount()
64  { THROW_EXCEPTION("Invalid operation for this kind of stream"); }
65 
66  /** It has no efect in this class.
67  */
68  uint64_t getPosition()
69  { THROW_EXCEPTION("Invalid operation for this kind of stream"); }
70 
71  }; // End of class def.
72 
73 } // End of namespace
74 } // End of namespace
75 
76 #endif
TSeekOrigin
Used in CStream::Seek.
Definition: CStream.h:42
#define THROW_EXCEPTION(msg)
This CStdOutStream derived class allow printing to standard out, normally the console text output...
Definition: CStdOutStream.h:29
uint64_t getPosition()
It has no efect in this class.
Definition: CStdOutStream.h:68
CStdOutStream()
Constructor.
Definition: CStdOutStream.h:48
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.
size_t Read(void *Buffer, size_t Count)
Method responsible for reading from the stream: In this class it has no effect.
Definition: CStdOutStream.h:35
uint64_t getTotalBytesCount()
It has no efect in this class.
Definition: CStdOutStream.h:63
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
virtual ~CStdOutStream()
Destructor.
Definition: CStdOutStream.h:52
uint64_t Seek(uint64_t Offset, CStdOutStream::TSeekOrigin Origin=sFromBeginning)
It has no efect in this class.
Definition: CStdOutStream.h:56



Page generated by Doxygen 1.8.11 for MRPT 1.3.2 SVN: at Mon May 9 06:50:38 UTC 2016