| c@118 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */ | 
| c@118 | 2 /* | 
| c@118 | 3   Piper C++ | 
| c@118 | 4 | 
| c@118 | 5   An API for audio analysis and feature extraction plugins. | 
| c@118 | 6 | 
| c@118 | 7   Centre for Digital Music, Queen Mary, University of London. | 
| c@118 | 8   Copyright 2006-2016 Chris Cannam and QMUL. | 
| c@118 | 9 | 
| c@118 | 10   Permission is hereby granted, free of charge, to any person | 
| c@118 | 11   obtaining a copy of this software and associated documentation | 
| c@118 | 12   files (the "Software"), to deal in the Software without | 
| c@118 | 13   restriction, including without limitation the rights to use, copy, | 
| c@118 | 14   modify, merge, publish, distribute, sublicense, and/or sell copies | 
| c@118 | 15   of the Software, and to permit persons to whom the Software is | 
| c@118 | 16   furnished to do so, subject to the following conditions: | 
| c@118 | 17 | 
| c@118 | 18   The above copyright notice and this permission notice shall be | 
| c@118 | 19   included in all copies or substantial portions of the Software. | 
| c@118 | 20 | 
| c@118 | 21   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | 
| c@118 | 22   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | 
| c@118 | 23   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 
| c@118 | 24   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR | 
| c@118 | 25   ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | 
| c@118 | 26   CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 
| c@118 | 27   WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 
| c@118 | 28 | 
| c@118 | 29   Except as contained in this notice, the names of the Centre for | 
| c@118 | 30   Digital Music; Queen Mary, University of London; and Chris Cannam | 
| c@118 | 31   shall not be used in advertising or otherwise to promote the sale, | 
| c@118 | 32   use or other dealings in this Software without prior written | 
| c@118 | 33   authorization. | 
| c@118 | 34 */ | 
| c@90 | 35 | 
| c@90 | 36 #ifndef PIPER_SYNCHRONOUS_TRANSPORT_H | 
| c@90 | 37 #define PIPER_SYNCHRONOUS_TRANSPORT_H | 
| c@90 | 38 | 
| c@90 | 39 #include <vector> | 
| c@92 | 40 #include <cstdlib> | 
| c@90 | 41 | 
| c@97 | 42 namespace piper_vamp { | 
| c@97 | 43 namespace client { | 
| c@90 | 44 | 
| c@92 | 45 class MessageCompletenessChecker // interface | 
| c@92 | 46 { | 
| c@92 | 47 public: | 
| c@92 | 48     virtual ~MessageCompletenessChecker() = default; | 
| c@92 | 49 | 
| c@92 | 50     virtual bool isComplete(const std::vector<char> &message) const = 0; | 
| c@92 | 51 }; | 
| c@92 | 52 | 
| c@90 | 53 class SynchronousTransport // interface | 
| c@90 | 54 { | 
| c@90 | 55 public: | 
| c@92 | 56     virtual ~SynchronousTransport() = default; | 
| c@92 | 57 | 
| c@92 | 58     //!!! I do not take ownership | 
| c@92 | 59     virtual void setCompletenessChecker(MessageCompletenessChecker *) = 0; | 
| c@92 | 60 | 
| c@90 | 61     //!!! how to handle errors -- exception or return value? often an | 
| c@90 | 62     //!!! error (e.g. server has exited) may mean the transport can no | 
| c@90 | 63     //!!! longer be used at all | 
| c@90 | 64     virtual std::vector<char> call(const char *data, size_t bytes) = 0; | 
| c@90 | 65 | 
| c@90 | 66     virtual bool isOK() const = 0; | 
| c@90 | 67 }; | 
| c@90 | 68 | 
| c@90 | 69 } | 
| c@94 | 70 } | 
| c@90 | 71 | 
| c@90 | 72 #endif |