Mercurial > hg > piper-cpp
comparison vamp-client/SynchronousTransport.h @ 134:3dcf0394971d
Debug output improvements, and make the checker actually attempt to call the descriptor function for known plugin types
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Wed, 16 Nov 2016 16:12:42 +0000 |
parents | 2004ec2b653e |
children | c4f841ccb208 |
comparison
equal
deleted
inserted
replaced
133:74a7c2a8d6b6 | 134:3dcf0394971d |
---|---|
45 | 45 |
46 class MessageCompletenessChecker // interface | 46 class MessageCompletenessChecker // interface |
47 { | 47 { |
48 public: | 48 public: |
49 virtual ~MessageCompletenessChecker() = default; | 49 virtual ~MessageCompletenessChecker() = default; |
50 | |
51 virtual bool isComplete(const std::vector<char> &message) const = 0; | 50 virtual bool isComplete(const std::vector<char> &message) const = 0; |
52 }; | 51 }; |
53 | 52 |
54 class ServerCrashed : public std::runtime_error | 53 class ServerCrashed : public std::runtime_error |
55 { | 54 { |
56 public: | 55 public: |
57 ServerCrashed() : std::runtime_error("Piper server exited unexpectedly") {} | 56 ServerCrashed() : std::runtime_error("Piper server exited unexpectedly") {} |
57 }; | |
58 | |
59 class LogCallback | |
60 { | |
61 public: | |
62 virtual ~LogCallback() { } | |
63 virtual void log(std::string) const = 0; | |
58 }; | 64 }; |
59 | 65 |
60 class SynchronousTransport // interface | 66 class SynchronousTransport // interface |
61 { | 67 { |
62 public: | 68 public: |
70 | 76 |
71 /** | 77 /** |
72 * Make a synchronous call, passing a serialised request in the data array | 78 * Make a synchronous call, passing a serialised request in the data array |
73 * of length bytes, and return the result. | 79 * of length bytes, and return the result. |
74 * | 80 * |
81 * The type field is only used for logging and debug output. | |
82 * | |
75 * The slow flag is a hint that the recipient may take longer than usual | 83 * The slow flag is a hint that the recipient may take longer than usual |
76 * to process this request and so the caller may wish to be more relaxed | 84 * to process this request and so the caller may wish to be more relaxed |
77 * about idling to wait for the reply. (This shouldn't make any difference | 85 * about idling to wait for the reply. (This shouldn't make any difference |
78 * with a sensible blocking network API, but you never know...) | 86 * with a sensible blocking network API, but you never know...) |
79 * | 87 * |
80 * May throw ServerCrashed if the server endpoint disappeared during the | 88 * May throw ServerCrashed if the server endpoint disappeared during the |
81 * call. Throws std::logic_error if isOK() is not true at the time of | 89 * call. Throws std::logic_error if isOK() is not true at the time of |
82 * calling, so check that before you call. | 90 * calling, so check that before you call. |
83 */ | 91 */ |
84 virtual std::vector<char> call(const char *data, size_t bytes, bool slow) = 0; | 92 virtual std::vector<char> call(const char *data, size_t bytes, |
93 std::string type, bool slow) = 0; | |
85 | 94 |
86 /** | 95 /** |
87 * Check whether the transport was initialised correctly and is working. | 96 * Check whether the transport was initialised correctly and is working. |
88 * This will return false if the endpoint could not be initialised or | 97 * This will return false if the endpoint could not be initialised or |
89 * the endpoint service has crashed or become unavailable. Always check | 98 * the endpoint service has crashed or become unavailable. Always check |