Panda3D
dcPackData.h
1 // Filename: dcPackData.h
2 // Created by: drose (15Jun04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef DCPACKDATA_H
16 #define DCPACKDATA_H
17 
18 #include "dcbase.h"
19 
20 ////////////////////////////////////////////////////////////////////
21 // Class : DCPackData
22 // Description : This is a block of data that receives the results of
23 // DCPacker.
24 ////////////////////////////////////////////////////////////////////
25 class EXPCL_DIRECT DCPackData {
26 PUBLISHED:
27  INLINE DCPackData();
28  INLINE ~DCPackData();
29 
30  INLINE void clear();
31 
32 public:
33  INLINE void append_data(const char *buffer, size_t size);
34  INLINE char *get_write_pointer(size_t size);
35  INLINE void append_junk(size_t size);
36  INLINE void rewrite_data(size_t position, const char *buffer, size_t size);
37  INLINE char *get_rewrite_pointer(size_t position, size_t size);
38 
39 PUBLISHED:
40  INLINE string get_string() const;
41  INLINE size_t get_length() const;
42 public:
43  INLINE const char *get_data() const;
44  INLINE char *take_data();
45 
46 private:
47  void set_used_length(size_t size);
48 
49 private:
50  char *_buffer;
51  size_t _allocated_size;
52  size_t _used_length;
53 };
54 
55 #include "dcPackData.I"
56 
57 #endif
This is a block of data that receives the results of DCPacker.
Definition: dcPackData.h:25