00001 // Filename: ramfile.I 00002 // Created by: mike (09Jan97) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 //////////////////////////////////////////////////////////////////// 00016 // Function: Ramfile::constructor 00017 // Access: Published 00018 // Description: 00019 //////////////////////////////////////////////////////////////////// 00020 INLINE Ramfile:: 00021 Ramfile() { 00022 _pos = 0; 00023 } 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Function: Ramfile::seek 00027 // Access: Published 00028 // Description: Moves the data pointer to the indicated byte 00029 // position. It is not an error to move the pointer 00030 // past the end of data. 00031 //////////////////////////////////////////////////////////////////// 00032 INLINE void Ramfile:: 00033 seek(size_t pos) { 00034 _pos = pos; 00035 } 00036 00037 //////////////////////////////////////////////////////////////////// 00038 // Function: Ramfile::tell 00039 // Access: Published 00040 // Description: Returns the current data pointer position as a byte 00041 // offset from the beginning of the stream. 00042 //////////////////////////////////////////////////////////////////// 00043 INLINE size_t Ramfile:: 00044 tell() const { 00045 return _pos; 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function: Ramfile::get_data 00050 // Access: Published 00051 // Description: Returns the entire buffer contents as a string, 00052 // regardless of the current data pointer. 00053 //////////////////////////////////////////////////////////////////// 00054 INLINE const string &Ramfile:: 00055 get_data() const { 00056 return _data; 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: Ramfile::get_data_size 00061 // Access: Published 00062 // Description: Returns the size of the entire buffer contents. 00063 //////////////////////////////////////////////////////////////////// 00064 INLINE size_t Ramfile:: 00065 get_data_size() const { 00066 return _data.size(); 00067 } 00068 00069 //////////////////////////////////////////////////////////////////// 00070 // Function: Ramfile::clear 00071 // Access: Published 00072 // Description: Empties the current buffer contents. 00073 //////////////////////////////////////////////////////////////////// 00074 INLINE void Ramfile:: 00075 clear() { 00076 _data.clear(); 00077 }