OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimByteStreamBuffer.h
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // File: ossim-foo.cpp
6 //
7 // Author: Garrett Potts
8 //
9 // Description: This is a basic_streambuf that can be used for binary in memory streams
10 //
11 //
12 // $Id$
13 //----------------------------------------------------------------------------
14 #ifndef ossimByteStreamBuffer_HEADER
15 #define ossimByteStreamBuffer_HEADER
17 #include <cstdio> /* for EOF */
18 #include <streambuf>
19 #include <iosfwd>
20 #include <ios>
21 
22 //using namespace std;
23 class OSSIM_DLL ossimByteStreamBuffer : public std::basic_streambuf<char, std::char_traits<char> >
24 {
25 public:
27 
28  ossimByteStreamBuffer(char_type* buf, ossim_int64 bufSize, bool shared=true);
29 
31  virtual ~ossimByteStreamBuffer();
32  virtual std::streambuf* setbuf ( char_type * s, std::streamsize n );
33  void clear();
34  // added so we can set a buffer and make it shared
35  std::streambuf* setBuf(char* buf, std::streamsize bufSize, bool shared);
36  virtual int overflow( int c = EOF);
40  char_type* buffer();
41  const char_type* buffer()const;
42 
46  char_type* takeBuffer();
47  ossim_uint64 bufferSize()const;
48 
49 protected:
50  virtual int_type pbackfail(int_type __c = traits_type::eof());
51  virtual pos_type seekoff(off_type offset, std::ios_base::seekdir dir,
52  std::ios_base::openmode __mode = std::ios_base::in | std::ios_base::out);
53  virtual pos_type seekpos(pos_type pos, std::ios_base::openmode __mode = std::ios_base::in | std::ios_base::out);
54  virtual std::streamsize xsgetn(char_type* __s, std::streamsize __n);
55  virtual std::streamsize xsputn(const char_type* __s, std::streamsize __n);
56 
57 
58  void deleteBuffer();
59  void extendBuffer(ossim_uint64 bytes);
60 
61  char_type* m_buffer;
64 };
65 
66 #endif
os2<< "> n<< " > nendobj n
unsigned long long ossim_uint64
#define OSSIM_DLL
long long ossim_int64