Mercurial > hg > piper-cpp
diff vamp-capnp/piper.capnp.h @ 185:3eb00e5c76c4
Pull step & block size out into framing struct, return in config
Update the C++ code to separate out the framing parameters (step and
block size) from the configuration structure into their own structure,
as in the latest schema, and to return the accepted framing params in
the configuration response.
This also implies that the plugin stub (which adapts Piper API
back to Vamp) makes a note of the returned values,
making them available via its own getPreferredStep/BlockSize
so that the host can retry the initialise call in the case where it
failed for having the wrong values first time.
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Fri, 03 Feb 2017 16:23:21 +0000 |
parents | 5b113c87b6e6 |
children | 328ffacfc70e |
line wrap: on
line diff
--- a/vamp-capnp/piper.capnp.h Fri Feb 03 13:00:42 2017 +0000 +++ b/vamp-capnp/piper.capnp.h Fri Feb 03 16:23:21 2017 +0000 @@ -37,6 +37,7 @@ CAPNP_DECLARE_SCHEMA(d6a172208c9a1760); CAPNP_DECLARE_SCHEMA(ffa3fccceb684869); CAPNP_DECLARE_SCHEMA(ab2572c346316b24); +CAPNP_DECLARE_SCHEMA(fe907ebf410a65a4); CAPNP_DECLARE_SCHEMA(db209a01f86fe045); CAPNP_DECLARE_SCHEMA(900b56fed422dd37); CAPNP_DECLARE_SCHEMA(b5edf73eb2e79c4e); @@ -226,6 +227,21 @@ }; }; +struct Framing { + Framing() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(fe907ebf410a65a4, 1, 0) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand = &schema->defaultBrand; + #endif // !CAPNP_LITE + }; +}; + struct Configuration { Configuration() = delete; @@ -235,7 +251,7 @@ struct PVPair; struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(db209a01f86fe045, 2, 2) + CAPNP_DECLARE_STRUCT_HEADER(db209a01f86fe045, 1, 3) #if !CAPNP_LITE static constexpr ::capnp::_::RawBrandedSchema const* brand = &schema->defaultBrand; #endif // !CAPNP_LITE @@ -344,7 +360,7 @@ class Pipeline; struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(c433db5864bf6d56, 1, 1) + CAPNP_DECLARE_STRUCT_HEADER(c433db5864bf6d56, 1, 2) #if !CAPNP_LITE static constexpr ::capnp::_::RawBrandedSchema const* brand = &schema->defaultBrand; #endif // !CAPNP_LITE @@ -1655,9 +1671,9 @@ }; #endif // !CAPNP_LITE -class Configuration::Reader { +class Framing::Reader { public: - typedef Configuration Reads; + typedef Framing Reads; Reader() = default; inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} @@ -1672,14 +1688,6 @@ } #endif // !CAPNP_LITE - inline bool hasParameterValues() const; - inline ::capnp::List< ::piper::Configuration::PVPair>::Reader getParameterValues() const; - - inline bool hasCurrentProgram() const; - inline ::capnp::Text::Reader getCurrentProgram() const; - - inline ::int32_t getChannelCount() const; - inline ::int32_t getStepSize() const; inline ::int32_t getBlockSize() const; @@ -1696,9 +1704,9 @@ friend class ::capnp::Orphanage; }; -class Configuration::Builder { +class Framing::Builder { public: - typedef Configuration Builds; + typedef Framing Builds; Builder() = delete; // Deleted to discourage incorrect usage. // You can explicitly initialize to nullptr instead. @@ -1712,6 +1720,94 @@ inline ::kj::StringTree toString() const { return asReader().toString(); } #endif // !CAPNP_LITE + inline ::int32_t getStepSize(); + inline void setStepSize( ::int32_t value); + + inline ::int32_t getBlockSize(); + inline void setBlockSize( ::int32_t value); + +private: + ::capnp::_::StructBuilder _builder; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template <typename, ::capnp::Kind> + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class Framing::Pipeline { +public: + typedef Framing Pipelines; + + inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) {} + +private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class Configuration::Reader { +public: + typedef Configuration Reads; + + Reader() = default; + inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} + + inline ::capnp::MessageSize totalSize() const { + return _reader.totalSize().asPublic(); + } + +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { + return ::capnp::_::structString(_reader, *_capnpPrivate::brand); + } +#endif // !CAPNP_LITE + + inline bool hasParameterValues() const; + inline ::capnp::List< ::piper::Configuration::PVPair>::Reader getParameterValues() const; + + inline bool hasCurrentProgram() const; + inline ::capnp::Text::Reader getCurrentProgram() const; + + inline ::int32_t getChannelCount() const; + + inline bool hasFraming() const; + inline ::piper::Framing::Reader getFraming() const; + +private: + ::capnp::_::StructReader _reader; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; + template <typename, ::capnp::Kind> + friend struct ::capnp::_::PointerHelpers; + template <typename, ::capnp::Kind> + friend struct ::capnp::List; + friend class ::capnp::MessageBuilder; + friend class ::capnp::Orphanage; +}; + +class Configuration::Builder { +public: + typedef Configuration Builds; + + Builder() = delete; // Deleted to discourage incorrect usage. + // You can explicitly initialize to nullptr instead. + inline Builder(decltype(nullptr)) {} + inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} + inline operator Reader() const { return Reader(_builder.asReader()); } + inline Reader asReader() const { return *this; } + + inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { return asReader().toString(); } +#endif // !CAPNP_LITE + inline bool hasParameterValues(); inline ::capnp::List< ::piper::Configuration::PVPair>::Builder getParameterValues(); inline void setParameterValues( ::capnp::List< ::piper::Configuration::PVPair>::Reader value); @@ -1729,11 +1825,12 @@ inline ::int32_t getChannelCount(); inline void setChannelCount( ::int32_t value); - inline ::int32_t getStepSize(); - inline void setStepSize( ::int32_t value); - - inline ::int32_t getBlockSize(); - inline void setBlockSize( ::int32_t value); + inline bool hasFraming(); + inline ::piper::Framing::Builder getFraming(); + inline void setFraming( ::piper::Framing::Reader value); + inline ::piper::Framing::Builder initFraming(); + inline void adoptFraming(::capnp::Orphan< ::piper::Framing>&& value); + inline ::capnp::Orphan< ::piper::Framing> disownFraming(); private: ::capnp::_::StructBuilder _builder; @@ -1753,6 +1850,7 @@ inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) : _typeless(kj::mv(typeless)) {} + inline ::piper::Framing::Pipeline getFraming(); private: ::capnp::AnyPointer::Pipeline _typeless; friend class ::capnp::PipelineHook; @@ -2314,6 +2412,9 @@ inline bool hasOutputs() const; inline ::capnp::List< ::piper::OutputDescriptor>::Reader getOutputs() const; + inline bool hasFraming() const; + inline ::piper::Framing::Reader getFraming() const; + private: ::capnp::_::StructReader _reader; template <typename, ::capnp::Kind> @@ -2352,6 +2453,13 @@ inline void adoptOutputs(::capnp::Orphan< ::capnp::List< ::piper::OutputDescriptor>>&& value); inline ::capnp::Orphan< ::capnp::List< ::piper::OutputDescriptor>> disownOutputs(); + inline bool hasFraming(); + inline ::piper::Framing::Builder getFraming(); + inline void setFraming( ::piper::Framing::Reader value); + inline ::piper::Framing::Builder initFraming(); + inline void adoptFraming(::capnp::Orphan< ::piper::Framing>&& value); + inline ::capnp::Orphan< ::piper::Framing> disownFraming(); + private: ::capnp::_::StructBuilder _builder; template <typename, ::capnp::Kind> @@ -2370,6 +2478,7 @@ inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) : _typeless(kj::mv(typeless)) {} + inline ::piper::Framing::Pipeline getFraming(); private: ::capnp::AnyPointer::Pipeline _typeless; friend class ::capnp::PipelineHook; @@ -4698,6 +4807,34 @@ _builder.getPointerField(1 * ::capnp::POINTERS)); } +inline ::int32_t Framing::Reader::getStepSize() const { + return _reader.getDataField< ::int32_t>( + 0 * ::capnp::ELEMENTS); +} + +inline ::int32_t Framing::Builder::getStepSize() { + return _builder.getDataField< ::int32_t>( + 0 * ::capnp::ELEMENTS); +} +inline void Framing::Builder::setStepSize( ::int32_t value) { + _builder.setDataField< ::int32_t>( + 0 * ::capnp::ELEMENTS, value); +} + +inline ::int32_t Framing::Reader::getBlockSize() const { + return _reader.getDataField< ::int32_t>( + 1 * ::capnp::ELEMENTS); +} + +inline ::int32_t Framing::Builder::getBlockSize() { + return _builder.getDataField< ::int32_t>( + 1 * ::capnp::ELEMENTS); +} +inline void Framing::Builder::setBlockSize( ::int32_t value) { + _builder.setDataField< ::int32_t>( + 1 * ::capnp::ELEMENTS, value); +} + inline bool Configuration::Reader::hasParameterValues() const { return !_reader.getPointerField(0 * ::capnp::POINTERS).isNull(); } @@ -4776,32 +4913,41 @@ 0 * ::capnp::ELEMENTS, value); } -inline ::int32_t Configuration::Reader::getStepSize() const { - return _reader.getDataField< ::int32_t>( - 1 * ::capnp::ELEMENTS); -} - -inline ::int32_t Configuration::Builder::getStepSize() { - return _builder.getDataField< ::int32_t>( - 1 * ::capnp::ELEMENTS); -} -inline void Configuration::Builder::setStepSize( ::int32_t value) { - _builder.setDataField< ::int32_t>( - 1 * ::capnp::ELEMENTS, value); -} - -inline ::int32_t Configuration::Reader::getBlockSize() const { - return _reader.getDataField< ::int32_t>( - 2 * ::capnp::ELEMENTS); -} - -inline ::int32_t Configuration::Builder::getBlockSize() { - return _builder.getDataField< ::int32_t>( - 2 * ::capnp::ELEMENTS); -} -inline void Configuration::Builder::setBlockSize( ::int32_t value) { - _builder.setDataField< ::int32_t>( - 2 * ::capnp::ELEMENTS, value); +inline bool Configuration::Reader::hasFraming() const { + return !_reader.getPointerField(2 * ::capnp::POINTERS).isNull(); +} +inline bool Configuration::Builder::hasFraming() { + return !_builder.getPointerField(2 * ::capnp::POINTERS).isNull(); +} +inline ::piper::Framing::Reader Configuration::Reader::getFraming() const { + return ::capnp::_::PointerHelpers< ::piper::Framing>::get( + _reader.getPointerField(2 * ::capnp::POINTERS)); +} +inline ::piper::Framing::Builder Configuration::Builder::getFraming() { + return ::capnp::_::PointerHelpers< ::piper::Framing>::get( + _builder.getPointerField(2 * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::piper::Framing::Pipeline Configuration::Pipeline::getFraming() { + return ::piper::Framing::Pipeline(_typeless.getPointerField(2)); +} +#endif // !CAPNP_LITE +inline void Configuration::Builder::setFraming( ::piper::Framing::Reader value) { + ::capnp::_::PointerHelpers< ::piper::Framing>::set( + _builder.getPointerField(2 * ::capnp::POINTERS), value); +} +inline ::piper::Framing::Builder Configuration::Builder::initFraming() { + return ::capnp::_::PointerHelpers< ::piper::Framing>::init( + _builder.getPointerField(2 * ::capnp::POINTERS)); +} +inline void Configuration::Builder::adoptFraming( + ::capnp::Orphan< ::piper::Framing>&& value) { + ::capnp::_::PointerHelpers< ::piper::Framing>::adopt( + _builder.getPointerField(2 * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::piper::Framing> Configuration::Builder::disownFraming() { + return ::capnp::_::PointerHelpers< ::piper::Framing>::disown( + _builder.getPointerField(2 * ::capnp::POINTERS)); } inline bool Configuration::PVPair::Reader::hasParameter() const { @@ -5185,6 +5331,43 @@ _builder.getPointerField(0 * ::capnp::POINTERS)); } +inline bool ConfigurationResponse::Reader::hasFraming() const { + return !_reader.getPointerField(1 * ::capnp::POINTERS).isNull(); +} +inline bool ConfigurationResponse::Builder::hasFraming() { + return !_builder.getPointerField(1 * ::capnp::POINTERS).isNull(); +} +inline ::piper::Framing::Reader ConfigurationResponse::Reader::getFraming() const { + return ::capnp::_::PointerHelpers< ::piper::Framing>::get( + _reader.getPointerField(1 * ::capnp::POINTERS)); +} +inline ::piper::Framing::Builder ConfigurationResponse::Builder::getFraming() { + return ::capnp::_::PointerHelpers< ::piper::Framing>::get( + _builder.getPointerField(1 * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::piper::Framing::Pipeline ConfigurationResponse::Pipeline::getFraming() { + return ::piper::Framing::Pipeline(_typeless.getPointerField(1)); +} +#endif // !CAPNP_LITE +inline void ConfigurationResponse::Builder::setFraming( ::piper::Framing::Reader value) { + ::capnp::_::PointerHelpers< ::piper::Framing>::set( + _builder.getPointerField(1 * ::capnp::POINTERS), value); +} +inline ::piper::Framing::Builder ConfigurationResponse::Builder::initFraming() { + return ::capnp::_::PointerHelpers< ::piper::Framing>::init( + _builder.getPointerField(1 * ::capnp::POINTERS)); +} +inline void ConfigurationResponse::Builder::adoptFraming( + ::capnp::Orphan< ::piper::Framing>&& value) { + ::capnp::_::PointerHelpers< ::piper::Framing>::adopt( + _builder.getPointerField(1 * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::piper::Framing> ConfigurationResponse::Builder::disownFraming() { + return ::capnp::_::PointerHelpers< ::piper::Framing>::disown( + _builder.getPointerField(1 * ::capnp::POINTERS)); +} + inline ::int32_t ProcessRequest::Reader::getHandle() const { return _reader.getDataField< ::int32_t>( 0 * ::capnp::ELEMENTS);