-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpc_io.h
51 lines (44 loc) · 1.03 KB
/
rpc_io.h
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
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include "rpc_error.h"
#include <iostream> // cout
class CRpcIo
{
protected:
void Dump( const char *msg, const void *buffer, unsigned int size );
public:
virtual ~CRpcIo( )
{
}
virtual void Write( const void *buffer, unsigned int size ) = 0;
virtual void Flush( ) = 0;
virtual void Clear( ) = 0;
virtual void Read( void *buffer, unsigned int size ) = 0;
virtual void Close( ) = 0;
};
// usb.h implements CRpcIo as CUSB
// Null ? This should not be called
class CRpcIoNull:public CRpcIo
{
public:
void Write( const void *buffer, unsigned int size )
{
std::cout << "rpc_io Null called for Write " << size
<< " at " << buffer << std::endl;
throw CRpcError( CRpcError::WRITE_ERROR );
}
void Flush( )
{
}
void Clear( )
{
}
void Read( void *buffer, unsigned int size )
{
std::cout << "rpc_io Null called for Read " << size
<< " at " << buffer << std::endl;
throw CRpcError( CRpcError::READ_ERROR );
} // real Read is in usb.h
void Close( )
{
}
};