1/*
2 * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3 *
4 * NVIDIA CORPORATION and its licensors retain all intellectual property
5 * and proprietary rights in and to this software, related documentation
6 * and any modifications thereto. Any use, reproduction, disclosure or
7 * distribution of this software and related documentation without an express
8 * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 */
10// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12
13
14#ifndef PX_FOUNDATION_PX_IO_H
15#define PX_FOUNDATION_PX_IO_H
16
17/** \addtogroup common
18 @{
19*/
20
21#include "common/PxPhysXCommonConfig.h"
22
23#ifndef PX_DOXYGEN
24namespace physx
25{
26#endif
27
28/**
29\brief Input stream class for I/O.
30
31The user needs to supply a PxInputStream implementation to a number of methods to allow the SDK to read data.
32*/
33
34
35
36class PxInputStream
37{
38public:
39
40 /**
41 \brief read from the stream. The number of bytes read may be less than the number requested.
42
43 \param[in] dest the destination address to which the data will be read
44 \param[in] count the number of bytes requested
45
46 \return the number of bytes read from the stream.
47 */
48
49 virtual PxU32 read(void* dest, PxU32 count) = 0;
50
51 virtual ~PxInputStream() {}
52};
53
54
55/**
56\brief Input data class for I/O which provides random read access.
57
58The user needs to supply a PxInputData implementation to a number of methods to allow the SDK to read data.
59*/
60
61class PxInputData : public PxInputStream
62{
63public:
64
65 /**
66 \brief return the length of the input data
67
68 \return size in bytes of the input data
69 */
70
71 virtual PxU32 getLength() const = 0;
72
73
74 /**
75 \brief seek to the given offset from the start of the data.
76
77 \param[in] offset the offset to seek to. If greater than the length of the data, this call is equivalent to seek(length);
78 */
79
80 virtual void seek(PxU32 offset) = 0;
81
82 /**
83 \brief return the current offset from the start of the data
84
85 \return the offset to seek to.
86 */
87
88 virtual PxU32 tell() const = 0;
89
90 virtual ~PxInputData() {}
91};
92
93/**
94\brief Output stream class for I/O.
95
96The user needs to supply a PxOutputStream implementation to a number of methods to allow the SDK to write data.
97*/
98
99class PxOutputStream
100{
101public:
102 /**
103 \brief write to the stream. The number of bytes written may be less than the number sent.
104
105 \param[in] src the destination address from which the data will be written
106 \param[in] count the number of bytes to be written
107
108 \return the number of bytes written to the stream by this call.
109 */
110
111 virtual PxU32 write(const void* src, PxU32 count) = 0;
112
113 virtual ~PxOutputStream() {}
114
115};
116
117
118
119
120
121#ifndef PX_DOXYGEN
122} // namespace physx
123#endif
124
125/** @} */
126#endif
127