GM6000 Digital Heater Controller
Branch: main
SDX-1330
Main Page
Namespaces
Components
Files
File List
File Members
Cpl
Io
Input.h
Go to the documentation of this file.
1
#ifndef Cpl_Io_Input_h_
2
#define Cpl_Io_Input_h_
3
/*-----------------------------------------------------------------------------
4
* This file is part of the Colony.Core Project. The Colony.Core Project is an
5
* open source project with a BSD type of licensing agreement. See the license
6
* agreement (license.txt) in the top/ directory or on the Internet at
7
* http://integerfox.com/colony.core/license.txt
8
*
9
* Copyright (c) 2014-2022 John T. Taylor
10
*
11
* Redistributions of the source code must retain the above copyright notice.
12
*----------------------------------------------------------------------------*/
13
/** @file */
14
15
#include "
Cpl/Text/String.h
"
16
#include "
Cpl/Io/Close.h
"
17
#include "
Cpl/Io/IsEos.h
"
18
19
20
21
///
22
namespace
Cpl
{
23
///
24
namespace
Io {
25
26
/** This partially abstract class defines a interface for operating on an
27
input stream (example of a stream is 'stdin' or a socket connection).
28
All Read calls on the stream are 'blocking' - i.e. the calls do not
29
return until one or more bytes have been read from the stream.
30
31
Note: There is really only just one read() method (the one the returns
32
'bytesRead'). All of the other read() are convenience methods
33
and as such a default implementation is provided for these methods.
34
35
*/
36
class
Input
:
virtual
public
Close
,
virtual
public
IsEos
37
{
38
public
:
39
/** Reads a single byte from the stream. Returns true if successful,
40
or false if End-of-Stream was encountered.
41
*/
42
virtual
bool
read
(
char
& c );
43
44
/** Reads N bytes into the String's internal buffer. The number of
45
bytes read will be less or equal to the String's max length. The
46
String is guaranteed to be terminated by a '\0'. The placement
47
of the '\0' is determined by the number of bytes read from the
48
stream (i.e. buffer[bytesRead] = '\0'). Returns true if successful,
49
or false if End-of-Stream was encountered.
50
51
NOTE: NO FILTERING of 'non-printable' characters is done! Therefore
52
it is up to the client application to deal with the problem!
53
*/
54
virtual
bool
read
(
Cpl::Text::String
& destString );
55
56
/** Attempts to read the specified number of bytes from the stream in the
57
supplied buffer. The actual number of bytes read is returned via
58
'bytesRead'. Returns true if successful, or false if End-of-Stream
59
was encountered.
60
*/
61
virtual
bool
read
(
void
* buffer,
int
numBytes,
int
& bytesRead ) = 0;
62
63
/** Returns true if there data available to be read from the stream.
64
65
NOTE: The implementation of this method is VERY PLATFORM dependent! If
66
your code uses it - it may not be portable to all platforms.
67
If a platform does not/can not support this method it is
68
guaranteed to return 'true'
69
70
*/
71
virtual
bool
available
() = 0;
72
73
74
public
:
75
/// Lets the make the destructor virtual
76
virtual
~Input
() {}
77
78
};
79
80
81
};
// end namespaces
82
};
83
#endif
// end header latch
Close.h
IsEos.h
String.h
Cpl::Io::Close
This abstract class defines a close operation that is intended to be used Input and Output streams/fi...
Definition
Close.h:32
Cpl::Io::Input
This partially abstract class defines a interface for operating on an input stream (example of a stre...
Definition
Input.h:37
Cpl::Io::Input::read
virtual bool read(Cpl::Text::String &destString)
Reads N bytes into the String's internal buffer.
Cpl::Io::Input::read
virtual bool read(void *buffer, int numBytes, int &bytesRead)=0
Attempts to read the specified number of bytes from the stream in the supplied buffer.
Cpl::Io::Input::read
virtual bool read(char &c)
Reads a single byte from the stream.
Cpl::Io::Input::available
virtual bool available()=0
Returns true if there data available to be read from the stream.
Cpl::Io::Input::~Input
virtual ~Input()
Lets the make the destructor virtual.
Definition
Input.h:76
Cpl::Io::IsEos
This abstract class defines a isEos() operation that is intended to be used Input and Output streams.
Definition
IsEos.h:31
Cpl::Text::String
This abstract class defines the operations that can be before on a NULL terminated string.
Definition
String.h:40
Cpl
The 'Cpl' namespace is the root name space for the Colony.
Definition
Api16.h:20
Generated on Sat Jan 18 2025 22:23:55 for GM6000 Digital Heater Controller by
1.9.8