Main Page
Modules
Namespaces
Classes
Files
File List
File Members
include
ecl
devices
detail
character_buffer.hpp
Go to the documentation of this file.
1
8
/*****************************************************************************
9
** Ifdefs
10
*****************************************************************************/
11
12
#ifndef ECL_DEVICES_BUFFER_HPP_
13
#define ECL_DEVICES_BUFFER_HPP_
14
15
/*****************************************************************************
16
** Includes
17
*****************************************************************************/
18
19
#include <cstring>
20
21
/*****************************************************************************
22
** Namespaces
23
*****************************************************************************/
24
25
namespace
ecl
{
26
namespace
devices {
27
28
/*****************************************************************************
29
** Interface [CharBuffer]
30
*****************************************************************************/
39
class
CharBuffer {
40
public
:
41
/*********************
42
** Static Variables
43
**********************/
44
static
const
unsigned
int
buffer_size
= 4096;
45
46
/*********************
47
** C&D
48
**********************/
49
CharBuffer
() :
fill_point_marker
(0) {}
50
virtual
~CharBuffer
() {}
51
52
unsigned
int
remaining
() {
return
( buffer_size -
fill_point_marker
); }
53
unsigned
int
size
()
const
{
return
fill_point_marker
; }
54
bool
full
()
const
;
55
long
append
(
const
char
&c);
56
long
append
(
const
char
* s,
unsigned
long
n);
57
void
clear
();
58
char
*
c_ptr
() {
return
contents
; }
59
60
private
:
61
/*********************
62
** Variables
63
**********************/
64
unsigned
int
fill_point_marker
;
// Index pointing to where you would write the next char
65
char
contents
[
buffer_size
];
66
};
67
68
/*****************************************************************************
69
** Interface [CharStringBuffer]
70
*****************************************************************************/
79
class
CharStringBuffer {
80
public
:
81
/*********************
82
** Static Variables
83
**********************/
84
static
const
unsigned
int
buffer_size = 4095;
// Array is actually this + 1
85
86
/*********************
87
** C&D
88
**********************/
89
CharStringBuffer() :
fill_point_marker
(0) {
90
contents
[
buffer_size
] =
'\0'
;
91
}
92
93
virtual
~CharStringBuffer() {}
94
95
unsigned
int
remaining
() {
return
( buffer_size -
fill_point_marker
); }
96
bool
full
()
const
;
97
long
append
(
const
char
&c);
98
long
append
(
const
char
* s,
unsigned
long
n);
99
const
char
* c_str();
100
void
clear
();
101
102
private
:
103
/*********************
104
** Variables
105
**********************/
106
unsigned
int
fill_point_marker
;
// Index pointing to where you would write the next char
107
char
contents
[buffer_size+1];
108
};
109
110
}
// namespace devices
111
}
// namespace ecl
112
113
114
#endif
/* ECL_DEVICES_BUFFER_HPP_ */
ecl::devices::CharBuffer::size
unsigned int size() const
ecl
ecl::devices::CharBuffer::buffer_size
static const unsigned int buffer_size
Definition:
character_buffer.hpp:44
ecl::devices::CharBuffer::CharBuffer
CharBuffer()
ecl::devices::CharBuffer::contents
char contents[buffer_size]
Definition:
character_buffer.hpp:65
ecl::devices::CharBuffer::remaining
unsigned int remaining()
ecl::devices::CharBuffer::~CharBuffer
virtual ~CharBuffer()
ecl::devices::CharBuffer::full
bool full() const
ecl::devices::CharBuffer::c_ptr
char * c_ptr()
ecl::devices::CharBuffer::clear
void clear()
ecl::devices::CharBuffer::fill_point_marker
unsigned int fill_point_marker
Definition:
character_buffer.hpp:64
ecl::devices::CharBuffer::append
long append(const char &c)
xbot_node
Author(s): Roc, wangpeng@droid.ac.cn
autogenerated on Sat Oct 10 2020 03:28:13