Panda3D

dcPackData.h

00001 // Filename: dcPackData.h
00002 // Created by:  drose (15Jun04)
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 #ifndef DCPACKDATA_H
00016 #define DCPACKDATA_H
00017 
00018 #include "dcbase.h"
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //       Class : DCPackData
00022 // Description : This is a block of data that receives the results of
00023 //               DCPacker.
00024 ////////////////////////////////////////////////////////////////////
00025 class EXPCL_DIRECT DCPackData {
00026 PUBLISHED:
00027   INLINE DCPackData();
00028   INLINE ~DCPackData();
00029 
00030   INLINE void clear();
00031 
00032 public:
00033   INLINE void append_data(const char *buffer, size_t size);
00034   INLINE char *get_write_pointer(size_t size);
00035   INLINE void append_junk(size_t size);
00036   INLINE void rewrite_data(size_t position, const char *buffer, size_t size);
00037   INLINE char *get_rewrite_pointer(size_t position, size_t size);
00038 
00039 PUBLISHED:
00040   INLINE string get_string() const;
00041   INLINE size_t get_length() const;
00042 public:
00043   INLINE const char *get_data() const;
00044   INLINE char *take_data();
00045 
00046 private:
00047   void set_used_length(size_t size);
00048 
00049 private:
00050   char *_buffer;
00051   size_t _allocated_size;
00052   size_t _used_length;
00053 };
00054 
00055 #include "dcPackData.I"
00056 
00057 #endif
 All Classes Functions Variables Enumerations