Mercurial > hg > piper-cpp
annotate vamp-client/SynchronousTransport.h @ 117:5dffc5147176
Small simplification
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Thu, 27 Oct 2016 11:40:57 +0100 |
parents | 427c4c725085 |
children | ff3fd8d1b2dc |
rev | line source |
---|---|
c@90 | 1 |
c@90 | 2 #ifndef PIPER_SYNCHRONOUS_TRANSPORT_H |
c@90 | 3 #define PIPER_SYNCHRONOUS_TRANSPORT_H |
c@90 | 4 |
c@90 | 5 #include <vector> |
c@92 | 6 #include <cstdlib> |
c@90 | 7 |
c@97 | 8 namespace piper_vamp { |
c@97 | 9 namespace client { |
c@90 | 10 |
c@92 | 11 class MessageCompletenessChecker // interface |
c@92 | 12 { |
c@92 | 13 public: |
c@92 | 14 virtual ~MessageCompletenessChecker() = default; |
c@92 | 15 |
c@92 | 16 virtual bool isComplete(const std::vector<char> &message) const = 0; |
c@92 | 17 }; |
c@92 | 18 |
c@90 | 19 class SynchronousTransport // interface |
c@90 | 20 { |
c@90 | 21 public: |
c@92 | 22 virtual ~SynchronousTransport() = default; |
c@92 | 23 |
c@92 | 24 //!!! I do not take ownership |
c@92 | 25 virtual void setCompletenessChecker(MessageCompletenessChecker *) = 0; |
c@92 | 26 |
c@90 | 27 //!!! how to handle errors -- exception or return value? often an |
c@90 | 28 //!!! error (e.g. server has exited) may mean the transport can no |
c@90 | 29 //!!! longer be used at all |
c@90 | 30 virtual std::vector<char> call(const char *data, size_t bytes) = 0; |
c@90 | 31 |
c@90 | 32 virtual bool isOK() const = 0; |
c@90 | 33 }; |
c@90 | 34 |
c@90 | 35 } |
c@94 | 36 } |
c@90 | 37 |
c@90 | 38 #endif |