25 lines
No EOL
683 B
C++
25 lines
No EOL
683 B
C++
#include "Stream.h"
|
|
|
|
#ifndef _STREAM_COMMUNICATOR_INCLUDED_
|
|
#define _STREAM_COMMUNICATOR_INCLUDED_
|
|
|
|
class StreamCommunicator
|
|
{
|
|
protected:
|
|
Stream &stream;
|
|
char *messageBuffer;
|
|
__SIZE_TYPE__ bufferSize;
|
|
__SIZE_TYPE__ calculateMessageOutSize(__SIZE_TYPE__ numberOfValues);
|
|
void parseIDs(const int values[], __SIZE_TYPE__ numberOfValues, char *out);
|
|
|
|
public:
|
|
StreamCommunicator(Stream &s_out, __SIZE_TYPE__ bufferSize);
|
|
void sendMessage(int *values, __SIZE_TYPE__ numberOfValues);
|
|
void sendMessage(const char message[]);
|
|
char *receiveMessage();
|
|
char *getBuffer();
|
|
void clearBuffer();
|
|
int getBufferSize();
|
|
Stream *getStream();
|
|
};
|
|
#endif |