rllib  1
Public Member Functions | Private Attributes | List of all members
df1Buffer Class Reference

Public Member Functions

 df1Buffer (unsigned int maxsize=256)
 
virtual ~df1Buffer ()
 
unsigned int length ()
 
unsigned char * data ()
 
unsigned int write (unsigned char c)
 
unsigned int writeDLE (unsigned char c)
 
unsigned char & operator[] (unsigned int pos)
 
void reset ()
 
void print ()
 

Private Attributes

unsigned int maxsize
 
unsigned int len
 
unsigned char * dat
 

Detailed Description

Definition at line 47 of file rldf1.cpp.

Constructor & Destructor Documentation

◆ df1Buffer()

df1Buffer::df1Buffer ( unsigned int  maxsize = 256)

Definition at line 66 of file rldf1.cpp.

67 {
68  dat = new unsigned char[_maxsize];
69  maxsize = _maxsize;
70  len=0;
71 }
unsigned int len
Definition: rldf1.cpp:55
unsigned char * dat
Definition: rldf1.cpp:56
unsigned int maxsize
Definition: rldf1.cpp:54

◆ ~df1Buffer()

df1Buffer::~df1Buffer ( )
virtual

Definition at line 73 of file rldf1.cpp.

74 {
75  delete [] dat;
76 }
unsigned char * dat
Definition: rldf1.cpp:56

Member Function Documentation

◆ data()

unsigned char* df1Buffer::data ( )
inline

Definition at line 59 of file rldf1.cpp.

59 {return dat;}
unsigned char * dat
Definition: rldf1.cpp:56

◆ length()

unsigned int df1Buffer::length ( )
inline

Definition at line 58 of file rldf1.cpp.

58 {return len;}
unsigned int len
Definition: rldf1.cpp:55

◆ operator[]()

unsigned char & df1Buffer::operator[] ( unsigned int  pos)

Definition at line 100 of file rldf1.cpp.

101 {
102  if ( pos>=len ) {
103  printf("*** rlBuffer read error! Pos:%u Len:%u\n", pos,len);
104  }
105  return dat[pos];
106 }
unsigned int len
Definition: rldf1.cpp:55
unsigned char * dat
Definition: rldf1.cpp:56

◆ print()

void df1Buffer::print ( )

Definition at line 108 of file rldf1.cpp.

109 {
110  printf("Buffer [%d]:",len);
111  if(len>0) {
112  for(int i=0; i<(int)len; i++) printf(" %02X", (unsigned int)dat[i]);
113  }
114  printf("\n");
115 }
unsigned int len
Definition: rldf1.cpp:55
unsigned char * dat
Definition: rldf1.cpp:56

◆ reset()

void df1Buffer::reset ( )
inline

Definition at line 63 of file rldf1.cpp.

63 {len=0;}
unsigned int len
Definition: rldf1.cpp:55

◆ write()

unsigned int df1Buffer::write ( unsigned char  c)

Definition at line 78 of file rldf1.cpp.

79 {
80  if (len+1<maxsize) {
81  dat[len] = c;
82  len++;
83  }
84  return len;
85 }
unsigned int len
Definition: rldf1.cpp:55
unsigned char * dat
Definition: rldf1.cpp:56
unsigned int maxsize
Definition: rldf1.cpp:54

◆ writeDLE()

unsigned int df1Buffer::writeDLE ( unsigned char  c)

Definition at line 87 of file rldf1.cpp.

88 {
89  if (len+1<maxsize) {
90  if (c==0x10) {
91  dat[len]=c;
92  len++;
93  }
94  dat[len] = c;
95  len++;
96  }
97  return len;
98 }
unsigned int len
Definition: rldf1.cpp:55
unsigned char * dat
Definition: rldf1.cpp:56
unsigned int maxsize
Definition: rldf1.cpp:54

Member Data Documentation

◆ dat

unsigned char* df1Buffer::dat
private

Definition at line 56 of file rldf1.cpp.

◆ len

unsigned int df1Buffer::len
private

Definition at line 55 of file rldf1.cpp.

◆ maxsize

unsigned int df1Buffer::maxsize
private

Definition at line 54 of file rldf1.cpp.


The documentation for this class was generated from the following file: