File: WriteBuffer.H

package info (click to toggle)
dxpc 3.8.0-5
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 672 kB
  • ctags: 780
  • sloc: cpp: 10,145; sh: 173; makefile: 87
file content (40 lines) | stat: -rw-r--r-- 643 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef WriteBuffer_H
#define WriteBuffer_H

class WriteBuffer
{
  public:
  WriteBuffer(unsigned int size = 1024);
   ~WriteBuffer();
  unsigned char *addMessage(unsigned int numBytes);
  unsigned char *getData()
  {
    return buffer_;
  }
  unsigned int getLength() const
  {
    return numBytesInBuffer_;
  }
  void reset()
  {
    numBytesInBuffer_ = 0;
  }

  void registerPointer(unsigned char **ptr)
  {
    index_ = ptr;
  }
  void unregisterPointer()
  {
    index_ = 0;
  }


  private:
  unsigned int bufferSize_;
  unsigned int numBytesInBuffer_;
  unsigned char *buffer_;
  unsigned char **index_;
};

#endif /* WriteBuffer_H */