Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cstream.h
Go to the documentation of this file.
1 /*
2  This file is part of Mitsuba, a physically based rendering system.
3 
4  Copyright (c) 2007-2014 by Wenzel Jakob and others.
5 
6  Mitsuba is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License Version 3
8  as published by the Free Software Foundation.
9 
10  Mitsuba is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #pragma once
20 #if !defined(__MITSUBA_CORE_CSTREAM_H_)
21 #define __MITSUBA_CORE_CSTREAM_H_
22 
23 #include <mitsuba/mitsuba.h>
24 
26 
27 /** \brief Stream-style interface to the default stdin/stdout console streams
28  *
29  * \ingroup libcore
30  * \ingroup libpython
31  */
33 public:
34  // =============================================================
35  //! @{ \name Constructors
36  // =============================================================
37 
38  /// Create a new console stream
39  ConsoleStream();
40 
41  //! @}
42  // =============================================================
43 
44  // =============================================================
45  //! @{ \name Implementation of the Stream interface
46  // =============================================================
47 
48  void read(void *ptr, size_t size);
49  void write(const void *ptr, size_t size);
50  void seek(size_t pos);
51  size_t getPos() const;
52  size_t getSize() const;
53  void truncate(size_t size);
54  void flush();
55  bool canWrite() const;
56  bool canRead() const;
57 
58  //! @}
59  // =============================================================
60 
61  /// Return a string representation
62  std::string toString() const;
63 
65 protected:
66  /// Virtual destructor
67  virtual ~ConsoleStream();
68 };
69 
71 
72 #endif /* __MITSUBA_CORE_CSTREAM_H_ */
virtual void flush()=0
Flush the stream&#39;s buffers.
virtual bool canRead() const =0
Can we read from the stream?
#define MTS_EXPORT_CORE
Definition: getopt.h:29
virtual bool canWrite() const =0
Can we write to the stream?
#define MTS_NAMESPACE_BEGIN
Definition: platform.h:137
virtual void read(void *ptr, size_t size)=0
Read a specified amount of data from the stream.
Abstract seekable stream class.
Definition: stream.h:58
#define MTS_DECLARE_CLASS()
This macro must be used in the initial definition in classes that derive from Object.
Definition: class.h:158
Stream-style interface to the default stdin/stdout console streams.
Definition: cstream.h:32
virtual void write(const void *ptr, size_t size)=0
Write a specified amount of data into the stream.
virtual size_t getPos() const =0
Get the current position inside the stream.
#define MTS_NAMESPACE_END
Definition: platform.h:138
virtual std::string toString() const
Return a string representation.
virtual void seek(size_t pos)=0
Seek to a position inside the stream.
virtual size_t getSize() const =0
Return the size of the stream.
virtual void truncate(size_t size)=0
Truncate the stream to a given size.