PropWare
C++ objects and CMake build system for Parallax Propeller
Home
Download
Getting Started
Documentation
Reference
About
Related Links
Namespace List
Class List
File List
Examples
Build System
File List
File Members
libpropeller
libpropeller
streaminterface
streaminterface.h
1
#ifndef LIBPROPELLER_STREAMINTERFACE_H_
2
#define LIBPROPELLER_STREAMINTERFACE_H_
3
4
namespace
libpropeller
{
5
6
template
<
class
Derived>
7
struct
InputStream
{
8
int
Get(
const
int
timeout = -1){
9
return
static_cast<
Derived*
>
(
this
)->Get(timeout);
10
}
11
12
int
Get(
char
*
const
buffer,
const
int
length,
const
int
timeout = -1){
13
return
static_cast<
Derived*
>
(
this
)->Get(buffer, length, timeout);
14
}
15
16
int
Get(
char
*
const
buffer,
const
char
terminator =
'\n'
){
17
return
static_cast<
Derived*
>
(
this
)->Get(buffer, terminator);
18
}
19
20
21
};
22
23
template
<
class
Derived>
24
struct
OutputStream
{
25
void
Put(
const
char
character){
26
static_cast<
Derived*
>
(
this
)->Put(character);
27
}
28
29
int
Put(
const
char
* buffer_ptr){
30
return
static_cast<
Derived*
>
(
this
)->Put(buffer_ptr);
31
}
32
33
int
Put(
const
char
* buffer_ptr,
const
int
count){
34
return
static_cast<
Derived*
>
(
this
)->Put(buffer_ptr, count);
35
}
36
};
37
38
}
39
40
#endif // LIBPROPELLER_STREAMINTERFACE_H_
libpropeller::InputStream
Definition:
streaminterface.h:7
libpropeller
Definition:
board_unit_tester.h:4
libpropeller::OutputStream
Definition:
streaminterface.h:24
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12