Path Tracer
IOStream.hpp
Go to the documentation of this file.
1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
5 
6 Copyright (c) 2006-2020, assimp team
7 
8 
9 
10 All rights reserved.
11 
12 Redistribution and use of this software in source and binary forms,
13 with or without modification, are permitted provided that the following
14 conditions are met:
15 
16 * Redistributions of source code must retain the above
17  copyright notice, this list of conditions and the
18  following disclaimer.
19 
20 * Redistributions in binary form must reproduce the above
21  copyright notice, this list of conditions and the
22  following disclaimer in the documentation and/or other
23  materials provided with the distribution.
24 
25 * Neither the name of the assimp team, nor the names of its
26  contributors may be used to endorse or promote products
27  derived from this software without specific prior
28  written permission of the assimp team.
29 
30 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 ---------------------------------------------------------------------------
42 */
47 #pragma once
48 #ifndef AI_IOSTREAM_H_INC
49 #define AI_IOSTREAM_H_INC
50 
51 #ifdef __GNUC__
52 # pragma GCC system_header
53 #endif
54 
55 #include <assimp/types.h>
56 
57 #ifndef __cplusplus
58 # error This header requires C++ to be used. aiFileIO.h is the \
59  corresponding C interface.
60 #endif
61 
62 namespace Assimp {
63 
64 // ----------------------------------------------------------------------------------
71 class ASSIMP_API IOStream
72 #ifndef SWIG
73  : public Intern::AllocateFromAssimpHeap
74 #endif
75 {
76 protected:
78  IOStream() AI_NO_EXCEPT;
79 
80 public:
81  // -------------------------------------------------------------------
85  virtual ~IOStream();
86 
87  // -------------------------------------------------------------------
92  virtual size_t Read(void* pvBuffer,
93  size_t pSize,
94  size_t pCount) = 0;
95 
96  // -------------------------------------------------------------------
101  virtual size_t Write(const void* pvBuffer,
102  size_t pSize,
103  size_t pCount) = 0;
104 
105  // -------------------------------------------------------------------
110  virtual aiReturn Seek(size_t pOffset,
111  aiOrigin pOrigin) = 0;
112 
113  // -------------------------------------------------------------------
117  virtual size_t Tell() const = 0;
118 
119  // -------------------------------------------------------------------
122  virtual size_t FileSize() const = 0;
123 
124  // -------------------------------------------------------------------
128  virtual void Flush() = 0;
129 };
130 
131 // ----------------------------------------------------------------------------------
132 AI_FORCE_INLINE
133 IOStream::IOStream() AI_NO_EXCEPT {
134  // empty
135 }
136 
137 // ----------------------------------------------------------------------------------
138 AI_FORCE_INLINE
140  // empty
141 }
142 // ----------------------------------------------------------------------------------
143 
144 }
145 
146 #endif
Assimp::IOStream::Seek
virtual aiReturn Seek(size_t pOffset, aiOrigin pOrigin)=0
Set the read/write cursor of the file.
Assimp::IOStream::IOStream
IOStream() AI_NO_EXCEPT
class IOStream
Definition: IOStream.hpp:133
aiOrigin
aiOrigin
Definition: types.h:426
types.h
Assimp::IOStream::Write
virtual size_t Write(const void *pvBuffer, size_t pSize, size_t pCount)=0
Write to the file.
aiReturn
aiReturn
Definition: types.h:397
Assimp::IOStream::FileSize
virtual size_t FileSize() const =0
Returns filesize Returns the filesize.
Assimp::IOStream::Read
virtual size_t Read(void *pvBuffer, size_t pSize, size_t pCount)=0
Read from the file.
Assimp::IOStream::Flush
virtual void Flush()=0
Flush the contents of the file buffer (for writers) See fflush() for more details.
Assimp::IOStream::~IOStream
virtual ~IOStream()
Destructor. Deleting the object closes the underlying file, alternatively you may use IOSystem::Close...
Definition: IOStream.hpp:139
Assimp
Definition: ai_assert.h:50
Assimp::IOStream::Tell
virtual size_t Tell() const =0
Get the current position of the read/write cursor.
Assimp::IOStream
CPP-API: Class to handle file I/O for C++.
Definition: IOStream.hpp:75