20 #if !defined(__MITSUBA_CORE_FSTREAM_H_)
21 #define __MITSUBA_CORE_FSTREAM_H_
23 #include <mitsuba/mitsuba.h>
25 #include <boost/filesystem.hpp>
26 #include <boost/scoped_ptr.hpp>
58 explicit FileStream(
const fs::path &path, EFileMode mode = EReadOnly);
68 const fs::path &getPath()
const;
71 void open(
const fs::path &filename, EFileMode mode = EReadOnly);
89 void read(
void *ptr,
size_t size);
90 void write(
const void *ptr,
size_t size);
91 void seek(
size_t pos);
132 struct FileStreamPrivate;
133 boost::scoped_ptr<FileStreamPrivate> d;
virtual void flush()=0
Flush the stream's buffers.
static void staticInitialization()
Initializes the built-in reference count debugger (if enabled)
virtual bool canRead() const =0
Can we read from the stream?
ab
Definition: fstream.h:46
EFileMode
Supported file opening modes.
Definition: fstream.h:41
#define MTS_EXPORT_CORE
Definition: getopt.h:29
virtual bool canWrite() const =0
Can we write to the stream?
wb+
Definition: fstream.h:45
virtual void read(void *ptr, size_t size)=0
Read a specified amount of data from the stream.
wb
Definition: fstream.h:44
rb+
Definition: fstream.h:43
Simple Stream implementation for accessing files.
Definition: fstream.h:38
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
Reference counting helper.
Definition: ref.h:40
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.
static void staticShutdown()
Free the memory taken by staticInitialization()
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.