Mercurial > hg > piper-cpp
comparison capnproto/VampnProto.h @ 70:302a8e35248c
Begin capnp RPC test
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 07 Oct 2016 12:07:17 +0100 |
parents | a5ba837bca28 |
children | 6c908ee3ad3b |
comparison
equal
deleted
inserted
replaced
69:91fda9470ee2 | 70:302a8e35248c |
---|---|
413 } | 413 } |
414 } | 414 } |
415 | 415 |
416 static void | 416 static void |
417 readExtractorStaticData(Vamp::HostExt::PluginStaticData &d, | 417 readExtractorStaticData(Vamp::HostExt::PluginStaticData &d, |
418 const ExtractorStaticData::Reader &r) { | 418 const ExtractorStaticData::Reader &r) { |
419 | 419 |
420 d.pluginKey = r.getKey(); | 420 d.pluginKey = r.getKey(); |
421 | 421 |
422 readBasicDescriptor(d.basic, r.getBasic()); | 422 readBasicDescriptor(d.basic, r.getBasic()); |
423 | 423 |
688 readFeatureSet(pr.features, r.getFeatures(), | 688 readFeatureSet(pr.features, r.getFeatures(), |
689 *pmapper.handleToOutputIdMapper(r.getHandle())); | 689 *pmapper.handleToOutputIdMapper(r.getHandle())); |
690 } | 690 } |
691 | 691 |
692 static void | 692 static void |
693 buildFinishResponse(FinishResponse::Builder &b, | |
694 const Vamp::HostExt::ProcessResponse &pr, | |
695 const PluginHandleMapper &pmapper) { | |
696 | |
697 b.setHandle(pmapper.pluginToHandle(pr.plugin)); | |
698 auto f = b.initFeatures(); | |
699 buildFeatureSet(f, pr.features, | |
700 *pmapper.pluginToOutputIdMapper(pr.plugin)); | |
701 } | |
702 | |
703 static void | |
704 readFinishResponse(Vamp::HostExt::ProcessResponse &pr, | |
705 const FinishResponse::Reader &r, | |
706 const PluginHandleMapper &pmapper) { | |
707 | |
708 auto h = r.getHandle(); | |
709 pr.plugin = pmapper.handleToPlugin(h); | |
710 readFeatureSet(pr.features, r.getFeatures(), | |
711 *pmapper.handleToOutputIdMapper(r.getHandle())); | |
712 } | |
713 | |
714 static void | |
693 buildRpcRequest_List(RpcRequest::Builder &b) { | 715 buildRpcRequest_List(RpcRequest::Builder &b) { |
694 b.getRequest().initList(); | 716 b.getRequest().initList(); |
695 } | 717 } |
696 | 718 |
697 static void | 719 static void |
778 buildRpcResponse_Finish(RpcResponse::Builder &b, | 800 buildRpcResponse_Finish(RpcResponse::Builder &b, |
779 const Vamp::HostExt::ProcessResponse &pr, | 801 const Vamp::HostExt::ProcessResponse &pr, |
780 const PluginHandleMapper &pmapper) { | 802 const PluginHandleMapper &pmapper) { |
781 | 803 |
782 auto u = b.getResponse().initFinish(); | 804 auto u = b.getResponse().initFinish(); |
783 buildProcessResponse(u, pr, pmapper); | 805 buildFinishResponse(u, pr, pmapper); |
784 } | 806 } |
785 | 807 |
786 static void | 808 static void |
787 buildRpcResponse_Error(RpcResponse::Builder &b, | 809 buildRpcResponse_Error(RpcResponse::Builder &b, |
788 const std::string &errorText, | 810 const std::string &errorText, |
969 const PluginHandleMapper &pmapper) { | 991 const PluginHandleMapper &pmapper) { |
970 if (getRequestResponseType(r) != RRType::Finish) { | 992 if (getRequestResponseType(r) != RRType::Finish) { |
971 throw std::logic_error("not a finish response"); | 993 throw std::logic_error("not a finish response"); |
972 } | 994 } |
973 resp = {}; | 995 resp = {}; |
974 readProcessResponse(resp, r.getResponse().getFinish(), pmapper); | 996 readFinishResponse(resp, r.getResponse().getFinish(), pmapper); |
975 } | 997 } |
976 }; | 998 }; |
977 | 999 |
978 } | 1000 } |
979 | 1001 |