From 1ec5ff7b1443e4b205b953875fd876fd6e76fce0 Mon Sep 17 00:00:00 2001 From: pans <pans@454eff88-639b-444f-9e54-f578c98de674> Date: 星期三, 09 八月 2017 12:22:33 +0800 Subject: [PATCH] capnproto update to 7.0dev --- VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnpc.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-json.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnpc.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/arena.h | 496 ++ VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-0.7-dev.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-0.7-dev.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnpc-0.7-dev.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/catrank.capnp | 35 VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/parser.h | 151 VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/node-translator.h | 323 + VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/thread.h | 3 VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/compat/readiness-io.h | 92 VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libkj-0.7-dev.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/exception.h | 8 VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/common.h | 297 + VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/type-id.h | 45 VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/parse/char.h | 7 VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/protobuf-common.h | 359 + VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/error-reporter.h | 97 VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/compat/tls.h | 226 + VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnpc-0.7-dev.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/array.h | 23 VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/filesystem.h | 923 ++++ VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/null-common.h | 174 VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/mutex.h | 48 VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/capnproto-common.h | 423 + VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/vector.h | 17 VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/eval.capnp | 51 VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libkj.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/grammar.capnp.h | 6837 +++++++++++++++++++++++++++++++ VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/miniposix.h | 152 VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libkj.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/one-of.h | 26 VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/common.h | 63 VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libkj-0.7-dev.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/lexer.h | 102 VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-json-0.7-dev.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-json.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/test-util.h | 312 + /dev/null | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/carsales.capnp | 80 VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/compat/http.h | 6 VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/lexer.capnp.h | 1242 +++++ VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/module-loader.h | 65 VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-json-0.7-dev.so | 0 VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/compiler.h | 204 48 files changed, 12,875 insertions(+), 12 deletions(-) diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/capnproto-common.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/capnproto-common.h new file mode 100644 index 0000000..1705f91 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/capnproto-common.h @@ -0,0 +1,423 @@ +// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef CAPNP_BENCHMARK_CAPNP_COMMON_H_ +#define CAPNP_BENCHMARK_CAPNP_COMMON_H_ + +#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) +#pragma GCC system_header +#endif + +#include "common.h" +#include <capnp/serialize.h> +#include <capnp/serialize-packed.h> +#include <kj/debug.h> +#if HAVE_SNAPPY +#include <capnp/serialize-snappy.h> +#endif // HAVE_SNAPPY +#include <thread> + +namespace capnp { +namespace benchmark { +namespace capnp { + +class CountingOutputStream: public kj::FdOutputStream { +public: + CountingOutputStream(int fd): FdOutputStream(fd), throughput(0) {} + + uint64_t throughput; + + void write(const void* buffer, size_t size) override { + FdOutputStream::write(buffer, size); + throughput += size; + } + + void write(kj::ArrayPtr<const kj::ArrayPtr<const byte>> pieces) override { + FdOutputStream::write(pieces); + for (auto& piece: pieces) { + throughput += piece.size(); + } + } +}; + +// ======================================================================================= + +struct Uncompressed { + typedef kj::FdInputStream& BufferedInput; + typedef InputStreamMessageReader MessageReader; + + class ArrayMessageReader: public FlatArrayMessageReader { + public: + ArrayMessageReader(kj::ArrayPtr<const byte> array, + ReaderOptions options = ReaderOptions(), + kj::ArrayPtr<word> scratchSpace = nullptr) + : FlatArrayMessageReader(kj::arrayPtr( + reinterpret_cast<const word*>(array.begin()), + reinterpret_cast<const word*>(array.end())), options) {} + }; + + static inline void write(kj::OutputStream& output, MessageBuilder& builder) { + writeMessage(output, builder); + } +}; + +struct Packed { + typedef kj::BufferedInputStreamWrapper BufferedInput; + typedef PackedMessageReader MessageReader; + + class ArrayMessageReader: private kj::ArrayInputStream, public PackedMessageReader { + public: + ArrayMessageReader(kj::ArrayPtr<const byte> array, + ReaderOptions options = ReaderOptions(), + kj::ArrayPtr<word> scratchSpace = nullptr) + : ArrayInputStream(array), + PackedMessageReader(*this, options, scratchSpace) {} + }; + + static inline void write(kj::OutputStream& output, MessageBuilder& builder) { + writePackedMessage(output, builder); + } + + static inline void write(kj::BufferedOutputStream& output, MessageBuilder& builder) { + writePackedMessage(output, builder); + } +}; + +#if HAVE_SNAPPY +static byte snappyReadBuffer[SNAPPY_BUFFER_SIZE]; +static byte snappyWriteBuffer[SNAPPY_BUFFER_SIZE]; +static byte snappyCompressedBuffer[SNAPPY_COMPRESSED_BUFFER_SIZE]; + +struct SnappyCompressed { + typedef BufferedInputStreamWrapper BufferedInput; + typedef SnappyPackedMessageReader MessageReader; + + class ArrayMessageReader: private ArrayInputStream, public SnappyPackedMessageReader { + public: + ArrayMessageReader(kj::ArrayPtr<const byte> array, + ReaderOptions options = ReaderOptions(), + kj::ArrayPtr<word> scratchSpace = nullptr) + : ArrayInputStream(array), + SnappyPackedMessageReader(static_cast<ArrayInputStream&>(*this), options, scratchSpace, + kj::arrayPtr(snappyReadBuffer, SNAPPY_BUFFER_SIZE)) {} + }; + + static inline void write(OutputStream& output, MessageBuilder& builder) { + writeSnappyPackedMessage(output, builder, + kj::arrayPtr(snappyWriteBuffer, SNAPPY_BUFFER_SIZE), + kj::arrayPtr(snappyCompressedBuffer, SNAPPY_COMPRESSED_BUFFER_SIZE)); + } +}; +#endif // HAVE_SNAPPY + +// ======================================================================================= + +struct NoScratch { + struct ScratchSpace {}; + + template <typename Compression> + class MessageReader: public Compression::MessageReader { + public: + inline MessageReader(typename Compression::BufferedInput& input, ScratchSpace& scratch) + : Compression::MessageReader(input) {} + }; + + template <typename Compression> + class ArrayMessageReader: public Compression::ArrayMessageReader { + public: + inline ArrayMessageReader(kj::ArrayPtr<const byte> input, ScratchSpace& scratch) + : Compression::ArrayMessageReader(input) {} + }; + + class MessageBuilder: public MallocMessageBuilder { + public: + inline MessageBuilder(ScratchSpace& scratch): MallocMessageBuilder() {} + }; + + class ObjectSizeCounter { + public: + ObjectSizeCounter(uint64_t iters): counter(0) {} + + template <typename RequestBuilder, typename ResponseBuilder> + void add(RequestBuilder& request, ResponseBuilder& response) { + for (auto segment: request.getSegmentsForOutput()) { + counter += segment.size() * sizeof(word); + } + for (auto segment: response.getSegmentsForOutput()) { + counter += segment.size() * sizeof(word); + } + } + + uint64_t get() { return counter; } + + private: + uint64_t counter; + }; +}; + +constexpr size_t SCRATCH_SIZE = 128 * 1024; +word scratchSpace[6 * SCRATCH_SIZE]; +int scratchCounter = 0; + +struct UseScratch { + struct ScratchSpace { + word* words; + + ScratchSpace() { + KJ_REQUIRE(scratchCounter < 6, "Too many scratch spaces needed at once."); + words = scratchSpace + scratchCounter++ * SCRATCH_SIZE; + } + ~ScratchSpace() noexcept { + --scratchCounter; + } + }; + + template <typename Compression> + class MessageReader: public Compression::MessageReader { + public: + inline MessageReader(typename Compression::BufferedInput& input, ScratchSpace& scratch) + : Compression::MessageReader( + input, ReaderOptions(), kj::arrayPtr(scratch.words, SCRATCH_SIZE)) {} + }; + + template <typename Compression> + class ArrayMessageReader: public Compression::ArrayMessageReader { + public: + inline ArrayMessageReader(kj::ArrayPtr<const byte> input, ScratchSpace& scratch) + : Compression::ArrayMessageReader( + input, ReaderOptions(), kj::arrayPtr(scratch.words, SCRATCH_SIZE)) {} + }; + + class MessageBuilder: public MallocMessageBuilder { + public: + inline MessageBuilder(ScratchSpace& scratch) + : MallocMessageBuilder(kj::arrayPtr(scratch.words, SCRATCH_SIZE)) {} + }; + + class ObjectSizeCounter { + public: + ObjectSizeCounter(uint64_t iters): iters(iters), maxSize(0) {} + + template <typename RequestBuilder, typename ResponseBuilder> + void add(RequestBuilder& request, ResponseBuilder& response) { + size_t counter = 0; + for (auto segment: request.getSegmentsForOutput()) { + counter += segment.size() * sizeof(word); + } + for (auto segment: response.getSegmentsForOutput()) { + counter += segment.size() * sizeof(word); + } + maxSize = std::max(counter, maxSize); + } + + uint64_t get() { return iters * maxSize; } + + private: + uint64_t iters; + size_t maxSize; + }; +}; + +// ======================================================================================= + +template <typename TestCase, typename ReuseStrategy, typename Compression> +struct BenchmarkMethods { + static uint64_t syncClient(int inputFd, int outputFd, uint64_t iters) { + kj::FdInputStream inputStream(inputFd); + typename Compression::BufferedInput bufferedInput(inputStream); + + CountingOutputStream output(outputFd); + typename ReuseStrategy::ScratchSpace builderScratch; + typename ReuseStrategy::ScratchSpace readerScratch; + + for (; iters > 0; --iters) { + typename TestCase::Expectation expected; + { + typename ReuseStrategy::MessageBuilder builder(builderScratch); + expected = TestCase::setupRequest( + builder.template initRoot<typename TestCase::Request>()); + Compression::write(output, builder); + } + + { + typename ReuseStrategy::template MessageReader<Compression> reader( + bufferedInput, readerScratch); + if (!TestCase::checkResponse( + reader.template getRoot<typename TestCase::Response>(), expected)) { + throw std::logic_error("Incorrect response."); + } + } + } + + return output.throughput; + } + + static uint64_t asyncClientSender( + int outputFd, ProducerConsumerQueue<typename TestCase::Expectation>* expectations, + uint64_t iters) { + CountingOutputStream output(outputFd); + typename ReuseStrategy::ScratchSpace scratch; + + for (; iters > 0; --iters) { + typename ReuseStrategy::MessageBuilder builder(scratch); + expectations->post(TestCase::setupRequest( + builder.template initRoot<typename TestCase::Request>())); + Compression::write(output, builder); + } + + return output.throughput; + } + + static void asyncClientReceiver( + int inputFd, ProducerConsumerQueue<typename TestCase::Expectation>* expectations, + uint64_t iters) { + kj::FdInputStream inputStream(inputFd); + typename Compression::BufferedInput bufferedInput(inputStream); + + typename ReuseStrategy::ScratchSpace scratch; + + for (; iters > 0; --iters) { + typename TestCase::Expectation expected = expectations->next(); + typename ReuseStrategy::template MessageReader<Compression> reader(bufferedInput, scratch); + if (!TestCase::checkResponse( + reader.template getRoot<typename TestCase::Response>(), expected)) { + throw std::logic_error("Incorrect response."); + } + } + } + + static uint64_t asyncClient(int inputFd, int outputFd, uint64_t iters) { + ProducerConsumerQueue<typename TestCase::Expectation> expectations; + std::thread receiverThread(asyncClientReceiver, inputFd, &expectations, iters); + uint64_t throughput = asyncClientSender(outputFd, &expectations, iters); + receiverThread.join(); + return throughput; + } + + static uint64_t server(int inputFd, int outputFd, uint64_t iters) { + kj::FdInputStream inputStream(inputFd); + typename Compression::BufferedInput bufferedInput(inputStream); + + CountingOutputStream output(outputFd); + typename ReuseStrategy::ScratchSpace builderScratch; + typename ReuseStrategy::ScratchSpace readerScratch; + + for (; iters > 0; --iters) { + typename ReuseStrategy::MessageBuilder builder(builderScratch); + typename ReuseStrategy::template MessageReader<Compression> reader( + bufferedInput, readerScratch); + TestCase::handleRequest(reader.template getRoot<typename TestCase::Request>(), + builder.template initRoot<typename TestCase::Response>()); + Compression::write(output, builder); + } + + return output.throughput; + } + + static uint64_t passByObject(uint64_t iters, bool countObjectSize) { + typename ReuseStrategy::ScratchSpace requestScratch; + typename ReuseStrategy::ScratchSpace responseScratch; + + typename ReuseStrategy::ObjectSizeCounter counter(iters); + + for (; iters > 0; --iters) { + typename ReuseStrategy::MessageBuilder requestMessage(requestScratch); + auto request = requestMessage.template initRoot<typename TestCase::Request>(); + typename TestCase::Expectation expected = TestCase::setupRequest(request); + + typename ReuseStrategy::MessageBuilder responseMessage(responseScratch); + auto response = responseMessage.template initRoot<typename TestCase::Response>(); + TestCase::handleRequest(request.asReader(), response); + + if (!TestCase::checkResponse(response.asReader(), expected)) { + throw std::logic_error("Incorrect response."); + } + + if (countObjectSize) { + counter.add(requestMessage, responseMessage); + } + } + + return counter.get(); + } + + static uint64_t passByBytes(uint64_t iters) { + uint64_t throughput = 0; + typename ReuseStrategy::ScratchSpace clientRequestScratch; + UseScratch::ScratchSpace requestBytesScratch; + typename ReuseStrategy::ScratchSpace serverRequestScratch; + typename ReuseStrategy::ScratchSpace serverResponseScratch; + UseScratch::ScratchSpace responseBytesScratch; + typename ReuseStrategy::ScratchSpace clientResponseScratch; + + for (; iters > 0; --iters) { + typename ReuseStrategy::MessageBuilder requestBuilder(clientRequestScratch); + typename TestCase::Expectation expected = TestCase::setupRequest( + requestBuilder.template initRoot<typename TestCase::Request>()); + + kj::ArrayOutputStream requestOutput(kj::arrayPtr( + reinterpret_cast<byte*>(requestBytesScratch.words), SCRATCH_SIZE * sizeof(word))); + Compression::write(requestOutput, requestBuilder); + throughput += requestOutput.getArray().size(); + typename ReuseStrategy::template ArrayMessageReader<Compression> requestReader( + requestOutput.getArray(), serverRequestScratch); + + typename ReuseStrategy::MessageBuilder responseBuilder(serverResponseScratch); + TestCase::handleRequest(requestReader.template getRoot<typename TestCase::Request>(), + responseBuilder.template initRoot<typename TestCase::Response>()); + + kj::ArrayOutputStream responseOutput( + kj::arrayPtr(reinterpret_cast<byte*>(responseBytesScratch.words), + SCRATCH_SIZE * sizeof(word))); + Compression::write(responseOutput, responseBuilder); + throughput += responseOutput.getArray().size(); + typename ReuseStrategy::template ArrayMessageReader<Compression> responseReader( + responseOutput.getArray(), clientResponseScratch); + + if (!TestCase::checkResponse( + responseReader.template getRoot<typename TestCase::Response>(), expected)) { + throw std::logic_error("Incorrect response."); + } + } + + return throughput; + } +}; + +struct BenchmarkTypes { + typedef capnp::Uncompressed Uncompressed; + typedef capnp::Packed Packed; +#if HAVE_SNAPPY + typedef capnp::SnappyCompressed SnappyCompressed; +#endif // HAVE_SNAPPY + + typedef capnp::UseScratch ReusableResources; + typedef capnp::NoScratch SingleUseResources; + + template <typename TestCase, typename ReuseStrategy, typename Compression> + struct BenchmarkMethods: public capnp::BenchmarkMethods<TestCase, ReuseStrategy, Compression> {}; +}; + +} // namespace capnp +} // namespace benchmark +} // namespace capnp + +#endif // CAPNP_BENCHMARK_CAPNP_COMMON_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/carsales.capnp b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/carsales.capnp new file mode 100644 index 0000000..075cae5 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/carsales.capnp @@ -0,0 +1,80 @@ +# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +# Licensed under the MIT License: +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +using Cxx = import "/capnp/c++.capnp"; + +@0xff75ddc6a36723c9; +$Cxx.namespace("capnp::benchmark::capnp"); + +struct ParkingLot { + cars@0: List(Car); +} + +struct TotalValue { + amount@0: UInt64; +} + +struct Car { + make@0: Text; + model@1: Text; + color@2: Color; + seats@3: UInt8; + doors@4: UInt8; + wheels@5: List(Wheel); + length@6: UInt16; + width@7: UInt16; + height@8: UInt16; + weight@9: UInt32; + engine@10: Engine; + fuelCapacity@11: Float32; + fuelLevel@12: Float32; + hasPowerWindows@13: Bool; + hasPowerSteering@14: Bool; + hasCruiseControl@15: Bool; + cupHolders@16: UInt8; + hasNavSystem@17: Bool; +} + +enum Color { + black @0; + white @1; + red @2; + green @3; + blue @4; + cyan @5; + magenta @6; + yellow @7; + silver @8; +} + +struct Wheel { + diameter@0: UInt16; + airPressure@1: Float32; + snowTires@2: Bool; +} + +struct Engine { + horsepower@0: UInt16; + cylinders@1: UInt8; + cc@2: UInt32; + usesGas@3: Bool; + usesElectric@4: Bool; +} diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/catrank.capnp b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/catrank.capnp new file mode 100644 index 0000000..7ec754a --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/catrank.capnp @@ -0,0 +1,35 @@ +# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +# Licensed under the MIT License: +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +using Cxx = import "/capnp/c++.capnp"; + +@0x82beb8e37ff79aba; +$Cxx.namespace("capnp::benchmark::capnp"); + +struct SearchResultList { + results@0: List(SearchResult); +} + +struct SearchResult { + url@0: Text; + score@1: Float64; + snippet@2: Text; +} diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/common.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/common.h new file mode 100644 index 0000000..aa3ac3c --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/common.h @@ -0,0 +1,297 @@ +// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef CAPNP_BENCHMARK_COMMON_H_ +#define CAPNP_BENCHMARK_COMMON_H_ + +#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) +#pragma GCC system_header +#endif + +#include <unistd.h> +#include <limits> +#include <errno.h> +#include <sys/types.h> +#include <sys/time.h> +#include <sys/resource.h> +#include <sys/wait.h> +#include <stdlib.h> +#include <semaphore.h> +#include <algorithm> +#include <stdexcept> +#include <stdio.h> +#include <string.h> +#include <string> +#include <vector> + +namespace capnp { +namespace benchmark { + +// Use a 128-bit Xorshift algorithm. +static inline uint32_t nextFastRand() { + // These values are arbitrary. Any seed other than all zeroes is OK. + static uint32_t x = 0x1d2acd47; + static uint32_t y = 0x58ca3e14; + static uint32_t z = 0xf563f232; + static uint32_t w = 0x0bc76199; + + uint32_t tmp = x ^ (x << 11); + x = y; + y = z; + z = w; + w = w ^ (w >> 19) ^ tmp ^ (tmp >> 8); + return w; +} + +static inline uint32_t fastRand(uint32_t range) { + return nextFastRand() % range; +} + +static inline double fastRandDouble(double range) { + return nextFastRand() * range / std::numeric_limits<uint32_t>::max(); +} + +inline int32_t div(int32_t a, int32_t b) { + if (b == 0) return std::numeric_limits<int32_t>::max(); + // INT_MIN / -1 => SIGFPE. Who knew? + if (a == std::numeric_limits<int32_t>::min() && b == -1) { + return std::numeric_limits<int32_t>::max(); + } + return a / b; +} + +inline int32_t mod(int32_t a, int32_t b) { + if (b == 0) return std::numeric_limits<int32_t>::max(); + // INT_MIN % -1 => SIGFPE. Who knew? + if (a == std::numeric_limits<int32_t>::min() && b == -1) { + return std::numeric_limits<int32_t>::max(); + } + return a % b; +} + +static const char* const WORDS[] = { + "foo ", "bar ", "baz ", "qux ", "quux ", "corge ", "grault ", "garply ", "waldo ", "fred ", + "plugh ", "xyzzy ", "thud " +}; +constexpr size_t WORDS_COUNT = sizeof(WORDS) / sizeof(WORDS[0]); + +template <typename T> +class ProducerConsumerQueue { +public: + ProducerConsumerQueue() { + front = new Node; + back = front; + sem_init(&semaphore, 0, 0); + } + + ~ProducerConsumerQueue() noexcept(false) { + while (front != nullptr) { + Node* oldFront = front; + front = front->next; + delete oldFront; + } + sem_destroy(&semaphore); + } + + void post(T t) { + back->next = new Node(t); + back = back->next; + sem_post(&semaphore); + } + + T next() { + sem_wait(&semaphore); + Node* oldFront = front; + front = front->next; + delete oldFront; + return front->value; + } + +private: + struct Node { + T value; + Node* next; + + Node(): next(nullptr) {} + Node(T value): value(value), next(nullptr) {} + }; + + Node* front; // Last node that has been consumed. + Node* back; // Last node in list. + sem_t semaphore; +}; + +// TODO(cleanup): Use SYSCALL(), get rid of this exception class. +class OsException: public std::exception { +public: + OsException(int error): error(error) {} + ~OsException() noexcept {} + + const char* what() const noexcept override { + return strerror(error); + } + +private: + int error; +}; + +static void writeAll(int fd, const void* buffer, size_t size) { + const char* pos = reinterpret_cast<const char*>(buffer); + while (size > 0) { + ssize_t n = write(fd, pos, size); + if (n <= 0) { + throw OsException(errno); + } + pos += n; + size -= n; + } +} + +static void readAll(int fd, void* buffer, size_t size) { + char* pos = reinterpret_cast<char*>(buffer); + while (size > 0) { + ssize_t n = read(fd, pos, size); + if (n <= 0) { + throw OsException(errno); + } + pos += n; + size -= n; + } +} + +template <typename BenchmarkMethods, typename Func> +uint64_t passByPipe(Func&& clientFunc, uint64_t iters) { + int clientToServer[2]; + int serverToClient[2]; + if (pipe(clientToServer) < 0) throw OsException(errno); + if (pipe(serverToClient) < 0) throw OsException(errno); + + pid_t child = fork(); + if (child == 0) { + // Client. + close(clientToServer[0]); + close(serverToClient[1]); + + uint64_t throughput = clientFunc(serverToClient[0], clientToServer[1], iters); + writeAll(clientToServer[1], &throughput, sizeof(throughput)); + + exit(0); + } else { + // Server. + close(clientToServer[1]); + close(serverToClient[0]); + + uint64_t throughput = BenchmarkMethods::server(clientToServer[0], serverToClient[1], iters); + + uint64_t clientThroughput = 0; + readAll(clientToServer[0], &clientThroughput, sizeof(clientThroughput)); + throughput += clientThroughput; + + int status; + if (waitpid(child, &status, 0) != child) { + throw OsException(errno); + } + if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { + throw std::logic_error("Child exited abnormally."); + } + + return throughput; + } +} + +template <typename BenchmarkTypes, typename TestCase, typename Reuse, typename Compression> +uint64_t doBenchmark(const std::string& mode, uint64_t iters) { + typedef typename BenchmarkTypes::template BenchmarkMethods<TestCase, Reuse, Compression> + BenchmarkMethods; + if (mode == "client") { + return BenchmarkMethods::syncClient(STDIN_FILENO, STDOUT_FILENO, iters); + } else if (mode == "server") { + return BenchmarkMethods::server(STDIN_FILENO, STDOUT_FILENO, iters); + } else if (mode == "object") { + return BenchmarkMethods::passByObject(iters, false); + } else if (mode == "object-size") { + return BenchmarkMethods::passByObject(iters, true); + } else if (mode == "bytes") { + return BenchmarkMethods::passByBytes(iters); + } else if (mode == "pipe") { + return passByPipe<BenchmarkMethods>(BenchmarkMethods::syncClient, iters); + } else if (mode == "pipe-async") { + return passByPipe<BenchmarkMethods>(BenchmarkMethods::asyncClient, iters); + } else { + fprintf(stderr, "Unknown mode: %s\n", mode.c_str()); + exit(1); + } +} + +template <typename BenchmarkTypes, typename TestCase, typename Compression> +uint64_t doBenchmark2(const std::string& mode, const std::string& reuse, uint64_t iters) { + if (reuse == "reuse") { + return doBenchmark< + BenchmarkTypes, TestCase, typename BenchmarkTypes::ReusableResources, Compression>( + mode, iters); + } else if (reuse == "no-reuse") { + return doBenchmark< + BenchmarkTypes, TestCase, typename BenchmarkTypes::SingleUseResources, Compression>( + mode, iters); + } else { + fprintf(stderr, "Unknown reuse mode: %s\n", reuse.c_str()); + exit(1); + } +} + +template <typename BenchmarkTypes, typename TestCase> +uint64_t doBenchmark3(const std::string& mode, const std::string& reuse, + const std::string& compression, uint64_t iters) { + if (compression == "none") { + return doBenchmark2<BenchmarkTypes, TestCase, typename BenchmarkTypes::Uncompressed>( + mode, reuse, iters); + } else if (compression == "packed") { + return doBenchmark2<BenchmarkTypes, TestCase, typename BenchmarkTypes::Packed>( + mode, reuse, iters); +#if HAVE_SNAPPY + } else if (compression == "snappy") { + return doBenchmark2<BenchmarkTypes, TestCase, typename BenchmarkTypes::SnappyCompressed>( + mode, reuse, iters); +#endif // HAVE_SNAPPY + } else { + fprintf(stderr, "Unknown compression mode: %s\n", compression.c_str()); + exit(1); + } +} + +template <typename BenchmarkTypes, typename TestCase> +int benchmarkMain(int argc, char* argv[]) { + if (argc != 5) { + fprintf(stderr, "USAGE: %s MODE REUSE COMPRESSION ITERATION_COUNT\n", argv[0]); + return 1; + } + + uint64_t iters = strtoull(argv[4], nullptr, 0); + uint64_t throughput = doBenchmark3<BenchmarkTypes, TestCase>(argv[1], argv[2], argv[3], iters); + fprintf(stdout, "%llu\n", (long long unsigned int)throughput); + + return 0; +} + +} // namespace capnp +} // namespace benchmark + +#endif // CAPNP_BENCHMARK_COMMON_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/eval.capnp b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/eval.capnp new file mode 100644 index 0000000..fe9a8d4 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/eval.capnp @@ -0,0 +1,51 @@ +# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +# Licensed under the MIT License: +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +using Cxx = import "/capnp/c++.capnp"; + +@0xe12dc4c3e70e9eda; +$Cxx.namespace("capnp::benchmark::capnp"); + +enum Operation { + add @0; + subtract @1; + multiply @2; + divide @3; + modulus @4; +} + +struct Expression { + op@0: Operation; + + left :union { + value@1: Int32; + expression@2: Expression; + } + + right :union { + value@3: Int32; + expression@4: Expression; + } +} + +struct EvaluationResult { + value@0: Int32; +} diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/null-common.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/null-common.h new file mode 100644 index 0000000..3c26919 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/null-common.h @@ -0,0 +1,174 @@ +// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include "common.h" + +namespace capnp { +namespace benchmark { +namespace null { + +uint64_t arena[1024*1024]; +uint64_t* arenaPos = arena; + +template <typename T> +T* allocate(int count = 1) { + T* result = reinterpret_cast<T*>(arenaPos); + arenaPos += (sizeof(T) * count + 7) / 8; + if (arenaPos > arena + sizeof(arena) / sizeof(arena[0])) { + throw std::bad_alloc(); + } + return result; +} + +char* copyString(const char* str) { + size_t len = strlen(str); + char* result = allocate<char>(len); + memcpy(result, str, len + 1); + return result; +} + +template <typename T> +struct List { + size_t size; + T* items; + + inline T* begin() const { return items; } + inline T* end() const { return items + size; } + + inline List<T>& init(size_t size) { + this->size = size; + items = allocate<T>(size); + return *this; + } +}; + +// ======================================================================================= + +struct SingleUseObjects { + class ObjectSizeCounter { + public: + ObjectSizeCounter(uint64_t iters): counter(0) {} + + void add(uint64_t wordCount) { + counter += wordCount; + } + + uint64_t get() { return counter; } + + private: + uint64_t counter; + }; +}; + +struct ReusableObjects { + class ObjectSizeCounter { + public: + ObjectSizeCounter(uint64_t iters): iters(iters), maxSize(0) {} + + void add(size_t wordCount) { + maxSize = std::max(wordCount, maxSize); + } + + uint64_t get() { return iters * maxSize; } + + private: + uint64_t iters; + size_t maxSize; + }; +}; + +// ======================================================================================= + +template <typename TestCase, typename ReuseStrategy, typename Compression> +struct BenchmarkMethods { + static uint64_t syncClient(int inputFd, int outputFd, uint64_t iters) { + fprintf(stderr, "Null benchmark doesn't do I/O.\n"); + exit(1); + } + + static uint64_t asyncClientSender( + int outputFd, ProducerConsumerQueue<typename TestCase::Expectation>* expectations, + uint64_t iters) { + fprintf(stderr, "Null benchmark doesn't do I/O.\n"); + exit(1); + } + + static void asyncClientReceiver( + int inputFd, ProducerConsumerQueue<typename TestCase::Expectation>* expectations, + uint64_t iters) { + fprintf(stderr, "Null benchmark doesn't do I/O.\n"); + exit(1); + } + + static uint64_t asyncClient(int inputFd, int outputFd, uint64_t iters) { + fprintf(stderr, "Null benchmark doesn't do I/O.\n"); + exit(1); + } + + static uint64_t server(int inputFd, int outputFd, uint64_t iters) { + fprintf(stderr, "Null benchmark doesn't do I/O.\n"); + exit(1); + } + + static uint64_t passByObject(uint64_t iters, bool countObjectSize) { + typename ReuseStrategy::ObjectSizeCounter sizeCounter(iters); + + for (; iters > 0; --iters) { + arenaPos = arena; + + typename TestCase::Request request; + typename TestCase::Expectation expected = TestCase::setupRequest(&request); + + typename TestCase::Response response; + TestCase::handleRequest(request, &response); + if (!TestCase::checkResponse(response, expected)) { + throw std::logic_error("Incorrect response."); + } + + sizeCounter.add((arenaPos - arena) * sizeof(arena[0])); + } + + return sizeCounter.get(); + } + + static uint64_t passByBytes(uint64_t iters) { + fprintf(stderr, "Null benchmark doesn't do I/O.\n"); + exit(1); + } +}; + +struct BenchmarkTypes { + typedef void Uncompressed; + typedef void Packed; +#if HAVE_SNAPPY + typedef void SnappyCompressed; +#endif // HAVE_SNAPPY + + typedef ReusableObjects ReusableResources; + typedef SingleUseObjects SingleUseResources; + + template <typename TestCase, typename ReuseStrategy, typename Compression> + struct BenchmarkMethods: public null::BenchmarkMethods<TestCase, ReuseStrategy, Compression> {}; +}; + +} // namespace null +} // namespace benchmark +} // namespace capnp diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/protobuf-common.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/protobuf-common.h new file mode 100644 index 0000000..c4ea244 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/benchmark/protobuf-common.h @@ -0,0 +1,359 @@ +// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include "common.h" +#include <google/protobuf/io/zero_copy_stream_impl.h> +#include <google/protobuf/io/coded_stream.h> +#include <thread> +#if HAVE_SNAPPY +#include <snappy/snappy.h> +#include <snappy/snappy-sinksource.h> +#endif // HAVE_SNAPPY + +namespace capnp { +namespace benchmark { +namespace protobuf { + +// ======================================================================================= + +struct SingleUseMessages { + template <typename MessageType> + struct Message { + struct Reusable {}; + struct SingleUse: public MessageType { + inline SingleUse(Reusable&) {} + }; + }; + + struct ReusableString {}; + struct SingleUseString: std::string { + inline SingleUseString(ReusableString&) {} + }; + + template <typename MessageType> + static inline void doneWith(MessageType& message) { + // Don't clear -- single-use. + } +}; + +struct ReusableMessages { + template <typename MessageType> + struct Message { + struct Reusable: public MessageType {}; + typedef MessageType& SingleUse; + }; + + typedef std::string ReusableString; + typedef std::string& SingleUseString; + + template <typename MessageType> + static inline void doneWith(MessageType& message) { + message.Clear(); + } +}; + +// ======================================================================================= +// The protobuf Java library defines a format for writing multiple protobufs to a stream, in which +// each message is prefixed by a varint size. This was never added to the C++ library. It's easy +// to do naively, but tricky to implement without accidentally losing various optimizations. These +// two functions should be optimal. + +struct Uncompressed { + typedef google::protobuf::io::FileInputStream InputStream; + typedef google::protobuf::io::FileOutputStream OutputStream; + + static uint64_t write(const google::protobuf::MessageLite& message, + google::protobuf::io::FileOutputStream* rawOutput) { + google::protobuf::io::CodedOutputStream output(rawOutput); + const int size = message.ByteSize(); + output.WriteVarint32(size); + uint8_t* buffer = output.GetDirectBufferForNBytesAndAdvance(size); + if (buffer != NULL) { + message.SerializeWithCachedSizesToArray(buffer); + } else { + message.SerializeWithCachedSizes(&output); + if (output.HadError()) { + throw OsException(rawOutput->GetErrno()); + } + } + + return size; + } + + static void read(google::protobuf::io::ZeroCopyInputStream* rawInput, + google::protobuf::MessageLite* message) { + google::protobuf::io::CodedInputStream input(rawInput); + uint32_t size; + GOOGLE_CHECK(input.ReadVarint32(&size)); + + auto limit = input.PushLimit(size); + + GOOGLE_CHECK(message->MergePartialFromCodedStream(&input) && + input.ConsumedEntireMessage()); + + input.PopLimit(limit); + } + + static void flush(google::protobuf::io::FileOutputStream* output) { + if (!output->Flush()) throw OsException(output->GetErrno()); + } +}; + +// ======================================================================================= +// The Snappy interface is really obnoxious. I gave up here and am just reading/writing flat +// arrays in some static scratch space. This probably gives protobufs an edge that it doesn't +// deserve. + +#if HAVE_SNAPPY + +static char scratch[1 << 20]; +static char scratch2[1 << 20]; + +struct SnappyCompressed { + typedef int InputStream; + typedef int OutputStream; + + static uint64_t write(const google::protobuf::MessageLite& message, int* output) { + size_t size = message.ByteSize(); + GOOGLE_CHECK_LE(size, sizeof(scratch)); + + message.SerializeWithCachedSizesToArray(reinterpret_cast<uint8_t*>(scratch)); + + size_t compressedSize = 0; + snappy::RawCompress(scratch, size, scratch2 + sizeof(uint32_t), &compressedSize); + uint32_t tag = compressedSize; + memcpy(scratch2, &tag, sizeof(tag)); + + writeAll(*output, scratch2, compressedSize + sizeof(tag)); + return compressedSize + sizeof(tag); + } + + static void read(int* input, google::protobuf::MessageLite* message) { + uint32_t size; + readAll(*input, &size, sizeof(size)); + readAll(*input, scratch, size); + + size_t uncompressedSize; + GOOGLE_CHECK(snappy::GetUncompressedLength(scratch, size, &uncompressedSize)); + GOOGLE_CHECK(snappy::RawUncompress(scratch, size, scratch2)); + + GOOGLE_CHECK(message->ParsePartialFromArray(scratch2, uncompressedSize)); + } + + static void flush(OutputStream*) {} +}; + +#endif // HAVE_SNAPPY + +// ======================================================================================= + +#define REUSABLE(type) \ + typename ReuseStrategy::template Message<typename TestCase::type>::Reusable +#define SINGLE_USE(type) \ + typename ReuseStrategy::template Message<typename TestCase::type>::SingleUse + +template <typename TestCase, typename ReuseStrategy, typename Compression> +struct BenchmarkMethods { + static uint64_t syncClient(int inputFd, int outputFd, uint64_t iters) { + uint64_t throughput = 0; + + typename Compression::OutputStream output(outputFd); + typename Compression::InputStream input(inputFd); + + REUSABLE(Request) reusableRequest; + REUSABLE(Response) reusableResponse; + + for (; iters > 0; --iters) { + SINGLE_USE(Request) request(reusableRequest); + typename TestCase::Expectation expected = TestCase::setupRequest(&request); + throughput += Compression::write(request, &output); + Compression::flush(&output); + ReuseStrategy::doneWith(request); + + SINGLE_USE(Response) response(reusableResponse); + Compression::read(&input, &response); + if (!TestCase::checkResponse(response, expected)) { + throw std::logic_error("Incorrect response."); + } + ReuseStrategy::doneWith(response); + } + + return throughput; + } + + static uint64_t asyncClientSender( + int outputFd, ProducerConsumerQueue<typename TestCase::Expectation>* expectations, + uint64_t iters) { + uint64_t throughput = 0; + + typename Compression::OutputStream output(outputFd); + REUSABLE(Request) reusableRequest; + + for (; iters > 0; --iters) { + SINGLE_USE(Request) request(reusableRequest); + expectations->post(TestCase::setupRequest(&request)); + throughput += Compression::write(request, &output); + Compression::flush(&output); + ReuseStrategy::doneWith(request); + } + + return throughput; + } + + static void asyncClientReceiver( + int inputFd, ProducerConsumerQueue<typename TestCase::Expectation>* expectations, + uint64_t iters) { + typename Compression::InputStream input(inputFd); + REUSABLE(Response) reusableResponse; + + for (; iters > 0; --iters) { + typename TestCase::Expectation expected = expectations->next(); + SINGLE_USE(Response) response(reusableResponse); + Compression::read(&input, &response); + if (!TestCase::checkResponse(response, expected)) { + throw std::logic_error("Incorrect response."); + } + ReuseStrategy::doneWith(response); + } + } + + static uint64_t asyncClient(int inputFd, int outputFd, uint64_t iters) { + ProducerConsumerQueue<typename TestCase::Expectation> expectations; + std::thread receiverThread(asyncClientReceiver, inputFd, &expectations, iters); + uint64_t throughput = asyncClientSender(outputFd, &expectations, iters); + receiverThread.join(); + + return throughput; + } + + static uint64_t server(int inputFd, int outputFd, uint64_t iters) { + uint64_t throughput = 0; + + typename Compression::OutputStream output(outputFd); + typename Compression::InputStream input(inputFd); + + REUSABLE(Request) reusableRequest; + REUSABLE(Response) reusableResponse; + + for (; iters > 0; --iters) { + SINGLE_USE(Request) request(reusableRequest); + Compression::read(&input, &request); + + SINGLE_USE(Response) response(reusableResponse); + TestCase::handleRequest(request, &response); + ReuseStrategy::doneWith(request); + + throughput += Compression::write(response, &output); + Compression::flush(&output); + ReuseStrategy::doneWith(response); + } + + return throughput; + } + + static uint64_t passByObject(uint64_t iters, bool countObjectSize) { + uint64_t throughput = 0; + + REUSABLE(Request) reusableRequest; + REUSABLE(Response) reusableResponse; + + for (; iters > 0; --iters) { + SINGLE_USE(Request) request(reusableRequest); + typename TestCase::Expectation expected = TestCase::setupRequest(&request); + + SINGLE_USE(Response) response(reusableResponse); + TestCase::handleRequest(request, &response); + ReuseStrategy::doneWith(request); + if (!TestCase::checkResponse(response, expected)) { + throw std::logic_error("Incorrect response."); + } + ReuseStrategy::doneWith(response); + + if (countObjectSize) { + throughput += request.SpaceUsed(); + throughput += response.SpaceUsed(); + } + } + + return throughput; + } + + static uint64_t passByBytes(uint64_t iters) { + uint64_t throughput = 0; + + REUSABLE(Request) reusableClientRequest; + REUSABLE(Request) reusableServerRequest; + REUSABLE(Response) reusableServerResponse; + REUSABLE(Response) reusableClientResponse; + typename ReuseStrategy::ReusableString reusableRequestString, reusableResponseString; + + for (; iters > 0; --iters) { + SINGLE_USE(Request) clientRequest(reusableClientRequest); + typename TestCase::Expectation expected = TestCase::setupRequest(&clientRequest); + + typename ReuseStrategy::SingleUseString requestString(reusableRequestString); + clientRequest.SerializePartialToString(&requestString); + throughput += requestString.size(); + ReuseStrategy::doneWith(clientRequest); + + SINGLE_USE(Request) serverRequest(reusableServerRequest); + serverRequest.ParsePartialFromString(requestString); + + SINGLE_USE(Response) serverResponse(reusableServerResponse); + TestCase::handleRequest(serverRequest, &serverResponse); + ReuseStrategy::doneWith(serverRequest); + + typename ReuseStrategy::SingleUseString responseString(reusableResponseString); + serverResponse.SerializePartialToString(&responseString); + throughput += responseString.size(); + ReuseStrategy::doneWith(serverResponse); + + SINGLE_USE(Response) clientResponse(reusableClientResponse); + clientResponse.ParsePartialFromString(responseString); + + if (!TestCase::checkResponse(clientResponse, expected)) { + throw std::logic_error("Incorrect response."); + } + ReuseStrategy::doneWith(clientResponse); + } + + return throughput; + } +}; + +struct BenchmarkTypes { + typedef protobuf::Uncompressed Uncompressed; + typedef protobuf::Uncompressed Packed; +#if HAVE_SNAPPY + typedef protobuf::SnappyCompressed SnappyCompressed; +#endif // HAVE_SNAPPY + + typedef protobuf::ReusableMessages ReusableResources; + typedef protobuf::SingleUseMessages SingleUseResources; + + template <typename TestCase, typename ReuseStrategy, typename Compression> + struct BenchmarkMethods + : public protobuf::BenchmarkMethods<TestCase, ReuseStrategy, Compression> {}; +}; + +} // namespace protobuf +} // namespace benchmark +} // namespace capnp diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/arena.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/arena.h new file mode 100644 index 0000000..e3cacf3 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/arena.h @@ -0,0 +1,496 @@ +// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef CAPNP_ARENA_H_ +#define CAPNP_ARENA_H_ + +#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) +#pragma GCC system_header +#endif + +#ifndef CAPNP_PRIVATE +#error "This header is only meant to be included by Cap'n Proto's own source code." +#endif + +#include <kj/common.h> +#include <kj/mutex.h> +#include <kj/exception.h> +#include <kj/vector.h> +#include <kj/units.h> +#include "common.h" +#include "message.h" +#include "layout.h" +#include <unordered_map> + +#if !CAPNP_LITE +#include "capability.h" +#endif // !CAPNP_LITE + +namespace capnp { + +#if !CAPNP_LITE +class ClientHook; +#endif // !CAPNP_LITE + +namespace _ { // private + +class SegmentReader; +class SegmentBuilder; +class Arena; +class BuilderArena; +class ReadLimiter; + +class Segment; +typedef kj::Id<uint32_t, Segment> SegmentId; + +class ReadLimiter { + // Used to keep track of how much data has been processed from a message, and cut off further + // processing if and when a particular limit is reached. This is primarily intended to guard + // against maliciously-crafted messages which contain cycles or overlapping structures. Cycles + // and overlapping are not permitted by the Cap'n Proto format because in many cases they could + // be used to craft a deceptively small message which could consume excessive server resources to + // process, perhaps even sending it into an infinite loop. Actually detecting overlaps would be + // time-consuming, so instead we just keep track of how many words worth of data structures the + // receiver has actually dereferenced and error out if this gets too high. + // + // This counting takes place as you call getters (for non-primitive values) on the message + // readers. If you call the same getter twice, the data it returns may be double-counted. This + // should not be a big deal in most cases -- just set the read limit high enough that it will + // only trigger in unreasonable cases. + // + // This class is "safe" to use from multiple threads for its intended use case. Threads may + // overwrite each others' changes to the counter, but this is OK because it only means that the + // limit is enforced a bit less strictly -- it will still kick in eventually. + +public: + inline explicit ReadLimiter(); // No limit. + inline explicit ReadLimiter(WordCount64 limit); // Limit to the given number of words. + + inline void reset(WordCount64 limit); + + KJ_ALWAYS_INLINE(bool canRead(WordCount64 amount, Arena* arena)); + + void unread(WordCount64 amount); + // Adds back some words to the limit. Useful when the caller knows they are double-reading + // some data. + +private: + volatile uint64_t limit; + // Current limit, decremented each time catRead() is called. Volatile because multiple threads + // could be trying to modify it at once. (This is not real thread-safety, but good enough for + // the purpose of this class. See class comment.) + + KJ_DISALLOW_COPY(ReadLimiter); +}; + +#if !CAPNP_LITE +class BrokenCapFactory { + // Callback for constructing broken caps. We use this so that we can avoid arena.c++ having a + // link-time dependency on capability code that lives in libcapnp-rpc. + +public: + virtual kj::Own<ClientHook> newBrokenCap(kj::StringPtr description) = 0; + virtual kj::Own<ClientHook> newNullCap() = 0; +}; +#endif // !CAPNP_LITE + +class SegmentReader { +public: + inline SegmentReader(Arena* arena, SegmentId id, const word* ptr, SegmentWordCount size, + ReadLimiter* readLimiter); + + KJ_ALWAYS_INLINE(const word* checkOffset(const word* from, ptrdiff_t offset)); + // Adds the given offset to the given pointer, checks that it is still within the bounds of the + // segment, then returns it. Note that the "end" pointer of the segment (which technically points + // to the word after the last in the segment) is considered in-bounds for this purpose, so you + // can't necessarily dereference it. You must call checkObject() next to check that the object + // you want to read is entirely in-bounds. + // + // If `from + offset` is out-of-range, this returns a pointer to the end of the segment. Thus, + // any non-zero-sized object will fail `checkObject()`. We do this instead of throwing to save + // some code footprint. + + KJ_ALWAYS_INLINE(bool checkObject(const word* start, WordCountN<31> size)); + // Assuming that `start` is in-bounds for this segment (probably checked using `checkOffset()`), + // check that `start + size` is also in-bounds, and hence the whole area in-between is valid. + + KJ_ALWAYS_INLINE(bool amplifiedRead(WordCount virtualAmount)); + // Indicates that the reader should pretend that `virtualAmount` additional data was read even + // though no actual pointer was traversed. This is used e.g. when reading a struct list pointer + // where the element sizes are zero -- the sender could set the list size arbitrarily high and + // cause the receiver to iterate over this list even though the message itself is small, so we + // need to defend against DoS attacks based on this. + + inline Arena* getArena(); + inline SegmentId getSegmentId(); + + inline const word* getStartPtr(); + inline SegmentWordCount getOffsetTo(const word* ptr); + inline SegmentWordCount getSize(); + + inline kj::ArrayPtr<const word> getArray(); + + inline void unread(WordCount64 amount); + // Add back some words to the ReadLimiter. + +private: + Arena* arena; + SegmentId id; + kj::ArrayPtr<const word> ptr; // size guaranteed to fit in SEGMENT_WORD_COUNT_BITS bits + ReadLimiter* readLimiter; + + KJ_DISALLOW_COPY(SegmentReader); + + friend class SegmentBuilder; + + static void abortCheckObjectFault(); + // Called in debug mode in cases that would segfault in opt mode. (Should be impossible!) +}; + +class SegmentBuilder: public SegmentReader { +public: + inline SegmentBuilder(BuilderArena* arena, SegmentId id, word* ptr, SegmentWordCount size, + ReadLimiter* readLimiter, SegmentWordCount wordsUsed = ZERO * WORDS); + inline SegmentBuilder(BuilderArena* arena, SegmentId id, const word* ptr, SegmentWordCount size, + ReadLimiter* readLimiter); + inline SegmentBuilder(BuilderArena* arena, SegmentId id, decltype(nullptr), + ReadLimiter* readLimiter); + + KJ_ALWAYS_INLINE(word* allocate(SegmentWordCount amount)); + + KJ_ALWAYS_INLINE(void checkWritable()); + // Throw an exception if the segment is read-only (meaning it is a reference to external data). + + KJ_ALWAYS_INLINE(word* getPtrUnchecked(SegmentWordCount offset)); + // Get a writable pointer into the segment. Throws an exception if the segment is read-only (i.e. + // a reference to external immutable data). + + inline BuilderArena* getArena(); + + inline kj::ArrayPtr<const word> currentlyAllocated(); + + inline void reset(); + + inline bool isWritable() { return !readOnly; } + + inline void tryTruncate(word* from, word* to); + // If `from` points just past the current end of the segment, then move the end back to `to`. + // Otherwise, do nothing. + + inline bool tryExtend(word* from, word* to); + // If `from` points just past the current end of the segment, and `to` is within the segment + // boundaries, then move the end up to `to` and return true. Otherwise, do nothing and return + // false. + +private: + word* pos; + // Pointer to a pointer to the current end point of the segment, i.e. the location where the + // next object should be allocated. + + bool readOnly; + + void throwNotWritable(); + + KJ_DISALLOW_COPY(SegmentBuilder); +}; + +class Arena { +public: + virtual ~Arena() noexcept(false); + + virtual SegmentReader* tryGetSegment(SegmentId id) = 0; + // Gets the segment with the given ID, or return nullptr if no such segment exists. + + virtual void reportReadLimitReached() = 0; + // Called to report that the read limit has been reached. See ReadLimiter, below. This invokes + // the VALIDATE_INPUT() macro which may throw an exception; if it returns normally, the caller + // will need to continue with default values. +}; + +class ReaderArena final: public Arena { +public: + explicit ReaderArena(MessageReader* message); + ~ReaderArena() noexcept(false); + KJ_DISALLOW_COPY(ReaderArena); + + // implements Arena ------------------------------------------------ + SegmentReader* tryGetSegment(SegmentId id) override; + void reportReadLimitReached() override; + +private: + MessageReader* message; + ReadLimiter readLimiter; + + // Optimize for single-segment messages so that small messages are handled quickly. + SegmentReader segment0; + + typedef std::unordered_map<uint, kj::Own<SegmentReader>> SegmentMap; + kj::MutexGuarded<kj::Maybe<kj::Own<SegmentMap>>> moreSegments; + // We need to mutex-guard the segment map because we lazily initialize segments when they are + // first requested, but a Reader is allowed to be used concurrently in multiple threads. Luckily + // this only applies to large messages. + // + // TODO(perf): Thread-local thing instead? Some kind of lockless map? Or do sharing of data + // in a different way, where you have to construct a new MessageReader in each thread (but + // possibly backed by the same data)? + + ReaderArena(MessageReader* message, kj::ArrayPtr<const word> firstSegment); + ReaderArena(MessageReader* message, const word* firstSegment, SegmentWordCount firstSegmentSize); +}; + +class BuilderArena final: public Arena { + // A BuilderArena that does not allow the injection of capabilities. + +public: + explicit BuilderArena(MessageBuilder* message); + BuilderArena(MessageBuilder* message, kj::ArrayPtr<MessageBuilder::SegmentInit> segments); + ~BuilderArena() noexcept(false); + KJ_DISALLOW_COPY(BuilderArena); + + inline SegmentBuilder* getRootSegment() { return &segment0; } + + kj::ArrayPtr<const kj::ArrayPtr<const word>> getSegmentsForOutput(); + // Get an array of all the segments, suitable for writing out. This only returns the allocated + // portion of each segment, whereas tryGetSegment() returns something that includes + // not-yet-allocated space. + + inline CapTableBuilder* getLocalCapTable() { + // Return a CapTableBuilder that merely implements local loopback. That is, you can set + // capabilities, then read the same capabilities back, but there is no intent ever to transmit + // these capabilities. A MessageBuilder that isn't imbued with some other CapTable uses this + // by default. + // + // TODO(cleanup): It's sort of a hack that this exists. In theory, perhaps, unimbued + // MessageBuilders should throw exceptions on any attempt to access capability fields, like + // unimbued MessageReaders do. However, lots of code exists which uses MallocMessageBuilder + // as a temporary holder for data to be copied in and out (without being serialized), and it + // is expected that such data can include capabilities, which is admittedly reasonable. + // Therefore, all MessageBuilders must have a cap table by default. Arguably we should + // deprecate this usage and instead define a new helper type for this exact purpose. + + return &localCapTable; + } + + SegmentBuilder* getSegment(SegmentId id); + // Get the segment with the given id. Crashes or throws an exception if no such segment exists. + + struct AllocateResult { + SegmentBuilder* segment; + word* words; + }; + + AllocateResult allocate(SegmentWordCount amount); + // Find a segment with at least the given amount of space available and allocate the space. + // Note that allocating directly from a particular segment is much faster, but allocating from + // the arena is guaranteed to succeed. Therefore callers should try to allocate from a specific + // segment first if there is one, then fall back to the arena. + + SegmentBuilder* addExternalSegment(kj::ArrayPtr<const word> content); + // Add a new segment to the arena which points to some existing memory region. The segment is + // assumed to be completley full; the arena will never allocate from it. In fact, the segment + // is considered read-only. Any attempt to get a Builder pointing into this segment will throw + // an exception. Readers are allowed, however. + // + // This can be used to inject some external data into a message without a copy, e.g. embedding a + // large mmap'd file into a message as `Data` without forcing that data to actually be read in + // from disk (until the message itself is written out). `Orphanage` provides the public API for + // this feature. + + // implements Arena ------------------------------------------------ + SegmentReader* tryGetSegment(SegmentId id) override; + void reportReadLimitReached() override; + +private: + MessageBuilder* message; + ReadLimiter dummyLimiter; + + class LocalCapTable: public CapTableBuilder { +#if !CAPNP_LITE + public: + kj::Maybe<kj::Own<ClientHook>> extractCap(uint index) override; + uint injectCap(kj::Own<ClientHook>&& cap) override; + void dropCap(uint index) override; + + private: + kj::Vector<kj::Maybe<kj::Own<ClientHook>>> capTable; +#endif // ! CAPNP_LITE + }; + + LocalCapTable localCapTable; + + SegmentBuilder segment0; + kj::ArrayPtr<const word> segment0ForOutput; + + struct MultiSegmentState { + kj::Vector<kj::Own<SegmentBuilder>> builders; + kj::Vector<kj::ArrayPtr<const word>> forOutput; + }; + kj::Maybe<kj::Own<MultiSegmentState>> moreSegments; + + SegmentBuilder* segmentWithSpace = nullptr; + // When allocating, look for space in this segment first before resorting to allocating a new + // segment. This is not necessarily the last segment because addExternalSegment() may add a + // segment that is already-full, in which case we don't update this pointer. + + template <typename T> // Can be `word` or `const word`. + SegmentBuilder* addSegmentInternal(kj::ArrayPtr<T> content); +}; + +// ======================================================================================= + +inline ReadLimiter::ReadLimiter() + : limit(kj::maxValue) {} + +inline ReadLimiter::ReadLimiter(WordCount64 limit): limit(unbound(limit / WORDS)) {} + +inline void ReadLimiter::reset(WordCount64 limit) { this->limit = unbound(limit / WORDS); } + +inline bool ReadLimiter::canRead(WordCount64 amount, Arena* arena) { + // Be careful not to store an underflowed value into `limit`, even if multiple threads are + // decrementing it. + uint64_t current = limit; + if (KJ_UNLIKELY(unbound(amount / WORDS) > current)) { + arena->reportReadLimitReached(); + return false; + } else { + limit = current - unbound(amount / WORDS); + return true; + } +} + +// ------------------------------------------------------------------- + +inline SegmentReader::SegmentReader(Arena* arena, SegmentId id, const word* ptr, + SegmentWordCount size, ReadLimiter* readLimiter) + : arena(arena), id(id), ptr(kj::arrayPtr(ptr, unbound(size / WORDS))), + readLimiter(readLimiter) {} + +inline const word* SegmentReader::checkOffset(const word* from, ptrdiff_t offset) { + ptrdiff_t min = ptr.begin() - from; + ptrdiff_t max = ptr.end() - from; + if (offset >= min && offset <= max) { + return from + offset; + } else { + return ptr.end(); + } +} + +inline bool SegmentReader::checkObject(const word* start, WordCountN<31> size) { + auto startOffset = intervalLength(ptr.begin(), start, MAX_SEGMENT_WORDS); +#ifdef KJ_DEBUG + if (startOffset > bounded(ptr.size()) * WORDS) { + abortCheckObjectFault(); + } +#endif + return startOffset + size <= bounded(ptr.size()) * WORDS && + readLimiter->canRead(size, arena); +} + +inline bool SegmentReader::amplifiedRead(WordCount virtualAmount) { + return readLimiter->canRead(virtualAmount, arena); +} + +inline Arena* SegmentReader::getArena() { return arena; } +inline SegmentId SegmentReader::getSegmentId() { return id; } +inline const word* SegmentReader::getStartPtr() { return ptr.begin(); } +inline SegmentWordCount SegmentReader::getOffsetTo(const word* ptr) { + KJ_IREQUIRE(this->ptr.begin() <= ptr && ptr <= this->ptr.end()); + return intervalLength(this->ptr.begin(), ptr, MAX_SEGMENT_WORDS); +} +inline SegmentWordCount SegmentReader::getSize() { + return assumeBits<SEGMENT_WORD_COUNT_BITS>(ptr.size()) * WORDS; +} +inline kj::ArrayPtr<const word> SegmentReader::getArray() { return ptr; } +inline void SegmentReader::unread(WordCount64 amount) { readLimiter->unread(amount); } + +// ------------------------------------------------------------------- + +inline SegmentBuilder::SegmentBuilder( + BuilderArena* arena, SegmentId id, word* ptr, SegmentWordCount size, + ReadLimiter* readLimiter, SegmentWordCount wordsUsed) + : SegmentReader(arena, id, ptr, size, readLimiter), + pos(ptr + wordsUsed), readOnly(false) {} +inline SegmentBuilder::SegmentBuilder( + BuilderArena* arena, SegmentId id, const word* ptr, SegmentWordCount size, + ReadLimiter* readLimiter) + : SegmentReader(arena, id, ptr, size, readLimiter), + // const_cast is safe here because the member won't ever be dereferenced because it appears + // to point to the end of the segment anyway. + pos(const_cast<word*>(ptr + size)), readOnly(true) {} +inline SegmentBuilder::SegmentBuilder(BuilderArena* arena, SegmentId id, decltype(nullptr), + ReadLimiter* readLimiter) + : SegmentReader(arena, id, nullptr, ZERO * WORDS, readLimiter), + pos(nullptr), readOnly(false) {} + +inline word* SegmentBuilder::allocate(SegmentWordCount amount) { + if (intervalLength(pos, ptr.end(), MAX_SEGMENT_WORDS) < amount) { + // Not enough space in the segment for this allocation. + return nullptr; + } else { + // Success. + word* result = pos; + pos = pos + amount; + return result; + } +} + +inline void SegmentBuilder::checkWritable() { + if (KJ_UNLIKELY(readOnly)) throwNotWritable(); +} + +inline word* SegmentBuilder::getPtrUnchecked(SegmentWordCount offset) { + return const_cast<word*>(ptr.begin() + offset); +} + +inline BuilderArena* SegmentBuilder::getArena() { + // Down-cast safe because SegmentBuilder's constructor always initializes its SegmentReader base + // class with an Arena pointer that actually points to a BuilderArena. + return static_cast<BuilderArena*>(arena); +} + +inline kj::ArrayPtr<const word> SegmentBuilder::currentlyAllocated() { + return kj::arrayPtr(ptr.begin(), pos - ptr.begin()); +} + +inline void SegmentBuilder::reset() { + word* start = getPtrUnchecked(ZERO * WORDS); + memset(start, 0, (pos - start) * sizeof(word)); + pos = start; +} + +inline void SegmentBuilder::tryTruncate(word* from, word* to) { + if (pos == from) pos = to; +} + +inline bool SegmentBuilder::tryExtend(word* from, word* to) { + // Careful about overflow. + if (pos == from && to <= ptr.end() && to >= from) { + pos = to; + return true; + } else { + return false; + } +} + +} // namespace _ (private) +} // namespace capnp + +#endif // CAPNP_ARENA_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/compiler.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/compiler.h new file mode 100644 index 0000000..0362c30 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/compiler.h @@ -0,0 +1,204 @@ +// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef CAPNP_COMPILER_COMPILER_H_ +#define CAPNP_COMPILER_COMPILER_H_ + +#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) +#pragma GCC system_header +#endif + +#include <capnp/compiler/grammar.capnp.h> +#include <capnp/schema.capnp.h> +#include <capnp/schema-loader.h> +#include "error-reporter.h" + +namespace capnp { +namespace compiler { + +class Module: public ErrorReporter { +public: + virtual kj::StringPtr getSourceName() = 0; + // The name of the module file relative to the source tree. Used to decide where to output + // generated code and to form the `displayName` in the schema. + + virtual Orphan<ParsedFile> loadContent(Orphanage orphanage) = 0; + // Loads the module content, using the given orphanage to allocate objects if necessary. + + virtual kj::Maybe<Module&> importRelative(kj::StringPtr importPath) = 0; + // Find another module, relative to this one. Importing the same logical module twice should + // produce the exact same object, comparable by identity. These objects are owned by some + // outside pool that outlives the Compiler instance. + + virtual kj::Maybe<kj::Array<const byte>> embedRelative(kj::StringPtr embedPath) = 0; + // Read and return the content of a file specified using `embed`. +}; + +class Compiler final: private SchemaLoader::LazyLoadCallback { + // Cross-links separate modules (schema files) and translates them into schema nodes. + // + // This class is thread-safe, hence all its methods are const. + +public: + enum AnnotationFlag { + COMPILE_ANNOTATIONS, + // Compile annotations normally. + + DROP_ANNOTATIONS + // Do not compile any annotations, eagerly or lazily. All "annotations" fields in the schema + // will be left empty. This is useful to avoid parsing imports that are used only for + // annotations which you don't intend to use anyway. + // + // Unfortunately annotations cannot simply be compiled lazily because filling in the + // "annotations" field at the usage site requires knowing the annotation's type, which requires + // compiling the annotation, and the schema API has no particular way to detect when you + // try to access the "annotations" field in order to lazily compile the annotations at that + // point. + }; + + explicit Compiler(AnnotationFlag annotationFlag = COMPILE_ANNOTATIONS); + ~Compiler() noexcept(false); + KJ_DISALLOW_COPY(Compiler); + + uint64_t add(Module& module) const; + // Add a module to the Compiler, returning the module's file ID. The ID can then be looked up in + // the `SchemaLoader` returned by `getLoader()`. However, the SchemaLoader may behave as if the + // schema node doesn't exist if any compilation errors occur (reported via the module's + // ErrorReporter). The module is parsed at the time `add()` is called, but not fully compiled -- + // individual schema nodes are compiled lazily. If you want to force eager compilation, + // see `eagerlyCompile()`, below. + + kj::Maybe<uint64_t> lookup(uint64_t parent, kj::StringPtr childName) const; + // Given the type ID of a schema node, find the ID of a node nested within it. Throws an + // exception if the parent ID is not recognized; returns null if the parent has no child of the + // given name. Neither the parent nor the child schema node is actually compiled. + + kj::Maybe<schema::Node::SourceInfo::Reader> getSourceInfo(uint64_t id) const; + // Get the SourceInfo for the given type ID, if available. + + Orphan<List<schema::CodeGeneratorRequest::RequestedFile::Import>> + getFileImportTable(Module& module, Orphanage orphanage) const; + // Build the import table for the CodeGeneratorRequest for the given module. + + Orphan<List<schema::Node::SourceInfo>> getAllSourceInfo(Orphanage orphanage) const; + // Gets the SourceInfo structs for all nodes parsed by the compiler. + + enum Eagerness: uint32_t { + // Flags specifying how eager to be about compilation. These are intended to be bitwise OR'd. + // Used with the method `eagerlyCompile()`. + // + // Schema declarations can be compiled upfront, or they can be compiled lazily as they are + // needed. Usually, the difference is not observable, but it is not a perfect abstraction. + // The difference has the following effects: + // * `getLoader().getAllLoaded()` only returns the schema nodes which have been compiled so + // far. + // * `getLoader().get()` (i.e. searching for a schema by ID) can only find schema nodes that + // have either been compiled already, or which are referenced by schema nodes which have been + // compiled already. This means that if the ID you pass in came from another schema node + // compiled with the same compiler, there should be no observable difference, but if you + // have an ID from elsewhere which you _a priori_ expect is defined in a particular schema + // file, you will need to compile that file eagerly before you look up the node by ID. + // * Errors are reported when they are encountered, so some errors will not be reported until + // the node is actually compiled. + // * If an imported file is not needed, it will never even be read from disk. + // + // The last point is the main reason why you might want to prefer lazy compilation: it allows + // you to use a schema file with missing imports, so long as those missing imports are not + // actually needed. + // + // For example, the flag combo: + // EAGER_NODE | EAGER_CHILDREN | EAGER_DEPENDENCIES | EAGER_DEPENDENCY_PARENTS + // will compile the entire given module, plus all direct dependencies of anything in that + // module, plus all lexical ancestors of those dependencies. This is what the Cap'n Proto + // compiler uses when building initial code generator requests. + + ALL_RELATED_NODES = ~0u, + // Compile everything that is in any way related to the target node, including its entire + // containing file and everything transitively imported by it. + + NODE = 1 << 0, + // Eagerly compile the requested node, but not necessarily any of its parents, children, or + // dependencies. + + PARENTS = 1 << 1, + // Eagerly compile all lexical parents of the requested node. Only meaningful in conjuction + // with NODE. + + CHILDREN = 1 << 2, + // Eagerly compile all of the node's lexically nested nodes. Only meaningful in conjuction + // with NODE. + + DEPENDENCIES = NODE << 15, + // For all nodes compiled as a result of the above flags, also compile their direct + // dependencies. E.g. if Foo is a struct which contains a field of type Bar, and Foo is + // compiled, then also compile Bar. "Dependencies" are defined as field types, method + // parameter and return types, and annotation types. Nested types and outer types are not + // considered dependencies. + + DEPENDENCY_PARENTS = PARENTS * DEPENDENCIES, + DEPENDENCY_CHILDREN = CHILDREN * DEPENDENCIES, + DEPENDENCY_DEPENDENCIES = DEPENDENCIES * DEPENDENCIES, + // Like PARENTS, CHILDREN, and DEPENDENCIES, but applies relative to dependency nodes rather + // than the original requested node. Note that DEPENDENCY_DEPENDENCIES causes all transitive + // dependencies of the requested node to be compiled. + // + // These flags are defined as multiples of the original flag and DEPENDENCIES so that we + // can form the flags to use when traversing a dependency by shifting bits. + }; + + void eagerlyCompile(uint64_t id, uint eagerness) const; + // Force eager compilation of schema nodes related to the given ID. `eagerness` specifies which + // related nodes should be compiled before returning. It is a bitwise OR of the possible values + // of the `Eagerness` enum. + // + // If this returns and no errors have been reported, then it is guaranteed that the compiled + // nodes can be found in the SchemaLoader returned by `getLoader()`. + + const SchemaLoader& getLoader() const { return loader; } + SchemaLoader& getLoader() { return loader; } + // Get a SchemaLoader backed by this compiler. Schema nodes will be lazily constructed as you + // traverse them using this loader. + + void clearWorkspace() const; + // The compiler builds a lot of temporary tables and data structures while it works. It's + // useful to keep these around if more work is expected (especially if you are using lazy + // compilation and plan to look up Schema nodes that haven't already been seen), but once + // the SchemaLoader has everything you need, you can call clearWorkspace() to free up the + // temporary space. Note that it's safe to call clearWorkspace() even if you do expect to + // compile more nodes in the future; it may simply lead to redundant work if the discarded + // structures are needed again. + +private: + class Impl; + kj::MutexGuarded<kj::Own<Impl>> impl; + SchemaLoader loader; + + class CompiledModule; + class Node; + class Alias; + + void load(const SchemaLoader& loader, uint64_t id) const override; +}; + +} // namespace compiler +} // namespace capnp + +#endif // CAPNP_COMPILER_COMPILER_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/error-reporter.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/error-reporter.h new file mode 100644 index 0000000..e4a04bf --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/error-reporter.h @@ -0,0 +1,97 @@ +// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef ERROR_REPORTER_H_ +#define ERROR_REPORTER_H_ + +#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) +#pragma GCC system_header +#endif + +#include "../common.h" +#include <kj/string.h> +#include <kj/exception.h> +#include <kj/vector.h> + +namespace capnp { +namespace compiler { + +class ErrorReporter { + // Callback for reporting errors within a particular file. + +public: + virtual void addError(uint32_t startByte, uint32_t endByte, kj::StringPtr message) = 0; + // Report an error at the given location in the input text. `startByte` and `endByte` indicate + // the span of text that is erroneous. They may be equal, in which case the parser was only + // able to identify where the error begins, not where it ends. + + template <typename T> + inline void addErrorOn(T&& decl, kj::StringPtr message) { + // Works for any `T` that defines `getStartByte()` and `getEndByte()` methods, which many + // of the Cap'n Proto types defined in `grammar.capnp` do. + + addError(decl.getStartByte(), decl.getEndByte(), message); + } + + virtual bool hadErrors() = 0; + // Return true if any errors have been reported, globally. The main use case for this callback + // is to inhibit the reporting of errors which may have been caused by previous errors, or to + // allow the compiler to bail out entirely if it gets confused and thinks this could be because + // of previous errors. +}; + +class GlobalErrorReporter { + // Callback for reporting errors in any file. + +public: + struct SourcePos { + uint byte; + uint line; + uint column; + }; + + virtual void addError(kj::StringPtr file, SourcePos start, SourcePos end, + kj::StringPtr message) = 0; + // Report an error at the given location in the given file. + + virtual bool hadErrors() = 0; + // Return true if any errors have been reported, globally. The main use case for this callback + // is to inhibit the reporting of errors which may have been caused by previous errors, or to + // allow the compiler to bail out entirely if it gets confused and thinks this could be because + // of previous errors. +}; + +class LineBreakTable { +public: + LineBreakTable(kj::ArrayPtr<const char> content); + + GlobalErrorReporter::SourcePos toSourcePos(uint32_t byteOffset) const; + +private: + kj::Vector<uint> lineBreaks; + // Byte offsets of the first byte in each source line. The first element is always zero. + // Initialized the first time the module is loaded. +}; + +} // namespace compiler +} // namespace capnp + +#endif // ERROR_REPORTER_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/grammar.capnp.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/grammar.capnp.h new file mode 100644 index 0000000..b89666b --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/grammar.capnp.h @@ -0,0 +1,6837 @@ +// Generated by Cap'n Proto compiler, DO NOT EDIT +// source: grammar.capnp + +#ifndef CAPNP_INCLUDED_c56be168dcbbc3c6_ +#define CAPNP_INCLUDED_c56be168dcbbc3c6_ + +#include <capnp/generated-header-support.h> + +#if CAPNP_VERSION != 7000 +#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." +#endif + + +namespace capnp { +namespace schemas { + +CAPNP_DECLARE_SCHEMA(e75816b56529d464); +CAPNP_DECLARE_SCHEMA(991c7a3693d62cf2); +CAPNP_DECLARE_SCHEMA(90f2a60678fd2367); +CAPNP_DECLARE_SCHEMA(8e207d4dfe54d0de); +CAPNP_DECLARE_SCHEMA(c90246b71adedbaa); +CAPNP_DECLARE_SCHEMA(aee8397040b0df7a); +CAPNP_DECLARE_SCHEMA(aa28e1400d793359); +CAPNP_DECLARE_SCHEMA(96efe787c17e83bb); +CAPNP_DECLARE_SCHEMA(d5e71144af1ce175); +CAPNP_DECLARE_SCHEMA(d00489d473826290); +CAPNP_DECLARE_SCHEMA(fb5aeed95cdf6af9); +CAPNP_DECLARE_SCHEMA(94099c3f9eb32d6b); +CAPNP_DECLARE_SCHEMA(b3f66e7a79d81bcd); +CAPNP_DECLARE_SCHEMA(fffe08a9a697d2a5); +CAPNP_DECLARE_SCHEMA(e5104515fd88ea47); +CAPNP_DECLARE_SCHEMA(89f0c973c103ae96); +CAPNP_DECLARE_SCHEMA(e93164a80bfe2ccf); +CAPNP_DECLARE_SCHEMA(b348322a8dcf0d0c); +CAPNP_DECLARE_SCHEMA(8f2622208fb358c8); +CAPNP_DECLARE_SCHEMA(d0d1a21de617951f); +CAPNP_DECLARE_SCHEMA(992a90eaf30235d3); +CAPNP_DECLARE_SCHEMA(eb971847d617c0b9); +CAPNP_DECLARE_SCHEMA(c6238c7d62d65173); +CAPNP_DECLARE_SCHEMA(9cb9e86e3198037f); +CAPNP_DECLARE_SCHEMA(84e4f3f5a807605c); + +} // namespace schemas +} // namespace capnp + +namespace capnp { +namespace compiler { + +struct LocatedText { + LocatedText() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(e75816b56529d464, 1, 1) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct LocatedInteger { + LocatedInteger() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(991c7a3693d62cf2, 2, 0) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct LocatedFloat { + LocatedFloat() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(90f2a60678fd2367, 2, 0) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Expression { + Expression() = delete; + + class Reader; + class Builder; + class Pipeline; + enum Which: uint16_t { + UNKNOWN, + POSITIVE_INT, + NEGATIVE_INT, + FLOAT, + STRING, + RELATIVE_NAME, + LIST, + TUPLE, + BINARY, + APPLICATION, + MEMBER, + ABSOLUTE_NAME, + IMPORT, + EMBED, + }; + struct Param; + struct Application; + struct Member; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(8e207d4dfe54d0de, 3, 2) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Expression::Param { + Param() = delete; + + class Reader; + class Builder; + class Pipeline; + enum Which: uint16_t { + UNNAMED, + NAMED, + }; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(c90246b71adedbaa, 1, 2) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Expression::Application { + Application() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(aee8397040b0df7a, 3, 2) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Expression::Member { + Member() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(aa28e1400d793359, 3, 2) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration { + Declaration() = delete; + + class Reader; + class Builder; + class Pipeline; + enum Which: uint16_t { + FILE, + USING, + CONST, + ENUM, + ENUMERANT, + STRUCT, + FIELD, + UNION, + GROUP, + INTERFACE, + METHOD, + ANNOTATION, + NAKED_ID, + NAKED_ANNOTATION, + BUILTIN_VOID, + BUILTIN_BOOL, + BUILTIN_INT8, + BUILTIN_INT16, + BUILTIN_INT32, + BUILTIN_INT64, + BUILTIN_U_INT8, + BUILTIN_U_INT16, + BUILTIN_U_INT32, + BUILTIN_U_INT64, + BUILTIN_FLOAT32, + BUILTIN_FLOAT64, + BUILTIN_TEXT, + BUILTIN_DATA, + BUILTIN_LIST, + BUILTIN_OBJECT, + BUILTIN_ANY_POINTER, + BUILTIN_ANY_STRUCT, + BUILTIN_ANY_LIST, + BUILTIN_CAPABILITY, + }; + struct BrandParameter; + struct AnnotationApplication; + struct ParamList; + struct Param; + struct Id; + struct Using; + struct Const; + struct Field; + struct Interface; + struct Method; + struct Annotation; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(96efe787c17e83bb, 2, 8) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::BrandParameter { + BrandParameter() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(d5e71144af1ce175, 1, 1) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::AnnotationApplication { + AnnotationApplication() = delete; + + class Reader; + class Builder; + class Pipeline; + struct Value; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(d00489d473826290, 1, 2) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::AnnotationApplication::Value { + Value() = delete; + + class Reader; + class Builder; + class Pipeline; + enum Which: uint16_t { + NONE, + EXPRESSION, + }; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(fb5aeed95cdf6af9, 1, 2) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::ParamList { + ParamList() = delete; + + class Reader; + class Builder; + class Pipeline; + enum Which: uint16_t { + NAMED_LIST, + TYPE, + }; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(b3f66e7a79d81bcd, 2, 1) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::Param { + Param() = delete; + + class Reader; + class Builder; + class Pipeline; + struct DefaultValue; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(fffe08a9a697d2a5, 2, 4) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::Param::DefaultValue { + DefaultValue() = delete; + + class Reader; + class Builder; + class Pipeline; + enum Which: uint16_t { + NONE, + VALUE, + }; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(e5104515fd88ea47, 2, 4) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::Id { + Id() = delete; + + class Reader; + class Builder; + class Pipeline; + enum Which: uint16_t { + UNSPECIFIED, + UID, + ORDINAL, + }; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(89f0c973c103ae96, 2, 8) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::Using { + Using() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(e93164a80bfe2ccf, 2, 8) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::Const { + Const() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(b348322a8dcf0d0c, 2, 8) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::Field { + Field() = delete; + + class Reader; + class Builder; + class Pipeline; + struct DefaultValue; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(8f2622208fb358c8, 2, 8) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::Field::DefaultValue { + DefaultValue() = delete; + + class Reader; + class Builder; + class Pipeline; + enum Which: uint16_t { + NONE, + VALUE, + }; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(d0d1a21de617951f, 2, 8) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::Interface { + Interface() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(992a90eaf30235d3, 2, 8) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::Method { + Method() = delete; + + class Reader; + class Builder; + class Pipeline; + struct Results; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(eb971847d617c0b9, 2, 8) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::Method::Results { + Results() = delete; + + class Reader; + class Builder; + class Pipeline; + enum Which: uint16_t { + NONE, + EXPLICIT, + }; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(c6238c7d62d65173, 2, 8) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Declaration::Annotation { + Annotation() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(9cb9e86e3198037f, 2, 8) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct ParsedFile { + ParsedFile() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(84e4f3f5a807605c, 0, 1) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +// ======================================================================================= + +class LocatedText::Reader { +public: + typedef LocatedText 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 hasValue() const; + inline ::capnp::Text::Reader getValue() const; + + inline ::uint32_t getStartByte() const; + + inline ::uint32_t getEndByte() 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 LocatedText::Builder { +public: + typedef LocatedText 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 hasValue(); + inline ::capnp::Text::Builder getValue(); + inline void setValue( ::capnp::Text::Reader value); + inline ::capnp::Text::Builder initValue(unsigned int size); + inline void adoptValue(::capnp::Orphan< ::capnp::Text>&& value); + inline ::capnp::Orphan< ::capnp::Text> disownValue(); + + inline ::uint32_t getStartByte(); + inline void setStartByte( ::uint32_t value); + + inline ::uint32_t getEndByte(); + inline void setEndByte( ::uint32_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 LocatedText::Pipeline { +public: + typedef LocatedText 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 LocatedInteger::Reader { +public: + typedef LocatedInteger 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 ::uint64_t getValue() const; + + inline ::uint32_t getStartByte() const; + + inline ::uint32_t getEndByte() 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 LocatedInteger::Builder { +public: + typedef LocatedInteger 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 ::uint64_t getValue(); + inline void setValue( ::uint64_t value); + + inline ::uint32_t getStartByte(); + inline void setStartByte( ::uint32_t value); + + inline ::uint32_t getEndByte(); + inline void setEndByte( ::uint32_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 LocatedInteger::Pipeline { +public: + typedef LocatedInteger 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 LocatedFloat::Reader { +public: + typedef LocatedFloat 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 double getValue() const; + + inline ::uint32_t getStartByte() const; + + inline ::uint32_t getEndByte() 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 LocatedFloat::Builder { +public: + typedef LocatedFloat 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 double getValue(); + inline void setValue(double value); + + inline ::uint32_t getStartByte(); + inline void setStartByte( ::uint32_t value); + + inline ::uint32_t getEndByte(); + inline void setEndByte( ::uint32_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 LocatedFloat::Pipeline { +public: + typedef LocatedFloat 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 Expression::Reader { +public: + typedef Expression 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 Which which() const; + inline bool isUnknown() const; + inline ::capnp::Void getUnknown() const; + + inline bool isPositiveInt() const; + inline ::uint64_t getPositiveInt() const; + + inline bool isNegativeInt() const; + inline ::uint64_t getNegativeInt() const; + + inline bool isFloat() const; + inline double getFloat() const; + + inline bool isString() const; + inline bool hasString() const; + inline ::capnp::Text::Reader getString() const; + + inline bool isRelativeName() const; + inline bool hasRelativeName() const; + inline ::capnp::compiler::LocatedText::Reader getRelativeName() const; + + inline bool isList() const; + inline bool hasList() const; + inline ::capnp::List< ::capnp::compiler::Expression>::Reader getList() const; + + inline bool isTuple() const; + inline bool hasTuple() const; + inline ::capnp::List< ::capnp::compiler::Expression::Param>::Reader getTuple() const; + + inline ::uint32_t getStartByte() const; + + inline ::uint32_t getEndByte() const; + + inline bool isBinary() const; + inline bool hasBinary() const; + inline ::capnp::Data::Reader getBinary() const; + + inline bool isApplication() const; + inline typename Application::Reader getApplication() const; + + inline bool isMember() const; + inline typename Member::Reader getMember() const; + + inline bool isAbsoluteName() const; + inline bool hasAbsoluteName() const; + inline ::capnp::compiler::LocatedText::Reader getAbsoluteName() const; + + inline bool isImport() const; + inline bool hasImport() const; + inline ::capnp::compiler::LocatedText::Reader getImport() const; + + inline bool isEmbed() const; + inline bool hasEmbed() const; + inline ::capnp::compiler::LocatedText::Reader getEmbed() 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 Expression::Builder { +public: + typedef Expression 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 Which which(); + inline bool isUnknown(); + inline ::capnp::Void getUnknown(); + inline void setUnknown( ::capnp::Void value = ::capnp::VOID); + + inline bool isPositiveInt(); + inline ::uint64_t getPositiveInt(); + inline void setPositiveInt( ::uint64_t value); + + inline bool isNegativeInt(); + inline ::uint64_t getNegativeInt(); + inline void setNegativeInt( ::uint64_t value); + + inline bool isFloat(); + inline double getFloat(); + inline void setFloat(double value); + + inline bool isString(); + inline bool hasString(); + inline ::capnp::Text::Builder getString(); + inline void setString( ::capnp::Text::Reader value); + inline ::capnp::Text::Builder initString(unsigned int size); + inline void adoptString(::capnp::Orphan< ::capnp::Text>&& value); + inline ::capnp::Orphan< ::capnp::Text> disownString(); + + inline bool isRelativeName(); + inline bool hasRelativeName(); + inline ::capnp::compiler::LocatedText::Builder getRelativeName(); + inline void setRelativeName( ::capnp::compiler::LocatedText::Reader value); + inline ::capnp::compiler::LocatedText::Builder initRelativeName(); + inline void adoptRelativeName(::capnp::Orphan< ::capnp::compiler::LocatedText>&& value); + inline ::capnp::Orphan< ::capnp::compiler::LocatedText> disownRelativeName(); + + inline bool isList(); + inline bool hasList(); + inline ::capnp::List< ::capnp::compiler::Expression>::Builder getList(); + inline void setList( ::capnp::List< ::capnp::compiler::Expression>::Reader value); + inline ::capnp::List< ::capnp::compiler::Expression>::Builder initList(unsigned int size); + inline void adoptList(::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression>> disownList(); + + inline bool isTuple(); + inline bool hasTuple(); + inline ::capnp::List< ::capnp::compiler::Expression::Param>::Builder getTuple(); + inline void setTuple( ::capnp::List< ::capnp::compiler::Expression::Param>::Reader value); + inline ::capnp::List< ::capnp::compiler::Expression::Param>::Builder initTuple(unsigned int size); + inline void adoptTuple(::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression::Param>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression::Param>> disownTuple(); + + inline ::uint32_t getStartByte(); + inline void setStartByte( ::uint32_t value); + + inline ::uint32_t getEndByte(); + inline void setEndByte( ::uint32_t value); + + inline bool isBinary(); + inline bool hasBinary(); + inline ::capnp::Data::Builder getBinary(); + inline void setBinary( ::capnp::Data::Reader value); + inline ::capnp::Data::Builder initBinary(unsigned int size); + inline void adoptBinary(::capnp::Orphan< ::capnp::Data>&& value); + inline ::capnp::Orphan< ::capnp::Data> disownBinary(); + + inline bool isApplication(); + inline typename Application::Builder getApplication(); + inline typename Application::Builder initApplication(); + + inline bool isMember(); + inline typename Member::Builder getMember(); + inline typename Member::Builder initMember(); + + inline bool isAbsoluteName(); + inline bool hasAbsoluteName(); + inline ::capnp::compiler::LocatedText::Builder getAbsoluteName(); + inline void setAbsoluteName( ::capnp::compiler::LocatedText::Reader value); + inline ::capnp::compiler::LocatedText::Builder initAbsoluteName(); + inline void adoptAbsoluteName(::capnp::Orphan< ::capnp::compiler::LocatedText>&& value); + inline ::capnp::Orphan< ::capnp::compiler::LocatedText> disownAbsoluteName(); + + inline bool isImport(); + inline bool hasImport(); + inline ::capnp::compiler::LocatedText::Builder getImport(); + inline void setImport( ::capnp::compiler::LocatedText::Reader value); + inline ::capnp::compiler::LocatedText::Builder initImport(); + inline void adoptImport(::capnp::Orphan< ::capnp::compiler::LocatedText>&& value); + inline ::capnp::Orphan< ::capnp::compiler::LocatedText> disownImport(); + + inline bool isEmbed(); + inline bool hasEmbed(); + inline ::capnp::compiler::LocatedText::Builder getEmbed(); + inline void setEmbed( ::capnp::compiler::LocatedText::Reader value); + inline ::capnp::compiler::LocatedText::Builder initEmbed(); + inline void adoptEmbed(::capnp::Orphan< ::capnp::compiler::LocatedText>&& value); + inline ::capnp::Orphan< ::capnp::compiler::LocatedText> disownEmbed(); + +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 Expression::Pipeline { +public: + typedef Expression 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 Expression::Param::Reader { +public: + typedef Param 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 Which which() const; + inline bool isUnnamed() const; + inline ::capnp::Void getUnnamed() const; + + inline bool isNamed() const; + inline bool hasNamed() const; + inline ::capnp::compiler::LocatedText::Reader getNamed() const; + + inline bool hasValue() const; + inline ::capnp::compiler::Expression::Reader getValue() 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 Expression::Param::Builder { +public: + typedef Param 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 Which which(); + inline bool isUnnamed(); + inline ::capnp::Void getUnnamed(); + inline void setUnnamed( ::capnp::Void value = ::capnp::VOID); + + inline bool isNamed(); + inline bool hasNamed(); + inline ::capnp::compiler::LocatedText::Builder getNamed(); + inline void setNamed( ::capnp::compiler::LocatedText::Reader value); + inline ::capnp::compiler::LocatedText::Builder initNamed(); + inline void adoptNamed(::capnp::Orphan< ::capnp::compiler::LocatedText>&& value); + inline ::capnp::Orphan< ::capnp::compiler::LocatedText> disownNamed(); + + inline bool hasValue(); + inline ::capnp::compiler::Expression::Builder getValue(); + inline void setValue( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initValue(); + inline void adoptValue(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownValue(); + +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 Expression::Param::Pipeline { +public: + typedef Param Pipelines; + + inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) {} + + inline ::capnp::compiler::Expression::Pipeline getValue(); +private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class Expression::Application::Reader { +public: + typedef Application 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 hasFunction() const; + inline ::capnp::compiler::Expression::Reader getFunction() const; + + inline bool hasParams() const; + inline ::capnp::List< ::capnp::compiler::Expression::Param>::Reader getParams() 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 Expression::Application::Builder { +public: + typedef Application 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 hasFunction(); + inline ::capnp::compiler::Expression::Builder getFunction(); + inline void setFunction( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initFunction(); + inline void adoptFunction(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownFunction(); + + inline bool hasParams(); + inline ::capnp::List< ::capnp::compiler::Expression::Param>::Builder getParams(); + inline void setParams( ::capnp::List< ::capnp::compiler::Expression::Param>::Reader value); + inline ::capnp::List< ::capnp::compiler::Expression::Param>::Builder initParams(unsigned int size); + inline void adoptParams(::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression::Param>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression::Param>> disownParams(); + +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 Expression::Application::Pipeline { +public: + typedef Application Pipelines; + + inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) {} + + inline ::capnp::compiler::Expression::Pipeline getFunction(); +private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class Expression::Member::Reader { +public: + typedef Member 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 hasParent() const; + inline ::capnp::compiler::Expression::Reader getParent() const; + + inline bool hasName() const; + inline ::capnp::compiler::LocatedText::Reader getName() 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 Expression::Member::Builder { +public: + typedef Member 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 hasParent(); + inline ::capnp::compiler::Expression::Builder getParent(); + inline void setParent( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initParent(); + inline void adoptParent(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownParent(); + + inline bool hasName(); + inline ::capnp::compiler::LocatedText::Builder getName(); + inline void setName( ::capnp::compiler::LocatedText::Reader value); + inline ::capnp::compiler::LocatedText::Builder initName(); + inline void adoptName(::capnp::Orphan< ::capnp::compiler::LocatedText>&& value); + inline ::capnp::Orphan< ::capnp::compiler::LocatedText> disownName(); + +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 Expression::Member::Pipeline { +public: + typedef Member Pipelines; + + inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) {} + + inline ::capnp::compiler::Expression::Pipeline getParent(); + inline ::capnp::compiler::LocatedText::Pipeline getName(); +private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class Declaration::Reader { +public: + typedef Declaration 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 Which which() const; + inline bool hasName() const; + inline ::capnp::compiler::LocatedText::Reader getName() const; + + inline typename Id::Reader getId() const; + + inline bool hasNestedDecls() const; + inline ::capnp::List< ::capnp::compiler::Declaration>::Reader getNestedDecls() const; + + inline bool hasAnnotations() const; + inline ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Reader getAnnotations() const; + + inline ::uint32_t getStartByte() const; + + inline ::uint32_t getEndByte() const; + + inline bool hasDocComment() const; + inline ::capnp::Text::Reader getDocComment() const; + + inline bool isFile() const; + inline ::capnp::Void getFile() const; + + inline bool isUsing() const; + inline typename Using::Reader getUsing() const; + + inline bool isConst() const; + inline typename Const::Reader getConst() const; + + inline bool isEnum() const; + inline ::capnp::Void getEnum() const; + + inline bool isEnumerant() const; + inline ::capnp::Void getEnumerant() const; + + inline bool isStruct() const; + inline ::capnp::Void getStruct() const; + + inline bool isField() const; + inline typename Field::Reader getField() const; + + inline bool isUnion() const; + inline ::capnp::Void getUnion() const; + + inline bool isGroup() const; + inline ::capnp::Void getGroup() const; + + inline bool isInterface() const; + inline typename Interface::Reader getInterface() const; + + inline bool isMethod() const; + inline typename Method::Reader getMethod() const; + + inline bool isAnnotation() const; + inline typename Annotation::Reader getAnnotation() const; + + inline bool isNakedId() const; + inline bool hasNakedId() const; + inline ::capnp::compiler::LocatedInteger::Reader getNakedId() const; + + inline bool isNakedAnnotation() const; + inline bool hasNakedAnnotation() const; + inline ::capnp::compiler::Declaration::AnnotationApplication::Reader getNakedAnnotation() const; + + inline bool isBuiltinVoid() const; + inline ::capnp::Void getBuiltinVoid() const; + + inline bool isBuiltinBool() const; + inline ::capnp::Void getBuiltinBool() const; + + inline bool isBuiltinInt8() const; + inline ::capnp::Void getBuiltinInt8() const; + + inline bool isBuiltinInt16() const; + inline ::capnp::Void getBuiltinInt16() const; + + inline bool isBuiltinInt32() const; + inline ::capnp::Void getBuiltinInt32() const; + + inline bool isBuiltinInt64() const; + inline ::capnp::Void getBuiltinInt64() const; + + inline bool isBuiltinUInt8() const; + inline ::capnp::Void getBuiltinUInt8() const; + + inline bool isBuiltinUInt16() const; + inline ::capnp::Void getBuiltinUInt16() const; + + inline bool isBuiltinUInt32() const; + inline ::capnp::Void getBuiltinUInt32() const; + + inline bool isBuiltinUInt64() const; + inline ::capnp::Void getBuiltinUInt64() const; + + inline bool isBuiltinFloat32() const; + inline ::capnp::Void getBuiltinFloat32() const; + + inline bool isBuiltinFloat64() const; + inline ::capnp::Void getBuiltinFloat64() const; + + inline bool isBuiltinText() const; + inline ::capnp::Void getBuiltinText() const; + + inline bool isBuiltinData() const; + inline ::capnp::Void getBuiltinData() const; + + inline bool isBuiltinList() const; + inline ::capnp::Void getBuiltinList() const; + + inline bool isBuiltinObject() const; + inline ::capnp::Void getBuiltinObject() const; + + inline bool isBuiltinAnyPointer() const; + inline ::capnp::Void getBuiltinAnyPointer() const; + + inline bool hasParameters() const; + inline ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>::Reader getParameters() const; + + inline bool isBuiltinAnyStruct() const; + inline ::capnp::Void getBuiltinAnyStruct() const; + + inline bool isBuiltinAnyList() const; + inline ::capnp::Void getBuiltinAnyList() const; + + inline bool isBuiltinCapability() const; + inline ::capnp::Void getBuiltinCapability() 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 Declaration::Builder { +public: + typedef Declaration 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 Which which(); + inline bool hasName(); + inline ::capnp::compiler::LocatedText::Builder getName(); + inline void setName( ::capnp::compiler::LocatedText::Reader value); + inline ::capnp::compiler::LocatedText::Builder initName(); + inline void adoptName(::capnp::Orphan< ::capnp::compiler::LocatedText>&& value); + inline ::capnp::Orphan< ::capnp::compiler::LocatedText> disownName(); + + inline typename Id::Builder getId(); + inline typename Id::Builder initId(); + + inline bool hasNestedDecls(); + inline ::capnp::List< ::capnp::compiler::Declaration>::Builder getNestedDecls(); + inline void setNestedDecls( ::capnp::List< ::capnp::compiler::Declaration>::Reader value); + inline ::capnp::List< ::capnp::compiler::Declaration>::Builder initNestedDecls(unsigned int size); + inline void adoptNestedDecls(::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration>> disownNestedDecls(); + + inline bool hasAnnotations(); + inline ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Builder getAnnotations(); + inline void setAnnotations( ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Reader value); + inline ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Builder initAnnotations(unsigned int size); + inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>> disownAnnotations(); + + inline ::uint32_t getStartByte(); + inline void setStartByte( ::uint32_t value); + + inline ::uint32_t getEndByte(); + inline void setEndByte( ::uint32_t value); + + inline bool hasDocComment(); + inline ::capnp::Text::Builder getDocComment(); + inline void setDocComment( ::capnp::Text::Reader value); + inline ::capnp::Text::Builder initDocComment(unsigned int size); + inline void adoptDocComment(::capnp::Orphan< ::capnp::Text>&& value); + inline ::capnp::Orphan< ::capnp::Text> disownDocComment(); + + inline bool isFile(); + inline ::capnp::Void getFile(); + inline void setFile( ::capnp::Void value = ::capnp::VOID); + + inline bool isUsing(); + inline typename Using::Builder getUsing(); + inline typename Using::Builder initUsing(); + + inline bool isConst(); + inline typename Const::Builder getConst(); + inline typename Const::Builder initConst(); + + inline bool isEnum(); + inline ::capnp::Void getEnum(); + inline void setEnum( ::capnp::Void value = ::capnp::VOID); + + inline bool isEnumerant(); + inline ::capnp::Void getEnumerant(); + inline void setEnumerant( ::capnp::Void value = ::capnp::VOID); + + inline bool isStruct(); + inline ::capnp::Void getStruct(); + inline void setStruct( ::capnp::Void value = ::capnp::VOID); + + inline bool isField(); + inline typename Field::Builder getField(); + inline typename Field::Builder initField(); + + inline bool isUnion(); + inline ::capnp::Void getUnion(); + inline void setUnion( ::capnp::Void value = ::capnp::VOID); + + inline bool isGroup(); + inline ::capnp::Void getGroup(); + inline void setGroup( ::capnp::Void value = ::capnp::VOID); + + inline bool isInterface(); + inline typename Interface::Builder getInterface(); + inline typename Interface::Builder initInterface(); + + inline bool isMethod(); + inline typename Method::Builder getMethod(); + inline typename Method::Builder initMethod(); + + inline bool isAnnotation(); + inline typename Annotation::Builder getAnnotation(); + inline typename Annotation::Builder initAnnotation(); + + inline bool isNakedId(); + inline bool hasNakedId(); + inline ::capnp::compiler::LocatedInteger::Builder getNakedId(); + inline void setNakedId( ::capnp::compiler::LocatedInteger::Reader value); + inline ::capnp::compiler::LocatedInteger::Builder initNakedId(); + inline void adoptNakedId(::capnp::Orphan< ::capnp::compiler::LocatedInteger>&& value); + inline ::capnp::Orphan< ::capnp::compiler::LocatedInteger> disownNakedId(); + + inline bool isNakedAnnotation(); + inline bool hasNakedAnnotation(); + inline ::capnp::compiler::Declaration::AnnotationApplication::Builder getNakedAnnotation(); + inline void setNakedAnnotation( ::capnp::compiler::Declaration::AnnotationApplication::Reader value); + inline ::capnp::compiler::Declaration::AnnotationApplication::Builder initNakedAnnotation(); + inline void adoptNakedAnnotation(::capnp::Orphan< ::capnp::compiler::Declaration::AnnotationApplication>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Declaration::AnnotationApplication> disownNakedAnnotation(); + + inline bool isBuiltinVoid(); + inline ::capnp::Void getBuiltinVoid(); + inline void setBuiltinVoid( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinBool(); + inline ::capnp::Void getBuiltinBool(); + inline void setBuiltinBool( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinInt8(); + inline ::capnp::Void getBuiltinInt8(); + inline void setBuiltinInt8( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinInt16(); + inline ::capnp::Void getBuiltinInt16(); + inline void setBuiltinInt16( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinInt32(); + inline ::capnp::Void getBuiltinInt32(); + inline void setBuiltinInt32( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinInt64(); + inline ::capnp::Void getBuiltinInt64(); + inline void setBuiltinInt64( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinUInt8(); + inline ::capnp::Void getBuiltinUInt8(); + inline void setBuiltinUInt8( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinUInt16(); + inline ::capnp::Void getBuiltinUInt16(); + inline void setBuiltinUInt16( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinUInt32(); + inline ::capnp::Void getBuiltinUInt32(); + inline void setBuiltinUInt32( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinUInt64(); + inline ::capnp::Void getBuiltinUInt64(); + inline void setBuiltinUInt64( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinFloat32(); + inline ::capnp::Void getBuiltinFloat32(); + inline void setBuiltinFloat32( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinFloat64(); + inline ::capnp::Void getBuiltinFloat64(); + inline void setBuiltinFloat64( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinText(); + inline ::capnp::Void getBuiltinText(); + inline void setBuiltinText( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinData(); + inline ::capnp::Void getBuiltinData(); + inline void setBuiltinData( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinList(); + inline ::capnp::Void getBuiltinList(); + inline void setBuiltinList( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinObject(); + inline ::capnp::Void getBuiltinObject(); + inline void setBuiltinObject( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinAnyPointer(); + inline ::capnp::Void getBuiltinAnyPointer(); + inline void setBuiltinAnyPointer( ::capnp::Void value = ::capnp::VOID); + + inline bool hasParameters(); + inline ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>::Builder getParameters(); + inline void setParameters( ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>::Reader value); + inline ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>::Builder initParameters(unsigned int size); + inline void adoptParameters(::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>> disownParameters(); + + inline bool isBuiltinAnyStruct(); + inline ::capnp::Void getBuiltinAnyStruct(); + inline void setBuiltinAnyStruct( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinAnyList(); + inline ::capnp::Void getBuiltinAnyList(); + inline void setBuiltinAnyList( ::capnp::Void value = ::capnp::VOID); + + inline bool isBuiltinCapability(); + inline ::capnp::Void getBuiltinCapability(); + inline void setBuiltinCapability( ::capnp::Void value = ::capnp::VOID); + +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 Declaration::Pipeline { +public: + typedef Declaration Pipelines; + + inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) {} + + inline ::capnp::compiler::LocatedText::Pipeline getName(); + inline typename Id::Pipeline getId(); +private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class Declaration::BrandParameter::Reader { +public: + typedef BrandParameter 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 hasName() const; + inline ::capnp::Text::Reader getName() const; + + inline ::uint32_t getStartByte() const; + + inline ::uint32_t getEndByte() 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 Declaration::BrandParameter::Builder { +public: + typedef BrandParameter 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 hasName(); + inline ::capnp::Text::Builder getName(); + inline void setName( ::capnp::Text::Reader value); + inline ::capnp::Text::Builder initName(unsigned int size); + inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); + inline ::capnp::Orphan< ::capnp::Text> disownName(); + + inline ::uint32_t getStartByte(); + inline void setStartByte( ::uint32_t value); + + inline ::uint32_t getEndByte(); + inline void setEndByte( ::uint32_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 Declaration::BrandParameter::Pipeline { +public: + typedef BrandParameter 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 Declaration::AnnotationApplication::Reader { +public: + typedef AnnotationApplication 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 hasName() const; + inline ::capnp::compiler::Expression::Reader getName() const; + + inline typename Value::Reader getValue() 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 Declaration::AnnotationApplication::Builder { +public: + typedef AnnotationApplication 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 hasName(); + inline ::capnp::compiler::Expression::Builder getName(); + inline void setName( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initName(); + inline void adoptName(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownName(); + + inline typename Value::Builder getValue(); + inline typename Value::Builder initValue(); + +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 Declaration::AnnotationApplication::Pipeline { +public: + typedef AnnotationApplication Pipelines; + + inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) {} + + inline ::capnp::compiler::Expression::Pipeline getName(); + inline typename Value::Pipeline getValue(); +private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class Declaration::AnnotationApplication::Value::Reader { +public: + typedef Value 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 Which which() const; + inline bool isNone() const; + inline ::capnp::Void getNone() const; + + inline bool isExpression() const; + inline bool hasExpression() const; + inline ::capnp::compiler::Expression::Reader getExpression() 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 Declaration::AnnotationApplication::Value::Builder { +public: + typedef Value 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 Which which(); + inline bool isNone(); + inline ::capnp::Void getNone(); + inline void setNone( ::capnp::Void value = ::capnp::VOID); + + inline bool isExpression(); + inline bool hasExpression(); + inline ::capnp::compiler::Expression::Builder getExpression(); + inline void setExpression( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initExpression(); + inline void adoptExpression(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownExpression(); + +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 Declaration::AnnotationApplication::Value::Pipeline { +public: + typedef Value 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 Declaration::ParamList::Reader { +public: + typedef ParamList 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 Which which() const; + inline bool isNamedList() const; + inline bool hasNamedList() const; + inline ::capnp::List< ::capnp::compiler::Declaration::Param>::Reader getNamedList() const; + + inline bool isType() const; + inline bool hasType() const; + inline ::capnp::compiler::Expression::Reader getType() const; + + inline ::uint32_t getStartByte() const; + + inline ::uint32_t getEndByte() 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 Declaration::ParamList::Builder { +public: + typedef ParamList 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 Which which(); + inline bool isNamedList(); + inline bool hasNamedList(); + inline ::capnp::List< ::capnp::compiler::Declaration::Param>::Builder getNamedList(); + inline void setNamedList( ::capnp::List< ::capnp::compiler::Declaration::Param>::Reader value); + inline ::capnp::List< ::capnp::compiler::Declaration::Param>::Builder initNamedList(unsigned int size); + inline void adoptNamedList(::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::Param>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::Param>> disownNamedList(); + + inline bool isType(); + inline bool hasType(); + inline ::capnp::compiler::Expression::Builder getType(); + inline void setType( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initType(); + inline void adoptType(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownType(); + + inline ::uint32_t getStartByte(); + inline void setStartByte( ::uint32_t value); + + inline ::uint32_t getEndByte(); + inline void setEndByte( ::uint32_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 Declaration::ParamList::Pipeline { +public: + typedef ParamList 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 Declaration::Param::Reader { +public: + typedef Param 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 hasName() const; + inline ::capnp::compiler::LocatedText::Reader getName() const; + + inline bool hasType() const; + inline ::capnp::compiler::Expression::Reader getType() const; + + inline bool hasAnnotations() const; + inline ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Reader getAnnotations() const; + + inline typename DefaultValue::Reader getDefaultValue() const; + + inline ::uint32_t getStartByte() const; + + inline ::uint32_t getEndByte() 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 Declaration::Param::Builder { +public: + typedef Param 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 hasName(); + inline ::capnp::compiler::LocatedText::Builder getName(); + inline void setName( ::capnp::compiler::LocatedText::Reader value); + inline ::capnp::compiler::LocatedText::Builder initName(); + inline void adoptName(::capnp::Orphan< ::capnp::compiler::LocatedText>&& value); + inline ::capnp::Orphan< ::capnp::compiler::LocatedText> disownName(); + + inline bool hasType(); + inline ::capnp::compiler::Expression::Builder getType(); + inline void setType( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initType(); + inline void adoptType(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownType(); + + inline bool hasAnnotations(); + inline ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Builder getAnnotations(); + inline void setAnnotations( ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Reader value); + inline ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Builder initAnnotations(unsigned int size); + inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>> disownAnnotations(); + + inline typename DefaultValue::Builder getDefaultValue(); + inline typename DefaultValue::Builder initDefaultValue(); + + inline ::uint32_t getStartByte(); + inline void setStartByte( ::uint32_t value); + + inline ::uint32_t getEndByte(); + inline void setEndByte( ::uint32_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 Declaration::Param::Pipeline { +public: + typedef Param Pipelines; + + inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) {} + + inline ::capnp::compiler::LocatedText::Pipeline getName(); + inline ::capnp::compiler::Expression::Pipeline getType(); + inline typename DefaultValue::Pipeline getDefaultValue(); +private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class Declaration::Param::DefaultValue::Reader { +public: + typedef DefaultValue 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 Which which() const; + inline bool isNone() const; + inline ::capnp::Void getNone() const; + + inline bool isValue() const; + inline bool hasValue() const; + inline ::capnp::compiler::Expression::Reader getValue() 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 Declaration::Param::DefaultValue::Builder { +public: + typedef DefaultValue 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 Which which(); + inline bool isNone(); + inline ::capnp::Void getNone(); + inline void setNone( ::capnp::Void value = ::capnp::VOID); + + inline bool isValue(); + inline bool hasValue(); + inline ::capnp::compiler::Expression::Builder getValue(); + inline void setValue( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initValue(); + inline void adoptValue(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownValue(); + +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 Declaration::Param::DefaultValue::Pipeline { +public: + typedef DefaultValue 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 Declaration::Id::Reader { +public: + typedef Id 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 Which which() const; + inline bool isUnspecified() const; + inline ::capnp::Void getUnspecified() const; + + inline bool isUid() const; + inline bool hasUid() const; + inline ::capnp::compiler::LocatedInteger::Reader getUid() const; + + inline bool isOrdinal() const; + inline bool hasOrdinal() const; + inline ::capnp::compiler::LocatedInteger::Reader getOrdinal() 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 Declaration::Id::Builder { +public: + typedef Id 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 Which which(); + inline bool isUnspecified(); + inline ::capnp::Void getUnspecified(); + inline void setUnspecified( ::capnp::Void value = ::capnp::VOID); + + inline bool isUid(); + inline bool hasUid(); + inline ::capnp::compiler::LocatedInteger::Builder getUid(); + inline void setUid( ::capnp::compiler::LocatedInteger::Reader value); + inline ::capnp::compiler::LocatedInteger::Builder initUid(); + inline void adoptUid(::capnp::Orphan< ::capnp::compiler::LocatedInteger>&& value); + inline ::capnp::Orphan< ::capnp::compiler::LocatedInteger> disownUid(); + + inline bool isOrdinal(); + inline bool hasOrdinal(); + inline ::capnp::compiler::LocatedInteger::Builder getOrdinal(); + inline void setOrdinal( ::capnp::compiler::LocatedInteger::Reader value); + inline ::capnp::compiler::LocatedInteger::Builder initOrdinal(); + inline void adoptOrdinal(::capnp::Orphan< ::capnp::compiler::LocatedInteger>&& value); + inline ::capnp::Orphan< ::capnp::compiler::LocatedInteger> disownOrdinal(); + +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 Declaration::Id::Pipeline { +public: + typedef Id 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 Declaration::Using::Reader { +public: + typedef Using 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 hasTarget() const; + inline ::capnp::compiler::Expression::Reader getTarget() 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 Declaration::Using::Builder { +public: + typedef Using 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 hasTarget(); + inline ::capnp::compiler::Expression::Builder getTarget(); + inline void setTarget( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initTarget(); + inline void adoptTarget(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownTarget(); + +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 Declaration::Using::Pipeline { +public: + typedef Using Pipelines; + + inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) {} + + inline ::capnp::compiler::Expression::Pipeline getTarget(); +private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class Declaration::Const::Reader { +public: + typedef Const 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 hasType() const; + inline ::capnp::compiler::Expression::Reader getType() const; + + inline bool hasValue() const; + inline ::capnp::compiler::Expression::Reader getValue() 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 Declaration::Const::Builder { +public: + typedef Const 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 hasType(); + inline ::capnp::compiler::Expression::Builder getType(); + inline void setType( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initType(); + inline void adoptType(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownType(); + + inline bool hasValue(); + inline ::capnp::compiler::Expression::Builder getValue(); + inline void setValue( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initValue(); + inline void adoptValue(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownValue(); + +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 Declaration::Const::Pipeline { +public: + typedef Const Pipelines; + + inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) {} + + inline ::capnp::compiler::Expression::Pipeline getType(); + inline ::capnp::compiler::Expression::Pipeline getValue(); +private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class Declaration::Field::Reader { +public: + typedef Field 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 hasType() const; + inline ::capnp::compiler::Expression::Reader getType() const; + + inline typename DefaultValue::Reader getDefaultValue() 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 Declaration::Field::Builder { +public: + typedef Field 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 hasType(); + inline ::capnp::compiler::Expression::Builder getType(); + inline void setType( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initType(); + inline void adoptType(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownType(); + + inline typename DefaultValue::Builder getDefaultValue(); + inline typename DefaultValue::Builder initDefaultValue(); + +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 Declaration::Field::Pipeline { +public: + typedef Field Pipelines; + + inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) {} + + inline ::capnp::compiler::Expression::Pipeline getType(); + inline typename DefaultValue::Pipeline getDefaultValue(); +private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class Declaration::Field::DefaultValue::Reader { +public: + typedef DefaultValue 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 Which which() const; + inline bool isNone() const; + inline ::capnp::Void getNone() const; + + inline bool isValue() const; + inline bool hasValue() const; + inline ::capnp::compiler::Expression::Reader getValue() 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 Declaration::Field::DefaultValue::Builder { +public: + typedef DefaultValue 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 Which which(); + inline bool isNone(); + inline ::capnp::Void getNone(); + inline void setNone( ::capnp::Void value = ::capnp::VOID); + + inline bool isValue(); + inline bool hasValue(); + inline ::capnp::compiler::Expression::Builder getValue(); + inline void setValue( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initValue(); + inline void adoptValue(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownValue(); + +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 Declaration::Field::DefaultValue::Pipeline { +public: + typedef DefaultValue 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 Declaration::Interface::Reader { +public: + typedef Interface 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 hasSuperclasses() const; + inline ::capnp::List< ::capnp::compiler::Expression>::Reader getSuperclasses() 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 Declaration::Interface::Builder { +public: + typedef Interface 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 hasSuperclasses(); + inline ::capnp::List< ::capnp::compiler::Expression>::Builder getSuperclasses(); + inline void setSuperclasses( ::capnp::List< ::capnp::compiler::Expression>::Reader value); + inline ::capnp::List< ::capnp::compiler::Expression>::Builder initSuperclasses(unsigned int size); + inline void adoptSuperclasses(::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression>> disownSuperclasses(); + +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 Declaration::Interface::Pipeline { +public: + typedef Interface 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 Declaration::Method::Reader { +public: + typedef Method 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 hasParams() const; + inline ::capnp::compiler::Declaration::ParamList::Reader getParams() const; + + inline typename Results::Reader getResults() 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 Declaration::Method::Builder { +public: + typedef Method 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 hasParams(); + inline ::capnp::compiler::Declaration::ParamList::Builder getParams(); + inline void setParams( ::capnp::compiler::Declaration::ParamList::Reader value); + inline ::capnp::compiler::Declaration::ParamList::Builder initParams(); + inline void adoptParams(::capnp::Orphan< ::capnp::compiler::Declaration::ParamList>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Declaration::ParamList> disownParams(); + + inline typename Results::Builder getResults(); + inline typename Results::Builder initResults(); + +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 Declaration::Method::Pipeline { +public: + typedef Method Pipelines; + + inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) {} + + inline ::capnp::compiler::Declaration::ParamList::Pipeline getParams(); + inline typename Results::Pipeline getResults(); +private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class Declaration::Method::Results::Reader { +public: + typedef Results 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 Which which() const; + inline bool isNone() const; + inline ::capnp::Void getNone() const; + + inline bool isExplicit() const; + inline bool hasExplicit() const; + inline ::capnp::compiler::Declaration::ParamList::Reader getExplicit() 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 Declaration::Method::Results::Builder { +public: + typedef Results 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 Which which(); + inline bool isNone(); + inline ::capnp::Void getNone(); + inline void setNone( ::capnp::Void value = ::capnp::VOID); + + inline bool isExplicit(); + inline bool hasExplicit(); + inline ::capnp::compiler::Declaration::ParamList::Builder getExplicit(); + inline void setExplicit( ::capnp::compiler::Declaration::ParamList::Reader value); + inline ::capnp::compiler::Declaration::ParamList::Builder initExplicit(); + inline void adoptExplicit(::capnp::Orphan< ::capnp::compiler::Declaration::ParamList>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Declaration::ParamList> disownExplicit(); + +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 Declaration::Method::Results::Pipeline { +public: + typedef Results 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 Declaration::Annotation::Reader { +public: + typedef Annotation 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 hasType() const; + inline ::capnp::compiler::Expression::Reader getType() const; + + inline bool getTargetsFile() const; + + inline bool getTargetsConst() const; + + inline bool getTargetsEnum() const; + + inline bool getTargetsEnumerant() const; + + inline bool getTargetsStruct() const; + + inline bool getTargetsField() const; + + inline bool getTargetsUnion() const; + + inline bool getTargetsGroup() const; + + inline bool getTargetsInterface() const; + + inline bool getTargetsMethod() const; + + inline bool getTargetsParam() const; + + inline bool getTargetsAnnotation() 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 Declaration::Annotation::Builder { +public: + typedef Annotation 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 hasType(); + inline ::capnp::compiler::Expression::Builder getType(); + inline void setType( ::capnp::compiler::Expression::Reader value); + inline ::capnp::compiler::Expression::Builder initType(); + inline void adoptType(::capnp::Orphan< ::capnp::compiler::Expression>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Expression> disownType(); + + inline bool getTargetsFile(); + inline void setTargetsFile(bool value); + + inline bool getTargetsConst(); + inline void setTargetsConst(bool value); + + inline bool getTargetsEnum(); + inline void setTargetsEnum(bool value); + + inline bool getTargetsEnumerant(); + inline void setTargetsEnumerant(bool value); + + inline bool getTargetsStruct(); + inline void setTargetsStruct(bool value); + + inline bool getTargetsField(); + inline void setTargetsField(bool value); + + inline bool getTargetsUnion(); + inline void setTargetsUnion(bool value); + + inline bool getTargetsGroup(); + inline void setTargetsGroup(bool value); + + inline bool getTargetsInterface(); + inline void setTargetsInterface(bool value); + + inline bool getTargetsMethod(); + inline void setTargetsMethod(bool value); + + inline bool getTargetsParam(); + inline void setTargetsParam(bool value); + + inline bool getTargetsAnnotation(); + inline void setTargetsAnnotation(bool 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 Declaration::Annotation::Pipeline { +public: + typedef Annotation Pipelines; + + inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) {} + + inline ::capnp::compiler::Expression::Pipeline getType(); +private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class ParsedFile::Reader { +public: + typedef ParsedFile 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 hasRoot() const; + inline ::capnp::compiler::Declaration::Reader getRoot() 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 ParsedFile::Builder { +public: + typedef ParsedFile 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 hasRoot(); + inline ::capnp::compiler::Declaration::Builder getRoot(); + inline void setRoot( ::capnp::compiler::Declaration::Reader value); + inline ::capnp::compiler::Declaration::Builder initRoot(); + inline void adoptRoot(::capnp::Orphan< ::capnp::compiler::Declaration>&& value); + inline ::capnp::Orphan< ::capnp::compiler::Declaration> disownRoot(); + +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 ParsedFile::Pipeline { +public: + typedef ParsedFile Pipelines; + + inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) {} + + inline ::capnp::compiler::Declaration::Pipeline getRoot(); +private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template <typename, ::capnp::Kind> + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +// ======================================================================================= + +inline bool LocatedText::Reader::hasValue() const { + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool LocatedText::Builder::hasValue() { + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::Text::Reader LocatedText::Reader::getValue() const { + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder LocatedText::Builder::getValue() { + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void LocatedText::Builder::setValue( ::capnp::Text::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::Text::Builder LocatedText::Builder::initValue(unsigned int size) { + return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void LocatedText::Builder::adoptValue( + ::capnp::Orphan< ::capnp::Text>&& value) { + ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::Text> LocatedText::Builder::disownValue() { + return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline ::uint32_t LocatedText::Reader::getStartByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t LocatedText::Builder::getStartByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void LocatedText::Builder::setStartByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline ::uint32_t LocatedText::Reader::getEndByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t LocatedText::Builder::getEndByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void LocatedText::Builder::setEndByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + +inline ::uint64_t LocatedInteger::Reader::getValue() const { + return _reader.getDataField< ::uint64_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::uint64_t LocatedInteger::Builder::getValue() { + return _builder.getDataField< ::uint64_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void LocatedInteger::Builder::setValue( ::uint64_t value) { + _builder.setDataField< ::uint64_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline ::uint32_t LocatedInteger::Reader::getStartByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t LocatedInteger::Builder::getStartByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS); +} +inline void LocatedInteger::Builder::setStartByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); +} + +inline ::uint32_t LocatedInteger::Reader::getEndByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<3>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t LocatedInteger::Builder::getEndByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<3>() * ::capnp::ELEMENTS); +} +inline void LocatedInteger::Builder::setEndByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<3>() * ::capnp::ELEMENTS, value); +} + +inline double LocatedFloat::Reader::getValue() const { + return _reader.getDataField<double>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline double LocatedFloat::Builder::getValue() { + return _builder.getDataField<double>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void LocatedFloat::Builder::setValue(double value) { + _builder.setDataField<double>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline ::uint32_t LocatedFloat::Reader::getStartByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t LocatedFloat::Builder::getStartByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS); +} +inline void LocatedFloat::Builder::setStartByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); +} + +inline ::uint32_t LocatedFloat::Reader::getEndByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<3>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t LocatedFloat::Builder::getEndByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<3>() * ::capnp::ELEMENTS); +} +inline void LocatedFloat::Builder::setEndByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<3>() * ::capnp::ELEMENTS, value); +} + +inline ::capnp::compiler::Expression::Which Expression::Reader::which() const { + return _reader.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline ::capnp::compiler::Expression::Which Expression::Builder::which() { + return _builder.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline bool Expression::Reader::isUnknown() const { + return which() == Expression::UNKNOWN; +} +inline bool Expression::Builder::isUnknown() { + return which() == Expression::UNKNOWN; +} +inline ::capnp::Void Expression::Reader::getUnknown() const { + KJ_IREQUIRE((which() == Expression::UNKNOWN), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Expression::Builder::getUnknown() { + KJ_IREQUIRE((which() == Expression::UNKNOWN), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Expression::Builder::setUnknown( ::capnp::Void value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::UNKNOWN); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Expression::Reader::isPositiveInt() const { + return which() == Expression::POSITIVE_INT; +} +inline bool Expression::Builder::isPositiveInt() { + return which() == Expression::POSITIVE_INT; +} +inline ::uint64_t Expression::Reader::getPositiveInt() const { + KJ_IREQUIRE((which() == Expression::POSITIVE_INT), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline ::uint64_t Expression::Builder::getPositiveInt() { + KJ_IREQUIRE((which() == Expression::POSITIVE_INT), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void Expression::Builder::setPositiveInt( ::uint64_t value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::POSITIVE_INT); + _builder.setDataField< ::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + +inline bool Expression::Reader::isNegativeInt() const { + return which() == Expression::NEGATIVE_INT; +} +inline bool Expression::Builder::isNegativeInt() { + return which() == Expression::NEGATIVE_INT; +} +inline ::uint64_t Expression::Reader::getNegativeInt() const { + KJ_IREQUIRE((which() == Expression::NEGATIVE_INT), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline ::uint64_t Expression::Builder::getNegativeInt() { + KJ_IREQUIRE((which() == Expression::NEGATIVE_INT), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void Expression::Builder::setNegativeInt( ::uint64_t value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::NEGATIVE_INT); + _builder.setDataField< ::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + +inline bool Expression::Reader::isFloat() const { + return which() == Expression::FLOAT; +} +inline bool Expression::Builder::isFloat() { + return which() == Expression::FLOAT; +} +inline double Expression::Reader::getFloat() const { + KJ_IREQUIRE((which() == Expression::FLOAT), + "Must check which() before get()ing a union member."); + return _reader.getDataField<double>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline double Expression::Builder::getFloat() { + KJ_IREQUIRE((which() == Expression::FLOAT), + "Must check which() before get()ing a union member."); + return _builder.getDataField<double>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void Expression::Builder::setFloat(double value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::FLOAT); + _builder.setDataField<double>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + +inline bool Expression::Reader::isString() const { + return which() == Expression::STRING; +} +inline bool Expression::Builder::isString() { + return which() == Expression::STRING; +} +inline bool Expression::Reader::hasString() const { + if (which() != Expression::STRING) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Builder::hasString() { + if (which() != Expression::STRING) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::Text::Reader Expression::Reader::getString() const { + KJ_IREQUIRE((which() == Expression::STRING), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder Expression::Builder::getString() { + KJ_IREQUIRE((which() == Expression::STRING), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Builder::setString( ::capnp::Text::Reader value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::STRING); + ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::Text::Builder Expression::Builder::initString(unsigned int size) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::STRING); + return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void Expression::Builder::adoptString( + ::capnp::Orphan< ::capnp::Text>&& value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::STRING); + ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::Text> Expression::Builder::disownString() { + KJ_IREQUIRE((which() == Expression::STRING), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Expression::Reader::isRelativeName() const { + return which() == Expression::RELATIVE_NAME; +} +inline bool Expression::Builder::isRelativeName() { + return which() == Expression::RELATIVE_NAME; +} +inline bool Expression::Reader::hasRelativeName() const { + if (which() != Expression::RELATIVE_NAME) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Builder::hasRelativeName() { + if (which() != Expression::RELATIVE_NAME) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::LocatedText::Reader Expression::Reader::getRelativeName() const { + KJ_IREQUIRE((which() == Expression::RELATIVE_NAME), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::LocatedText::Builder Expression::Builder::getRelativeName() { + KJ_IREQUIRE((which() == Expression::RELATIVE_NAME), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Builder::setRelativeName( ::capnp::compiler::LocatedText::Reader value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::RELATIVE_NAME); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::LocatedText::Builder Expression::Builder::initRelativeName() { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::RELATIVE_NAME); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Builder::adoptRelativeName( + ::capnp::Orphan< ::capnp::compiler::LocatedText>&& value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::RELATIVE_NAME); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::LocatedText> Expression::Builder::disownRelativeName() { + KJ_IREQUIRE((which() == Expression::RELATIVE_NAME), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Expression::Reader::isList() const { + return which() == Expression::LIST; +} +inline bool Expression::Builder::isList() { + return which() == Expression::LIST; +} +inline bool Expression::Reader::hasList() const { + if (which() != Expression::LIST) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Builder::hasList() { + if (which() != Expression::LIST) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::compiler::Expression>::Reader Expression::Reader::getList() const { + KJ_IREQUIRE((which() == Expression::LIST), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression>>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::compiler::Expression>::Builder Expression::Builder::getList() { + KJ_IREQUIRE((which() == Expression::LIST), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression>>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Builder::setList( ::capnp::List< ::capnp::compiler::Expression>::Reader value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::LIST); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression>>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::compiler::Expression>::Builder Expression::Builder::initList(unsigned int size) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::LIST); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression>>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void Expression::Builder::adoptList( + ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression>>&& value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::LIST); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression>>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression>> Expression::Builder::disownList() { + KJ_IREQUIRE((which() == Expression::LIST), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression>>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Expression::Reader::isTuple() const { + return which() == Expression::TUPLE; +} +inline bool Expression::Builder::isTuple() { + return which() == Expression::TUPLE; +} +inline bool Expression::Reader::hasTuple() const { + if (which() != Expression::TUPLE) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Builder::hasTuple() { + if (which() != Expression::TUPLE) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::compiler::Expression::Param>::Reader Expression::Reader::getTuple() const { + KJ_IREQUIRE((which() == Expression::TUPLE), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression::Param>>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::compiler::Expression::Param>::Builder Expression::Builder::getTuple() { + KJ_IREQUIRE((which() == Expression::TUPLE), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression::Param>>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Builder::setTuple( ::capnp::List< ::capnp::compiler::Expression::Param>::Reader value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::TUPLE); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression::Param>>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::compiler::Expression::Param>::Builder Expression::Builder::initTuple(unsigned int size) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::TUPLE); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression::Param>>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void Expression::Builder::adoptTuple( + ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression::Param>>&& value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::TUPLE); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression::Param>>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression::Param>> Expression::Builder::disownTuple() { + KJ_IREQUIRE((which() == Expression::TUPLE), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression::Param>>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline ::uint32_t Expression::Reader::getStartByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Expression::Builder::getStartByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void Expression::Builder::setStartByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + +inline ::uint32_t Expression::Reader::getEndByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<4>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Expression::Builder::getEndByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<4>() * ::capnp::ELEMENTS); +} +inline void Expression::Builder::setEndByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<4>() * ::capnp::ELEMENTS, value); +} + +inline bool Expression::Reader::isBinary() const { + return which() == Expression::BINARY; +} +inline bool Expression::Builder::isBinary() { + return which() == Expression::BINARY; +} +inline bool Expression::Reader::hasBinary() const { + if (which() != Expression::BINARY) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Builder::hasBinary() { + if (which() != Expression::BINARY) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::Data::Reader Expression::Reader::getBinary() const { + KJ_IREQUIRE((which() == Expression::BINARY), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Data>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Data::Builder Expression::Builder::getBinary() { + KJ_IREQUIRE((which() == Expression::BINARY), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Data>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Builder::setBinary( ::capnp::Data::Reader value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::BINARY); + ::capnp::_::PointerHelpers< ::capnp::Data>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::Data::Builder Expression::Builder::initBinary(unsigned int size) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::BINARY); + return ::capnp::_::PointerHelpers< ::capnp::Data>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void Expression::Builder::adoptBinary( + ::capnp::Orphan< ::capnp::Data>&& value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::BINARY); + ::capnp::_::PointerHelpers< ::capnp::Data>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::Data> Expression::Builder::disownBinary() { + KJ_IREQUIRE((which() == Expression::BINARY), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Data>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Expression::Reader::isApplication() const { + return which() == Expression::APPLICATION; +} +inline bool Expression::Builder::isApplication() { + return which() == Expression::APPLICATION; +} +inline typename Expression::Application::Reader Expression::Reader::getApplication() const { + KJ_IREQUIRE((which() == Expression::APPLICATION), + "Must check which() before get()ing a union member."); + return typename Expression::Application::Reader(_reader); +} +inline typename Expression::Application::Builder Expression::Builder::getApplication() { + KJ_IREQUIRE((which() == Expression::APPLICATION), + "Must check which() before get()ing a union member."); + return typename Expression::Application::Builder(_builder); +} +inline typename Expression::Application::Builder Expression::Builder::initApplication() { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::APPLICATION); + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS).clear(); + return typename Expression::Application::Builder(_builder); +} +inline bool Expression::Reader::isMember() const { + return which() == Expression::MEMBER; +} +inline bool Expression::Builder::isMember() { + return which() == Expression::MEMBER; +} +inline typename Expression::Member::Reader Expression::Reader::getMember() const { + KJ_IREQUIRE((which() == Expression::MEMBER), + "Must check which() before get()ing a union member."); + return typename Expression::Member::Reader(_reader); +} +inline typename Expression::Member::Builder Expression::Builder::getMember() { + KJ_IREQUIRE((which() == Expression::MEMBER), + "Must check which() before get()ing a union member."); + return typename Expression::Member::Builder(_builder); +} +inline typename Expression::Member::Builder Expression::Builder::initMember() { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::MEMBER); + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS).clear(); + return typename Expression::Member::Builder(_builder); +} +inline bool Expression::Reader::isAbsoluteName() const { + return which() == Expression::ABSOLUTE_NAME; +} +inline bool Expression::Builder::isAbsoluteName() { + return which() == Expression::ABSOLUTE_NAME; +} +inline bool Expression::Reader::hasAbsoluteName() const { + if (which() != Expression::ABSOLUTE_NAME) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Builder::hasAbsoluteName() { + if (which() != Expression::ABSOLUTE_NAME) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::LocatedText::Reader Expression::Reader::getAbsoluteName() const { + KJ_IREQUIRE((which() == Expression::ABSOLUTE_NAME), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::LocatedText::Builder Expression::Builder::getAbsoluteName() { + KJ_IREQUIRE((which() == Expression::ABSOLUTE_NAME), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Builder::setAbsoluteName( ::capnp::compiler::LocatedText::Reader value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::ABSOLUTE_NAME); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::LocatedText::Builder Expression::Builder::initAbsoluteName() { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::ABSOLUTE_NAME); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Builder::adoptAbsoluteName( + ::capnp::Orphan< ::capnp::compiler::LocatedText>&& value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::ABSOLUTE_NAME); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::LocatedText> Expression::Builder::disownAbsoluteName() { + KJ_IREQUIRE((which() == Expression::ABSOLUTE_NAME), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Expression::Reader::isImport() const { + return which() == Expression::IMPORT; +} +inline bool Expression::Builder::isImport() { + return which() == Expression::IMPORT; +} +inline bool Expression::Reader::hasImport() const { + if (which() != Expression::IMPORT) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Builder::hasImport() { + if (which() != Expression::IMPORT) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::LocatedText::Reader Expression::Reader::getImport() const { + KJ_IREQUIRE((which() == Expression::IMPORT), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::LocatedText::Builder Expression::Builder::getImport() { + KJ_IREQUIRE((which() == Expression::IMPORT), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Builder::setImport( ::capnp::compiler::LocatedText::Reader value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::IMPORT); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::LocatedText::Builder Expression::Builder::initImport() { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::IMPORT); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Builder::adoptImport( + ::capnp::Orphan< ::capnp::compiler::LocatedText>&& value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::IMPORT); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::LocatedText> Expression::Builder::disownImport() { + KJ_IREQUIRE((which() == Expression::IMPORT), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Expression::Reader::isEmbed() const { + return which() == Expression::EMBED; +} +inline bool Expression::Builder::isEmbed() { + return which() == Expression::EMBED; +} +inline bool Expression::Reader::hasEmbed() const { + if (which() != Expression::EMBED) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Builder::hasEmbed() { + if (which() != Expression::EMBED) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::LocatedText::Reader Expression::Reader::getEmbed() const { + KJ_IREQUIRE((which() == Expression::EMBED), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::LocatedText::Builder Expression::Builder::getEmbed() { + KJ_IREQUIRE((which() == Expression::EMBED), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Builder::setEmbed( ::capnp::compiler::LocatedText::Reader value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::EMBED); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::LocatedText::Builder Expression::Builder::initEmbed() { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::EMBED); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Builder::adoptEmbed( + ::capnp::Orphan< ::capnp::compiler::LocatedText>&& value) { + _builder.setDataField<Expression::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::EMBED); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::LocatedText> Expression::Builder::disownEmbed() { + KJ_IREQUIRE((which() == Expression::EMBED), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline ::capnp::compiler::Expression::Param::Which Expression::Param::Reader::which() const { + return _reader.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline ::capnp::compiler::Expression::Param::Which Expression::Param::Builder::which() { + return _builder.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline bool Expression::Param::Reader::isUnnamed() const { + return which() == Expression::Param::UNNAMED; +} +inline bool Expression::Param::Builder::isUnnamed() { + return which() == Expression::Param::UNNAMED; +} +inline ::capnp::Void Expression::Param::Reader::getUnnamed() const { + KJ_IREQUIRE((which() == Expression::Param::UNNAMED), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Expression::Param::Builder::getUnnamed() { + KJ_IREQUIRE((which() == Expression::Param::UNNAMED), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Expression::Param::Builder::setUnnamed( ::capnp::Void value) { + _builder.setDataField<Expression::Param::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::Param::UNNAMED); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Expression::Param::Reader::isNamed() const { + return which() == Expression::Param::NAMED; +} +inline bool Expression::Param::Builder::isNamed() { + return which() == Expression::Param::NAMED; +} +inline bool Expression::Param::Reader::hasNamed() const { + if (which() != Expression::Param::NAMED) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Param::Builder::hasNamed() { + if (which() != Expression::Param::NAMED) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::LocatedText::Reader Expression::Param::Reader::getNamed() const { + KJ_IREQUIRE((which() == Expression::Param::NAMED), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::LocatedText::Builder Expression::Param::Builder::getNamed() { + KJ_IREQUIRE((which() == Expression::Param::NAMED), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Param::Builder::setNamed( ::capnp::compiler::LocatedText::Reader value) { + _builder.setDataField<Expression::Param::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::Param::NAMED); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::LocatedText::Builder Expression::Param::Builder::initNamed() { + _builder.setDataField<Expression::Param::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::Param::NAMED); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Param::Builder::adoptNamed( + ::capnp::Orphan< ::capnp::compiler::LocatedText>&& value) { + _builder.setDataField<Expression::Param::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Expression::Param::NAMED); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::LocatedText> Expression::Param::Builder::disownNamed() { + KJ_IREQUIRE((which() == Expression::Param::NAMED), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Expression::Param::Reader::hasValue() const { + return !_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Param::Builder::hasValue() { + return !_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Expression::Param::Reader::getValue() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Expression::Param::Builder::getValue() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::Expression::Pipeline Expression::Param::Pipeline::getValue() { + return ::capnp::compiler::Expression::Pipeline(_typeless.getPointerField(1)); +} +#endif // !CAPNP_LITE +inline void Expression::Param::Builder::setValue( ::capnp::compiler::Expression::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Expression::Param::Builder::initValue() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void Expression::Param::Builder::adoptValue( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Expression::Param::Builder::disownValue() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} + +inline bool Expression::Application::Reader::hasFunction() const { + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Application::Builder::hasFunction() { + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Expression::Application::Reader::getFunction() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Expression::Application::Builder::getFunction() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::Expression::Pipeline Expression::Application::Pipeline::getFunction() { + return ::capnp::compiler::Expression::Pipeline(_typeless.getPointerField(0)); +} +#endif // !CAPNP_LITE +inline void Expression::Application::Builder::setFunction( ::capnp::compiler::Expression::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Expression::Application::Builder::initFunction() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Application::Builder::adoptFunction( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Expression::Application::Builder::disownFunction() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Expression::Application::Reader::hasParams() const { + return !_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Application::Builder::hasParams() { + return !_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::compiler::Expression::Param>::Reader Expression::Application::Reader::getParams() const { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression::Param>>::get(_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::compiler::Expression::Param>::Builder Expression::Application::Builder::getParams() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression::Param>>::get(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void Expression::Application::Builder::setParams( ::capnp::List< ::capnp::compiler::Expression::Param>::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression::Param>>::set(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::compiler::Expression::Param>::Builder Expression::Application::Builder::initParams(unsigned int size) { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression::Param>>::init(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), size); +} +inline void Expression::Application::Builder::adoptParams( + ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression::Param>>&& value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression::Param>>::adopt(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression::Param>> Expression::Application::Builder::disownParams() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression::Param>>::disown(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} + +inline bool Expression::Member::Reader::hasParent() const { + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Member::Builder::hasParent() { + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Expression::Member::Reader::getParent() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Expression::Member::Builder::getParent() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::Expression::Pipeline Expression::Member::Pipeline::getParent() { + return ::capnp::compiler::Expression::Pipeline(_typeless.getPointerField(0)); +} +#endif // !CAPNP_LITE +inline void Expression::Member::Builder::setParent( ::capnp::compiler::Expression::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Expression::Member::Builder::initParent() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Expression::Member::Builder::adoptParent( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Expression::Member::Builder::disownParent() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Expression::Member::Reader::hasName() const { + return !_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline bool Expression::Member::Builder::hasName() { + return !_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::LocatedText::Reader Expression::Member::Reader::getName() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::LocatedText::Builder Expression::Member::Builder::getName() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::LocatedText::Pipeline Expression::Member::Pipeline::getName() { + return ::capnp::compiler::LocatedText::Pipeline(_typeless.getPointerField(1)); +} +#endif // !CAPNP_LITE +inline void Expression::Member::Builder::setName( ::capnp::compiler::LocatedText::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::set(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::LocatedText::Builder Expression::Member::Builder::initName() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::init(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void Expression::Member::Builder::adoptName( + ::capnp::Orphan< ::capnp::compiler::LocatedText>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::adopt(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::LocatedText> Expression::Member::Builder::disownName() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::disown(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} + +inline ::capnp::compiler::Declaration::Which Declaration::Reader::which() const { + return _reader.getDataField<Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline ::capnp::compiler::Declaration::Which Declaration::Builder::which() { + return _builder.getDataField<Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Reader::hasName() const { + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Builder::hasName() { + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::LocatedText::Reader Declaration::Reader::getName() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::LocatedText::Builder Declaration::Builder::getName() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::LocatedText::Pipeline Declaration::Pipeline::getName() { + return ::capnp::compiler::LocatedText::Pipeline(_typeless.getPointerField(0)); +} +#endif // !CAPNP_LITE +inline void Declaration::Builder::setName( ::capnp::compiler::LocatedText::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::LocatedText::Builder Declaration::Builder::initName() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Declaration::Builder::adoptName( + ::capnp::Orphan< ::capnp::compiler::LocatedText>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::LocatedText> Declaration::Builder::disownName() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline typename Declaration::Id::Reader Declaration::Reader::getId() const { + return typename Declaration::Id::Reader(_reader); +} +inline typename Declaration::Id::Builder Declaration::Builder::getId() { + return typename Declaration::Id::Builder(_builder); +} +#if !CAPNP_LITE +inline typename Declaration::Id::Pipeline Declaration::Pipeline::getId() { + return typename Declaration::Id::Pipeline(_typeless.noop()); +} +#endif // !CAPNP_LITE +inline typename Declaration::Id::Builder Declaration::Builder::initId() { + _builder.setDataField< ::uint16_t>(::capnp::bounded<0>() * ::capnp::ELEMENTS, 0); + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS).clear(); + return typename Declaration::Id::Builder(_builder); +} +inline bool Declaration::Reader::hasNestedDecls() const { + return !_reader.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Builder::hasNestedDecls() { + return !_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::compiler::Declaration>::Reader Declaration::Reader::getNestedDecls() const { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration>>::get(_reader.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::compiler::Declaration>::Builder Declaration::Builder::getNestedDecls() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration>>::get(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS)); +} +inline void Declaration::Builder::setNestedDecls( ::capnp::List< ::capnp::compiler::Declaration>::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration>>::set(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::compiler::Declaration>::Builder Declaration::Builder::initNestedDecls(unsigned int size) { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration>>::init(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS), size); +} +inline void Declaration::Builder::adoptNestedDecls( + ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration>>&& value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration>>::adopt(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration>> Declaration::Builder::disownNestedDecls() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration>>::disown(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Reader::hasAnnotations() const { + return !_reader.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Builder::hasAnnotations() { + return !_builder.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Reader Declaration::Reader::getAnnotations() const { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>::get(_reader.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Builder Declaration::Builder::getAnnotations() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>::get(_builder.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS)); +} +inline void Declaration::Builder::setAnnotations( ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>::set(_builder.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Builder Declaration::Builder::initAnnotations(unsigned int size) { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>::init(_builder.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS), size); +} +inline void Declaration::Builder::adoptAnnotations( + ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>&& value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>::adopt(_builder.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>> Declaration::Builder::disownAnnotations() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>::disown(_builder.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS)); +} + +inline ::uint32_t Declaration::Reader::getStartByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Declaration::Builder::getStartByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setStartByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + +inline ::uint32_t Declaration::Reader::getEndByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Declaration::Builder::getEndByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setEndByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::hasDocComment() const { + return !_reader.getPointerField( + ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Builder::hasDocComment() { + return !_builder.getPointerField( + ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::Text::Reader Declaration::Reader::getDocComment() const { + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( + ::capnp::bounded<4>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder Declaration::Builder::getDocComment() { + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( + ::capnp::bounded<4>() * ::capnp::POINTERS)); +} +inline void Declaration::Builder::setDocComment( ::capnp::Text::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( + ::capnp::bounded<4>() * ::capnp::POINTERS), value); +} +inline ::capnp::Text::Builder Declaration::Builder::initDocComment(unsigned int size) { + return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( + ::capnp::bounded<4>() * ::capnp::POINTERS), size); +} +inline void Declaration::Builder::adoptDocComment( + ::capnp::Orphan< ::capnp::Text>&& value) { + ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( + ::capnp::bounded<4>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::Text> Declaration::Builder::disownDocComment() { + return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( + ::capnp::bounded<4>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Reader::isFile() const { + return which() == Declaration::FILE; +} +inline bool Declaration::Builder::isFile() { + return which() == Declaration::FILE; +} +inline ::capnp::Void Declaration::Reader::getFile() const { + KJ_IREQUIRE((which() == Declaration::FILE), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getFile() { + KJ_IREQUIRE((which() == Declaration::FILE), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setFile( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::FILE); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isUsing() const { + return which() == Declaration::USING; +} +inline bool Declaration::Builder::isUsing() { + return which() == Declaration::USING; +} +inline typename Declaration::Using::Reader Declaration::Reader::getUsing() const { + KJ_IREQUIRE((which() == Declaration::USING), + "Must check which() before get()ing a union member."); + return typename Declaration::Using::Reader(_reader); +} +inline typename Declaration::Using::Builder Declaration::Builder::getUsing() { + KJ_IREQUIRE((which() == Declaration::USING), + "Must check which() before get()ing a union member."); + return typename Declaration::Using::Builder(_builder); +} +inline typename Declaration::Using::Builder Declaration::Builder::initUsing() { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::USING); + _builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS).clear(); + return typename Declaration::Using::Builder(_builder); +} +inline bool Declaration::Reader::isConst() const { + return which() == Declaration::CONST; +} +inline bool Declaration::Builder::isConst() { + return which() == Declaration::CONST; +} +inline typename Declaration::Const::Reader Declaration::Reader::getConst() const { + KJ_IREQUIRE((which() == Declaration::CONST), + "Must check which() before get()ing a union member."); + return typename Declaration::Const::Reader(_reader); +} +inline typename Declaration::Const::Builder Declaration::Builder::getConst() { + KJ_IREQUIRE((which() == Declaration::CONST), + "Must check which() before get()ing a union member."); + return typename Declaration::Const::Builder(_builder); +} +inline typename Declaration::Const::Builder Declaration::Builder::initConst() { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::CONST); + _builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS).clear(); + _builder.getPointerField(::capnp::bounded<6>() * ::capnp::POINTERS).clear(); + return typename Declaration::Const::Builder(_builder); +} +inline bool Declaration::Reader::isEnum() const { + return which() == Declaration::ENUM; +} +inline bool Declaration::Builder::isEnum() { + return which() == Declaration::ENUM; +} +inline ::capnp::Void Declaration::Reader::getEnum() const { + KJ_IREQUIRE((which() == Declaration::ENUM), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getEnum() { + KJ_IREQUIRE((which() == Declaration::ENUM), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setEnum( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::ENUM); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isEnumerant() const { + return which() == Declaration::ENUMERANT; +} +inline bool Declaration::Builder::isEnumerant() { + return which() == Declaration::ENUMERANT; +} +inline ::capnp::Void Declaration::Reader::getEnumerant() const { + KJ_IREQUIRE((which() == Declaration::ENUMERANT), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getEnumerant() { + KJ_IREQUIRE((which() == Declaration::ENUMERANT), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setEnumerant( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::ENUMERANT); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isStruct() const { + return which() == Declaration::STRUCT; +} +inline bool Declaration::Builder::isStruct() { + return which() == Declaration::STRUCT; +} +inline ::capnp::Void Declaration::Reader::getStruct() const { + KJ_IREQUIRE((which() == Declaration::STRUCT), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getStruct() { + KJ_IREQUIRE((which() == Declaration::STRUCT), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setStruct( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::STRUCT); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isField() const { + return which() == Declaration::FIELD; +} +inline bool Declaration::Builder::isField() { + return which() == Declaration::FIELD; +} +inline typename Declaration::Field::Reader Declaration::Reader::getField() const { + KJ_IREQUIRE((which() == Declaration::FIELD), + "Must check which() before get()ing a union member."); + return typename Declaration::Field::Reader(_reader); +} +inline typename Declaration::Field::Builder Declaration::Builder::getField() { + KJ_IREQUIRE((which() == Declaration::FIELD), + "Must check which() before get()ing a union member."); + return typename Declaration::Field::Builder(_builder); +} +inline typename Declaration::Field::Builder Declaration::Builder::initField() { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::FIELD); + _builder.setDataField< ::uint16_t>(::capnp::bounded<6>() * ::capnp::ELEMENTS, 0); + _builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS).clear(); + _builder.getPointerField(::capnp::bounded<6>() * ::capnp::POINTERS).clear(); + return typename Declaration::Field::Builder(_builder); +} +inline bool Declaration::Reader::isUnion() const { + return which() == Declaration::UNION; +} +inline bool Declaration::Builder::isUnion() { + return which() == Declaration::UNION; +} +inline ::capnp::Void Declaration::Reader::getUnion() const { + KJ_IREQUIRE((which() == Declaration::UNION), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getUnion() { + KJ_IREQUIRE((which() == Declaration::UNION), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setUnion( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::UNION); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isGroup() const { + return which() == Declaration::GROUP; +} +inline bool Declaration::Builder::isGroup() { + return which() == Declaration::GROUP; +} +inline ::capnp::Void Declaration::Reader::getGroup() const { + KJ_IREQUIRE((which() == Declaration::GROUP), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getGroup() { + KJ_IREQUIRE((which() == Declaration::GROUP), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setGroup( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::GROUP); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isInterface() const { + return which() == Declaration::INTERFACE; +} +inline bool Declaration::Builder::isInterface() { + return which() == Declaration::INTERFACE; +} +inline typename Declaration::Interface::Reader Declaration::Reader::getInterface() const { + KJ_IREQUIRE((which() == Declaration::INTERFACE), + "Must check which() before get()ing a union member."); + return typename Declaration::Interface::Reader(_reader); +} +inline typename Declaration::Interface::Builder Declaration::Builder::getInterface() { + KJ_IREQUIRE((which() == Declaration::INTERFACE), + "Must check which() before get()ing a union member."); + return typename Declaration::Interface::Builder(_builder); +} +inline typename Declaration::Interface::Builder Declaration::Builder::initInterface() { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::INTERFACE); + _builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS).clear(); + return typename Declaration::Interface::Builder(_builder); +} +inline bool Declaration::Reader::isMethod() const { + return which() == Declaration::METHOD; +} +inline bool Declaration::Builder::isMethod() { + return which() == Declaration::METHOD; +} +inline typename Declaration::Method::Reader Declaration::Reader::getMethod() const { + KJ_IREQUIRE((which() == Declaration::METHOD), + "Must check which() before get()ing a union member."); + return typename Declaration::Method::Reader(_reader); +} +inline typename Declaration::Method::Builder Declaration::Builder::getMethod() { + KJ_IREQUIRE((which() == Declaration::METHOD), + "Must check which() before get()ing a union member."); + return typename Declaration::Method::Builder(_builder); +} +inline typename Declaration::Method::Builder Declaration::Builder::initMethod() { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::METHOD); + _builder.setDataField< ::uint16_t>(::capnp::bounded<6>() * ::capnp::ELEMENTS, 0); + _builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS).clear(); + _builder.getPointerField(::capnp::bounded<6>() * ::capnp::POINTERS).clear(); + return typename Declaration::Method::Builder(_builder); +} +inline bool Declaration::Reader::isAnnotation() const { + return which() == Declaration::ANNOTATION; +} +inline bool Declaration::Builder::isAnnotation() { + return which() == Declaration::ANNOTATION; +} +inline typename Declaration::Annotation::Reader Declaration::Reader::getAnnotation() const { + KJ_IREQUIRE((which() == Declaration::ANNOTATION), + "Must check which() before get()ing a union member."); + return typename Declaration::Annotation::Reader(_reader); +} +inline typename Declaration::Annotation::Builder Declaration::Builder::getAnnotation() { + KJ_IREQUIRE((which() == Declaration::ANNOTATION), + "Must check which() before get()ing a union member."); + return typename Declaration::Annotation::Builder(_builder); +} +inline typename Declaration::Annotation::Builder Declaration::Builder::initAnnotation() { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::ANNOTATION); + _builder.setDataField<bool>(::capnp::bounded<96>() * ::capnp::ELEMENTS, 0); + _builder.setDataField<bool>(::capnp::bounded<97>() * ::capnp::ELEMENTS, 0); + _builder.setDataField<bool>(::capnp::bounded<98>() * ::capnp::ELEMENTS, 0); + _builder.setDataField<bool>(::capnp::bounded<99>() * ::capnp::ELEMENTS, 0); + _builder.setDataField<bool>(::capnp::bounded<100>() * ::capnp::ELEMENTS, 0); + _builder.setDataField<bool>(::capnp::bounded<101>() * ::capnp::ELEMENTS, 0); + _builder.setDataField<bool>(::capnp::bounded<102>() * ::capnp::ELEMENTS, 0); + _builder.setDataField<bool>(::capnp::bounded<103>() * ::capnp::ELEMENTS, 0); + _builder.setDataField<bool>(::capnp::bounded<104>() * ::capnp::ELEMENTS, 0); + _builder.setDataField<bool>(::capnp::bounded<105>() * ::capnp::ELEMENTS, 0); + _builder.setDataField<bool>(::capnp::bounded<106>() * ::capnp::ELEMENTS, 0); + _builder.setDataField<bool>(::capnp::bounded<107>() * ::capnp::ELEMENTS, 0); + _builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS).clear(); + return typename Declaration::Annotation::Builder(_builder); +} +inline bool Declaration::Reader::isNakedId() const { + return which() == Declaration::NAKED_ID; +} +inline bool Declaration::Builder::isNakedId() { + return which() == Declaration::NAKED_ID; +} +inline bool Declaration::Reader::hasNakedId() const { + if (which() != Declaration::NAKED_ID) return false; + return !_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Builder::hasNakedId() { + if (which() != Declaration::NAKED_ID) return false; + return !_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::LocatedInteger::Reader Declaration::Reader::getNakedId() const { + KJ_IREQUIRE((which() == Declaration::NAKED_ID), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::get(_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::LocatedInteger::Builder Declaration::Builder::getNakedId() { + KJ_IREQUIRE((which() == Declaration::NAKED_ID), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::get(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline void Declaration::Builder::setNakedId( ::capnp::compiler::LocatedInteger::Reader value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::NAKED_ID); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::set(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::LocatedInteger::Builder Declaration::Builder::initNakedId() { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::NAKED_ID); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::init(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline void Declaration::Builder::adoptNakedId( + ::capnp::Orphan< ::capnp::compiler::LocatedInteger>&& value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::NAKED_ID); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::adopt(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::LocatedInteger> Declaration::Builder::disownNakedId() { + KJ_IREQUIRE((which() == Declaration::NAKED_ID), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::disown(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Reader::isNakedAnnotation() const { + return which() == Declaration::NAKED_ANNOTATION; +} +inline bool Declaration::Builder::isNakedAnnotation() { + return which() == Declaration::NAKED_ANNOTATION; +} +inline bool Declaration::Reader::hasNakedAnnotation() const { + if (which() != Declaration::NAKED_ANNOTATION) return false; + return !_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Builder::hasNakedAnnotation() { + if (which() != Declaration::NAKED_ANNOTATION) return false; + return !_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Declaration::AnnotationApplication::Reader Declaration::Reader::getNakedAnnotation() const { + KJ_IREQUIRE((which() == Declaration::NAKED_ANNOTATION), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::AnnotationApplication>::get(_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Declaration::AnnotationApplication::Builder Declaration::Builder::getNakedAnnotation() { + KJ_IREQUIRE((which() == Declaration::NAKED_ANNOTATION), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::AnnotationApplication>::get(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline void Declaration::Builder::setNakedAnnotation( ::capnp::compiler::Declaration::AnnotationApplication::Reader value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::NAKED_ANNOTATION); + ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::AnnotationApplication>::set(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Declaration::AnnotationApplication::Builder Declaration::Builder::initNakedAnnotation() { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::NAKED_ANNOTATION); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::AnnotationApplication>::init(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline void Declaration::Builder::adoptNakedAnnotation( + ::capnp::Orphan< ::capnp::compiler::Declaration::AnnotationApplication>&& value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::NAKED_ANNOTATION); + ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::AnnotationApplication>::adopt(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Declaration::AnnotationApplication> Declaration::Builder::disownNakedAnnotation() { + KJ_IREQUIRE((which() == Declaration::NAKED_ANNOTATION), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::AnnotationApplication>::disown(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Reader::isBuiltinVoid() const { + return which() == Declaration::BUILTIN_VOID; +} +inline bool Declaration::Builder::isBuiltinVoid() { + return which() == Declaration::BUILTIN_VOID; +} +inline ::capnp::Void Declaration::Reader::getBuiltinVoid() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_VOID), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinVoid() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_VOID), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinVoid( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_VOID); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinBool() const { + return which() == Declaration::BUILTIN_BOOL; +} +inline bool Declaration::Builder::isBuiltinBool() { + return which() == Declaration::BUILTIN_BOOL; +} +inline ::capnp::Void Declaration::Reader::getBuiltinBool() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_BOOL), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinBool() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_BOOL), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinBool( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_BOOL); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinInt8() const { + return which() == Declaration::BUILTIN_INT8; +} +inline bool Declaration::Builder::isBuiltinInt8() { + return which() == Declaration::BUILTIN_INT8; +} +inline ::capnp::Void Declaration::Reader::getBuiltinInt8() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_INT8), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinInt8() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_INT8), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinInt8( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_INT8); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinInt16() const { + return which() == Declaration::BUILTIN_INT16; +} +inline bool Declaration::Builder::isBuiltinInt16() { + return which() == Declaration::BUILTIN_INT16; +} +inline ::capnp::Void Declaration::Reader::getBuiltinInt16() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_INT16), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinInt16() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_INT16), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinInt16( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_INT16); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinInt32() const { + return which() == Declaration::BUILTIN_INT32; +} +inline bool Declaration::Builder::isBuiltinInt32() { + return which() == Declaration::BUILTIN_INT32; +} +inline ::capnp::Void Declaration::Reader::getBuiltinInt32() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_INT32), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinInt32() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_INT32), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinInt32( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_INT32); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinInt64() const { + return which() == Declaration::BUILTIN_INT64; +} +inline bool Declaration::Builder::isBuiltinInt64() { + return which() == Declaration::BUILTIN_INT64; +} +inline ::capnp::Void Declaration::Reader::getBuiltinInt64() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_INT64), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinInt64() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_INT64), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinInt64( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_INT64); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinUInt8() const { + return which() == Declaration::BUILTIN_U_INT8; +} +inline bool Declaration::Builder::isBuiltinUInt8() { + return which() == Declaration::BUILTIN_U_INT8; +} +inline ::capnp::Void Declaration::Reader::getBuiltinUInt8() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_U_INT8), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinUInt8() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_U_INT8), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinUInt8( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_U_INT8); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinUInt16() const { + return which() == Declaration::BUILTIN_U_INT16; +} +inline bool Declaration::Builder::isBuiltinUInt16() { + return which() == Declaration::BUILTIN_U_INT16; +} +inline ::capnp::Void Declaration::Reader::getBuiltinUInt16() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_U_INT16), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinUInt16() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_U_INT16), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinUInt16( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_U_INT16); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinUInt32() const { + return which() == Declaration::BUILTIN_U_INT32; +} +inline bool Declaration::Builder::isBuiltinUInt32() { + return which() == Declaration::BUILTIN_U_INT32; +} +inline ::capnp::Void Declaration::Reader::getBuiltinUInt32() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_U_INT32), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinUInt32() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_U_INT32), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinUInt32( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_U_INT32); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinUInt64() const { + return which() == Declaration::BUILTIN_U_INT64; +} +inline bool Declaration::Builder::isBuiltinUInt64() { + return which() == Declaration::BUILTIN_U_INT64; +} +inline ::capnp::Void Declaration::Reader::getBuiltinUInt64() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_U_INT64), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinUInt64() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_U_INT64), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinUInt64( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_U_INT64); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinFloat32() const { + return which() == Declaration::BUILTIN_FLOAT32; +} +inline bool Declaration::Builder::isBuiltinFloat32() { + return which() == Declaration::BUILTIN_FLOAT32; +} +inline ::capnp::Void Declaration::Reader::getBuiltinFloat32() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_FLOAT32), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinFloat32() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_FLOAT32), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinFloat32( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_FLOAT32); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinFloat64() const { + return which() == Declaration::BUILTIN_FLOAT64; +} +inline bool Declaration::Builder::isBuiltinFloat64() { + return which() == Declaration::BUILTIN_FLOAT64; +} +inline ::capnp::Void Declaration::Reader::getBuiltinFloat64() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_FLOAT64), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinFloat64() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_FLOAT64), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinFloat64( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_FLOAT64); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinText() const { + return which() == Declaration::BUILTIN_TEXT; +} +inline bool Declaration::Builder::isBuiltinText() { + return which() == Declaration::BUILTIN_TEXT; +} +inline ::capnp::Void Declaration::Reader::getBuiltinText() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_TEXT), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinText() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_TEXT), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinText( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_TEXT); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinData() const { + return which() == Declaration::BUILTIN_DATA; +} +inline bool Declaration::Builder::isBuiltinData() { + return which() == Declaration::BUILTIN_DATA; +} +inline ::capnp::Void Declaration::Reader::getBuiltinData() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_DATA), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinData() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_DATA), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinData( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_DATA); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinList() const { + return which() == Declaration::BUILTIN_LIST; +} +inline bool Declaration::Builder::isBuiltinList() { + return which() == Declaration::BUILTIN_LIST; +} +inline ::capnp::Void Declaration::Reader::getBuiltinList() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_LIST), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinList() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_LIST), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinList( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_LIST); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinObject() const { + return which() == Declaration::BUILTIN_OBJECT; +} +inline bool Declaration::Builder::isBuiltinObject() { + return which() == Declaration::BUILTIN_OBJECT; +} +inline ::capnp::Void Declaration::Reader::getBuiltinObject() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_OBJECT), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinObject() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_OBJECT), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinObject( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_OBJECT); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinAnyPointer() const { + return which() == Declaration::BUILTIN_ANY_POINTER; +} +inline bool Declaration::Builder::isBuiltinAnyPointer() { + return which() == Declaration::BUILTIN_ANY_POINTER; +} +inline ::capnp::Void Declaration::Reader::getBuiltinAnyPointer() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_ANY_POINTER), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinAnyPointer() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_ANY_POINTER), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinAnyPointer( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_ANY_POINTER); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::hasParameters() const { + return !_reader.getPointerField( + ::capnp::bounded<7>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Builder::hasParameters() { + return !_builder.getPointerField( + ::capnp::bounded<7>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>::Reader Declaration::Reader::getParameters() const { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>>::get(_reader.getPointerField( + ::capnp::bounded<7>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>::Builder Declaration::Builder::getParameters() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>>::get(_builder.getPointerField( + ::capnp::bounded<7>() * ::capnp::POINTERS)); +} +inline void Declaration::Builder::setParameters( ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>>::set(_builder.getPointerField( + ::capnp::bounded<7>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>::Builder Declaration::Builder::initParameters(unsigned int size) { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>>::init(_builder.getPointerField( + ::capnp::bounded<7>() * ::capnp::POINTERS), size); +} +inline void Declaration::Builder::adoptParameters( + ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>>&& value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>>::adopt(_builder.getPointerField( + ::capnp::bounded<7>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>> Declaration::Builder::disownParameters() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::BrandParameter>>::disown(_builder.getPointerField( + ::capnp::bounded<7>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Reader::isBuiltinAnyStruct() const { + return which() == Declaration::BUILTIN_ANY_STRUCT; +} +inline bool Declaration::Builder::isBuiltinAnyStruct() { + return which() == Declaration::BUILTIN_ANY_STRUCT; +} +inline ::capnp::Void Declaration::Reader::getBuiltinAnyStruct() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_ANY_STRUCT), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinAnyStruct() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_ANY_STRUCT), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinAnyStruct( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_ANY_STRUCT); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinAnyList() const { + return which() == Declaration::BUILTIN_ANY_LIST; +} +inline bool Declaration::Builder::isBuiltinAnyList() { + return which() == Declaration::BUILTIN_ANY_LIST; +} +inline ::capnp::Void Declaration::Reader::getBuiltinAnyList() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_ANY_LIST), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinAnyList() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_ANY_LIST), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinAnyList( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_ANY_LIST); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Reader::isBuiltinCapability() const { + return which() == Declaration::BUILTIN_CAPABILITY; +} +inline bool Declaration::Builder::isBuiltinCapability() { + return which() == Declaration::BUILTIN_CAPABILITY; +} +inline ::capnp::Void Declaration::Reader::getBuiltinCapability() const { + KJ_IREQUIRE((which() == Declaration::BUILTIN_CAPABILITY), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Builder::getBuiltinCapability() { + KJ_IREQUIRE((which() == Declaration::BUILTIN_CAPABILITY), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Builder::setBuiltinCapability( ::capnp::Void value) { + _builder.setDataField<Declaration::Which>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, Declaration::BUILTIN_CAPABILITY); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::BrandParameter::Reader::hasName() const { + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::BrandParameter::Builder::hasName() { + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::Text::Reader Declaration::BrandParameter::Reader::getName() const { + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder Declaration::BrandParameter::Builder::getName() { + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Declaration::BrandParameter::Builder::setName( ::capnp::Text::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::Text::Builder Declaration::BrandParameter::Builder::initName(unsigned int size) { + return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void Declaration::BrandParameter::Builder::adoptName( + ::capnp::Orphan< ::capnp::Text>&& value) { + ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::Text> Declaration::BrandParameter::Builder::disownName() { + return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline ::uint32_t Declaration::BrandParameter::Reader::getStartByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Declaration::BrandParameter::Builder::getStartByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::BrandParameter::Builder::setStartByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline ::uint32_t Declaration::BrandParameter::Reader::getEndByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Declaration::BrandParameter::Builder::getEndByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void Declaration::BrandParameter::Builder::setEndByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::AnnotationApplication::Reader::hasName() const { + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::AnnotationApplication::Builder::hasName() { + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Declaration::AnnotationApplication::Reader::getName() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Declaration::AnnotationApplication::Builder::getName() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::Expression::Pipeline Declaration::AnnotationApplication::Pipeline::getName() { + return ::capnp::compiler::Expression::Pipeline(_typeless.getPointerField(0)); +} +#endif // !CAPNP_LITE +inline void Declaration::AnnotationApplication::Builder::setName( ::capnp::compiler::Expression::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Declaration::AnnotationApplication::Builder::initName() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Declaration::AnnotationApplication::Builder::adoptName( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Declaration::AnnotationApplication::Builder::disownName() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline typename Declaration::AnnotationApplication::Value::Reader Declaration::AnnotationApplication::Reader::getValue() const { + return typename Declaration::AnnotationApplication::Value::Reader(_reader); +} +inline typename Declaration::AnnotationApplication::Value::Builder Declaration::AnnotationApplication::Builder::getValue() { + return typename Declaration::AnnotationApplication::Value::Builder(_builder); +} +#if !CAPNP_LITE +inline typename Declaration::AnnotationApplication::Value::Pipeline Declaration::AnnotationApplication::Pipeline::getValue() { + return typename Declaration::AnnotationApplication::Value::Pipeline(_typeless.noop()); +} +#endif // !CAPNP_LITE +inline typename Declaration::AnnotationApplication::Value::Builder Declaration::AnnotationApplication::Builder::initValue() { + _builder.setDataField< ::uint16_t>(::capnp::bounded<0>() * ::capnp::ELEMENTS, 0); + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS).clear(); + return typename Declaration::AnnotationApplication::Value::Builder(_builder); +} +inline ::capnp::compiler::Declaration::AnnotationApplication::Value::Which Declaration::AnnotationApplication::Value::Reader::which() const { + return _reader.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline ::capnp::compiler::Declaration::AnnotationApplication::Value::Which Declaration::AnnotationApplication::Value::Builder::which() { + return _builder.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::AnnotationApplication::Value::Reader::isNone() const { + return which() == Declaration::AnnotationApplication::Value::NONE; +} +inline bool Declaration::AnnotationApplication::Value::Builder::isNone() { + return which() == Declaration::AnnotationApplication::Value::NONE; +} +inline ::capnp::Void Declaration::AnnotationApplication::Value::Reader::getNone() const { + KJ_IREQUIRE((which() == Declaration::AnnotationApplication::Value::NONE), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::AnnotationApplication::Value::Builder::getNone() { + KJ_IREQUIRE((which() == Declaration::AnnotationApplication::Value::NONE), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::AnnotationApplication::Value::Builder::setNone( ::capnp::Void value) { + _builder.setDataField<Declaration::AnnotationApplication::Value::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::AnnotationApplication::Value::NONE); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::AnnotationApplication::Value::Reader::isExpression() const { + return which() == Declaration::AnnotationApplication::Value::EXPRESSION; +} +inline bool Declaration::AnnotationApplication::Value::Builder::isExpression() { + return which() == Declaration::AnnotationApplication::Value::EXPRESSION; +} +inline bool Declaration::AnnotationApplication::Value::Reader::hasExpression() const { + if (which() != Declaration::AnnotationApplication::Value::EXPRESSION) return false; + return !_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::AnnotationApplication::Value::Builder::hasExpression() { + if (which() != Declaration::AnnotationApplication::Value::EXPRESSION) return false; + return !_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Declaration::AnnotationApplication::Value::Reader::getExpression() const { + KJ_IREQUIRE((which() == Declaration::AnnotationApplication::Value::EXPRESSION), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Declaration::AnnotationApplication::Value::Builder::getExpression() { + KJ_IREQUIRE((which() == Declaration::AnnotationApplication::Value::EXPRESSION), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void Declaration::AnnotationApplication::Value::Builder::setExpression( ::capnp::compiler::Expression::Reader value) { + _builder.setDataField<Declaration::AnnotationApplication::Value::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::AnnotationApplication::Value::EXPRESSION); + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Declaration::AnnotationApplication::Value::Builder::initExpression() { + _builder.setDataField<Declaration::AnnotationApplication::Value::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::AnnotationApplication::Value::EXPRESSION); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void Declaration::AnnotationApplication::Value::Builder::adoptExpression( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + _builder.setDataField<Declaration::AnnotationApplication::Value::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::AnnotationApplication::Value::EXPRESSION); + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Declaration::AnnotationApplication::Value::Builder::disownExpression() { + KJ_IREQUIRE((which() == Declaration::AnnotationApplication::Value::EXPRESSION), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} + +inline ::capnp::compiler::Declaration::ParamList::Which Declaration::ParamList::Reader::which() const { + return _reader.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline ::capnp::compiler::Declaration::ParamList::Which Declaration::ParamList::Builder::which() { + return _builder.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::ParamList::Reader::isNamedList() const { + return which() == Declaration::ParamList::NAMED_LIST; +} +inline bool Declaration::ParamList::Builder::isNamedList() { + return which() == Declaration::ParamList::NAMED_LIST; +} +inline bool Declaration::ParamList::Reader::hasNamedList() const { + if (which() != Declaration::ParamList::NAMED_LIST) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::ParamList::Builder::hasNamedList() { + if (which() != Declaration::ParamList::NAMED_LIST) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::compiler::Declaration::Param>::Reader Declaration::ParamList::Reader::getNamedList() const { + KJ_IREQUIRE((which() == Declaration::ParamList::NAMED_LIST), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::Param>>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::compiler::Declaration::Param>::Builder Declaration::ParamList::Builder::getNamedList() { + KJ_IREQUIRE((which() == Declaration::ParamList::NAMED_LIST), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::Param>>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Declaration::ParamList::Builder::setNamedList( ::capnp::List< ::capnp::compiler::Declaration::Param>::Reader value) { + _builder.setDataField<Declaration::ParamList::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::ParamList::NAMED_LIST); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::Param>>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::compiler::Declaration::Param>::Builder Declaration::ParamList::Builder::initNamedList(unsigned int size) { + _builder.setDataField<Declaration::ParamList::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::ParamList::NAMED_LIST); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::Param>>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void Declaration::ParamList::Builder::adoptNamedList( + ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::Param>>&& value) { + _builder.setDataField<Declaration::ParamList::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::ParamList::NAMED_LIST); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::Param>>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::Param>> Declaration::ParamList::Builder::disownNamedList() { + KJ_IREQUIRE((which() == Declaration::ParamList::NAMED_LIST), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::Param>>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Declaration::ParamList::Reader::isType() const { + return which() == Declaration::ParamList::TYPE; +} +inline bool Declaration::ParamList::Builder::isType() { + return which() == Declaration::ParamList::TYPE; +} +inline bool Declaration::ParamList::Reader::hasType() const { + if (which() != Declaration::ParamList::TYPE) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::ParamList::Builder::hasType() { + if (which() != Declaration::ParamList::TYPE) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Declaration::ParamList::Reader::getType() const { + KJ_IREQUIRE((which() == Declaration::ParamList::TYPE), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Declaration::ParamList::Builder::getType() { + KJ_IREQUIRE((which() == Declaration::ParamList::TYPE), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Declaration::ParamList::Builder::setType( ::capnp::compiler::Expression::Reader value) { + _builder.setDataField<Declaration::ParamList::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::ParamList::TYPE); + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Declaration::ParamList::Builder::initType() { + _builder.setDataField<Declaration::ParamList::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::ParamList::TYPE); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Declaration::ParamList::Builder::adoptType( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + _builder.setDataField<Declaration::ParamList::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::ParamList::TYPE); + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Declaration::ParamList::Builder::disownType() { + KJ_IREQUIRE((which() == Declaration::ParamList::TYPE), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline ::uint32_t Declaration::ParamList::Reader::getStartByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Declaration::ParamList::Builder::getStartByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void Declaration::ParamList::Builder::setStartByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + +inline ::uint32_t Declaration::ParamList::Reader::getEndByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Declaration::ParamList::Builder::getEndByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS); +} +inline void Declaration::ParamList::Builder::setEndByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Param::Reader::hasName() const { + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Param::Builder::hasName() { + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::LocatedText::Reader Declaration::Param::Reader::getName() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::LocatedText::Builder Declaration::Param::Builder::getName() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::LocatedText::Pipeline Declaration::Param::Pipeline::getName() { + return ::capnp::compiler::LocatedText::Pipeline(_typeless.getPointerField(0)); +} +#endif // !CAPNP_LITE +inline void Declaration::Param::Builder::setName( ::capnp::compiler::LocatedText::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::LocatedText::Builder Declaration::Param::Builder::initName() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Declaration::Param::Builder::adoptName( + ::capnp::Orphan< ::capnp::compiler::LocatedText>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::LocatedText> Declaration::Param::Builder::disownName() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedText>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Param::Reader::hasType() const { + return !_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Param::Builder::hasType() { + return !_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Declaration::Param::Reader::getType() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Declaration::Param::Builder::getType() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::Expression::Pipeline Declaration::Param::Pipeline::getType() { + return ::capnp::compiler::Expression::Pipeline(_typeless.getPointerField(1)); +} +#endif // !CAPNP_LITE +inline void Declaration::Param::Builder::setType( ::capnp::compiler::Expression::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Declaration::Param::Builder::initType() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void Declaration::Param::Builder::adoptType( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Declaration::Param::Builder::disownType() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Param::Reader::hasAnnotations() const { + return !_reader.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Param::Builder::hasAnnotations() { + return !_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Reader Declaration::Param::Reader::getAnnotations() const { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>::get(_reader.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Builder Declaration::Param::Builder::getAnnotations() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>::get(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS)); +} +inline void Declaration::Param::Builder::setAnnotations( ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>::set(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>::Builder Declaration::Param::Builder::initAnnotations(unsigned int size) { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>::init(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS), size); +} +inline void Declaration::Param::Builder::adoptAnnotations( + ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>&& value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>::adopt(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>> Declaration::Param::Builder::disownAnnotations() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Declaration::AnnotationApplication>>::disown(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS)); +} + +inline typename Declaration::Param::DefaultValue::Reader Declaration::Param::Reader::getDefaultValue() const { + return typename Declaration::Param::DefaultValue::Reader(_reader); +} +inline typename Declaration::Param::DefaultValue::Builder Declaration::Param::Builder::getDefaultValue() { + return typename Declaration::Param::DefaultValue::Builder(_builder); +} +#if !CAPNP_LITE +inline typename Declaration::Param::DefaultValue::Pipeline Declaration::Param::Pipeline::getDefaultValue() { + return typename Declaration::Param::DefaultValue::Pipeline(_typeless.noop()); +} +#endif // !CAPNP_LITE +inline typename Declaration::Param::DefaultValue::Builder Declaration::Param::Builder::initDefaultValue() { + _builder.setDataField< ::uint16_t>(::capnp::bounded<0>() * ::capnp::ELEMENTS, 0); + _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); + return typename Declaration::Param::DefaultValue::Builder(_builder); +} +inline ::uint32_t Declaration::Param::Reader::getStartByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Declaration::Param::Builder::getStartByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void Declaration::Param::Builder::setStartByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + +inline ::uint32_t Declaration::Param::Reader::getEndByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Declaration::Param::Builder::getEndByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS); +} +inline void Declaration::Param::Builder::setEndByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); +} + +inline ::capnp::compiler::Declaration::Param::DefaultValue::Which Declaration::Param::DefaultValue::Reader::which() const { + return _reader.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline ::capnp::compiler::Declaration::Param::DefaultValue::Which Declaration::Param::DefaultValue::Builder::which() { + return _builder.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Param::DefaultValue::Reader::isNone() const { + return which() == Declaration::Param::DefaultValue::NONE; +} +inline bool Declaration::Param::DefaultValue::Builder::isNone() { + return which() == Declaration::Param::DefaultValue::NONE; +} +inline ::capnp::Void Declaration::Param::DefaultValue::Reader::getNone() const { + KJ_IREQUIRE((which() == Declaration::Param::DefaultValue::NONE), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Param::DefaultValue::Builder::getNone() { + KJ_IREQUIRE((which() == Declaration::Param::DefaultValue::NONE), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Param::DefaultValue::Builder::setNone( ::capnp::Void value) { + _builder.setDataField<Declaration::Param::DefaultValue::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::Param::DefaultValue::NONE); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Param::DefaultValue::Reader::isValue() const { + return which() == Declaration::Param::DefaultValue::VALUE; +} +inline bool Declaration::Param::DefaultValue::Builder::isValue() { + return which() == Declaration::Param::DefaultValue::VALUE; +} +inline bool Declaration::Param::DefaultValue::Reader::hasValue() const { + if (which() != Declaration::Param::DefaultValue::VALUE) return false; + return !_reader.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Param::DefaultValue::Builder::hasValue() { + if (which() != Declaration::Param::DefaultValue::VALUE) return false; + return !_builder.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Declaration::Param::DefaultValue::Reader::getValue() const { + KJ_IREQUIRE((which() == Declaration::Param::DefaultValue::VALUE), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Declaration::Param::DefaultValue::Builder::getValue() { + KJ_IREQUIRE((which() == Declaration::Param::DefaultValue::VALUE), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS)); +} +inline void Declaration::Param::DefaultValue::Builder::setValue( ::capnp::compiler::Expression::Reader value) { + _builder.setDataField<Declaration::Param::DefaultValue::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::Param::DefaultValue::VALUE); + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Declaration::Param::DefaultValue::Builder::initValue() { + _builder.setDataField<Declaration::Param::DefaultValue::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::Param::DefaultValue::VALUE); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS)); +} +inline void Declaration::Param::DefaultValue::Builder::adoptValue( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + _builder.setDataField<Declaration::Param::DefaultValue::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::Param::DefaultValue::VALUE); + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Declaration::Param::DefaultValue::Builder::disownValue() { + KJ_IREQUIRE((which() == Declaration::Param::DefaultValue::VALUE), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<3>() * ::capnp::POINTERS)); +} + +inline ::capnp::compiler::Declaration::Id::Which Declaration::Id::Reader::which() const { + return _reader.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline ::capnp::compiler::Declaration::Id::Which Declaration::Id::Builder::which() { + return _builder.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Id::Reader::isUnspecified() const { + return which() == Declaration::Id::UNSPECIFIED; +} +inline bool Declaration::Id::Builder::isUnspecified() { + return which() == Declaration::Id::UNSPECIFIED; +} +inline ::capnp::Void Declaration::Id::Reader::getUnspecified() const { + KJ_IREQUIRE((which() == Declaration::Id::UNSPECIFIED), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Id::Builder::getUnspecified() { + KJ_IREQUIRE((which() == Declaration::Id::UNSPECIFIED), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Id::Builder::setUnspecified( ::capnp::Void value) { + _builder.setDataField<Declaration::Id::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::Id::UNSPECIFIED); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Id::Reader::isUid() const { + return which() == Declaration::Id::UID; +} +inline bool Declaration::Id::Builder::isUid() { + return which() == Declaration::Id::UID; +} +inline bool Declaration::Id::Reader::hasUid() const { + if (which() != Declaration::Id::UID) return false; + return !_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Id::Builder::hasUid() { + if (which() != Declaration::Id::UID) return false; + return !_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::LocatedInteger::Reader Declaration::Id::Reader::getUid() const { + KJ_IREQUIRE((which() == Declaration::Id::UID), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::get(_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::LocatedInteger::Builder Declaration::Id::Builder::getUid() { + KJ_IREQUIRE((which() == Declaration::Id::UID), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::get(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void Declaration::Id::Builder::setUid( ::capnp::compiler::LocatedInteger::Reader value) { + _builder.setDataField<Declaration::Id::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::Id::UID); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::set(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::LocatedInteger::Builder Declaration::Id::Builder::initUid() { + _builder.setDataField<Declaration::Id::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::Id::UID); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::init(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void Declaration::Id::Builder::adoptUid( + ::capnp::Orphan< ::capnp::compiler::LocatedInteger>&& value) { + _builder.setDataField<Declaration::Id::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::Id::UID); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::adopt(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::LocatedInteger> Declaration::Id::Builder::disownUid() { + KJ_IREQUIRE((which() == Declaration::Id::UID), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::disown(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Id::Reader::isOrdinal() const { + return which() == Declaration::Id::ORDINAL; +} +inline bool Declaration::Id::Builder::isOrdinal() { + return which() == Declaration::Id::ORDINAL; +} +inline bool Declaration::Id::Reader::hasOrdinal() const { + if (which() != Declaration::Id::ORDINAL) return false; + return !_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Id::Builder::hasOrdinal() { + if (which() != Declaration::Id::ORDINAL) return false; + return !_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::LocatedInteger::Reader Declaration::Id::Reader::getOrdinal() const { + KJ_IREQUIRE((which() == Declaration::Id::ORDINAL), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::get(_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::LocatedInteger::Builder Declaration::Id::Builder::getOrdinal() { + KJ_IREQUIRE((which() == Declaration::Id::ORDINAL), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::get(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void Declaration::Id::Builder::setOrdinal( ::capnp::compiler::LocatedInteger::Reader value) { + _builder.setDataField<Declaration::Id::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::Id::ORDINAL); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::set(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::LocatedInteger::Builder Declaration::Id::Builder::initOrdinal() { + _builder.setDataField<Declaration::Id::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::Id::ORDINAL); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::init(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void Declaration::Id::Builder::adoptOrdinal( + ::capnp::Orphan< ::capnp::compiler::LocatedInteger>&& value) { + _builder.setDataField<Declaration::Id::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Declaration::Id::ORDINAL); + ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::adopt(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::LocatedInteger> Declaration::Id::Builder::disownOrdinal() { + KJ_IREQUIRE((which() == Declaration::Id::ORDINAL), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::LocatedInteger>::disown(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Using::Reader::hasTarget() const { + return !_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Using::Builder::hasTarget() { + return !_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Declaration::Using::Reader::getTarget() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Declaration::Using::Builder::getTarget() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::Expression::Pipeline Declaration::Using::Pipeline::getTarget() { + return ::capnp::compiler::Expression::Pipeline(_typeless.getPointerField(5)); +} +#endif // !CAPNP_LITE +inline void Declaration::Using::Builder::setTarget( ::capnp::compiler::Expression::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Declaration::Using::Builder::initTarget() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline void Declaration::Using::Builder::adoptTarget( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Declaration::Using::Builder::disownTarget() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Const::Reader::hasType() const { + return !_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Const::Builder::hasType() { + return !_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Declaration::Const::Reader::getType() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Declaration::Const::Builder::getType() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::Expression::Pipeline Declaration::Const::Pipeline::getType() { + return ::capnp::compiler::Expression::Pipeline(_typeless.getPointerField(5)); +} +#endif // !CAPNP_LITE +inline void Declaration::Const::Builder::setType( ::capnp::compiler::Expression::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Declaration::Const::Builder::initType() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline void Declaration::Const::Builder::adoptType( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Declaration::Const::Builder::disownType() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Const::Reader::hasValue() const { + return !_reader.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Const::Builder::hasValue() { + return !_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Declaration::Const::Reader::getValue() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Declaration::Const::Builder::getValue() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::Expression::Pipeline Declaration::Const::Pipeline::getValue() { + return ::capnp::compiler::Expression::Pipeline(_typeless.getPointerField(6)); +} +#endif // !CAPNP_LITE +inline void Declaration::Const::Builder::setValue( ::capnp::compiler::Expression::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Declaration::Const::Builder::initValue() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS)); +} +inline void Declaration::Const::Builder::adoptValue( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Declaration::Const::Builder::disownValue() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Field::Reader::hasType() const { + return !_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Field::Builder::hasType() { + return !_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Declaration::Field::Reader::getType() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Declaration::Field::Builder::getType() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::Expression::Pipeline Declaration::Field::Pipeline::getType() { + return ::capnp::compiler::Expression::Pipeline(_typeless.getPointerField(5)); +} +#endif // !CAPNP_LITE +inline void Declaration::Field::Builder::setType( ::capnp::compiler::Expression::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Declaration::Field::Builder::initType() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline void Declaration::Field::Builder::adoptType( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Declaration::Field::Builder::disownType() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} + +inline typename Declaration::Field::DefaultValue::Reader Declaration::Field::Reader::getDefaultValue() const { + return typename Declaration::Field::DefaultValue::Reader(_reader); +} +inline typename Declaration::Field::DefaultValue::Builder Declaration::Field::Builder::getDefaultValue() { + return typename Declaration::Field::DefaultValue::Builder(_builder); +} +#if !CAPNP_LITE +inline typename Declaration::Field::DefaultValue::Pipeline Declaration::Field::Pipeline::getDefaultValue() { + return typename Declaration::Field::DefaultValue::Pipeline(_typeless.noop()); +} +#endif // !CAPNP_LITE +inline typename Declaration::Field::DefaultValue::Builder Declaration::Field::Builder::initDefaultValue() { + _builder.setDataField< ::uint16_t>(::capnp::bounded<6>() * ::capnp::ELEMENTS, 0); + _builder.getPointerField(::capnp::bounded<6>() * ::capnp::POINTERS).clear(); + return typename Declaration::Field::DefaultValue::Builder(_builder); +} +inline ::capnp::compiler::Declaration::Field::DefaultValue::Which Declaration::Field::DefaultValue::Reader::which() const { + return _reader.getDataField<Which>( + ::capnp::bounded<6>() * ::capnp::ELEMENTS); +} +inline ::capnp::compiler::Declaration::Field::DefaultValue::Which Declaration::Field::DefaultValue::Builder::which() { + return _builder.getDataField<Which>( + ::capnp::bounded<6>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Field::DefaultValue::Reader::isNone() const { + return which() == Declaration::Field::DefaultValue::NONE; +} +inline bool Declaration::Field::DefaultValue::Builder::isNone() { + return which() == Declaration::Field::DefaultValue::NONE; +} +inline ::capnp::Void Declaration::Field::DefaultValue::Reader::getNone() const { + KJ_IREQUIRE((which() == Declaration::Field::DefaultValue::NONE), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Field::DefaultValue::Builder::getNone() { + KJ_IREQUIRE((which() == Declaration::Field::DefaultValue::NONE), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Field::DefaultValue::Builder::setNone( ::capnp::Void value) { + _builder.setDataField<Declaration::Field::DefaultValue::Which>( + ::capnp::bounded<6>() * ::capnp::ELEMENTS, Declaration::Field::DefaultValue::NONE); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Field::DefaultValue::Reader::isValue() const { + return which() == Declaration::Field::DefaultValue::VALUE; +} +inline bool Declaration::Field::DefaultValue::Builder::isValue() { + return which() == Declaration::Field::DefaultValue::VALUE; +} +inline bool Declaration::Field::DefaultValue::Reader::hasValue() const { + if (which() != Declaration::Field::DefaultValue::VALUE) return false; + return !_reader.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Field::DefaultValue::Builder::hasValue() { + if (which() != Declaration::Field::DefaultValue::VALUE) return false; + return !_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Declaration::Field::DefaultValue::Reader::getValue() const { + KJ_IREQUIRE((which() == Declaration::Field::DefaultValue::VALUE), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Declaration::Field::DefaultValue::Builder::getValue() { + KJ_IREQUIRE((which() == Declaration::Field::DefaultValue::VALUE), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS)); +} +inline void Declaration::Field::DefaultValue::Builder::setValue( ::capnp::compiler::Expression::Reader value) { + _builder.setDataField<Declaration::Field::DefaultValue::Which>( + ::capnp::bounded<6>() * ::capnp::ELEMENTS, Declaration::Field::DefaultValue::VALUE); + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Declaration::Field::DefaultValue::Builder::initValue() { + _builder.setDataField<Declaration::Field::DefaultValue::Which>( + ::capnp::bounded<6>() * ::capnp::ELEMENTS, Declaration::Field::DefaultValue::VALUE); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS)); +} +inline void Declaration::Field::DefaultValue::Builder::adoptValue( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + _builder.setDataField<Declaration::Field::DefaultValue::Which>( + ::capnp::bounded<6>() * ::capnp::ELEMENTS, Declaration::Field::DefaultValue::VALUE); + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Declaration::Field::DefaultValue::Builder::disownValue() { + KJ_IREQUIRE((which() == Declaration::Field::DefaultValue::VALUE), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Interface::Reader::hasSuperclasses() const { + return !_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Interface::Builder::hasSuperclasses() { + return !_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::compiler::Expression>::Reader Declaration::Interface::Reader::getSuperclasses() const { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression>>::get(_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::compiler::Expression>::Builder Declaration::Interface::Builder::getSuperclasses() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression>>::get(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline void Declaration::Interface::Builder::setSuperclasses( ::capnp::List< ::capnp::compiler::Expression>::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression>>::set(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::compiler::Expression>::Builder Declaration::Interface::Builder::initSuperclasses(unsigned int size) { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression>>::init(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), size); +} +inline void Declaration::Interface::Builder::adoptSuperclasses( + ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression>>&& value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression>>::adopt(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Expression>> Declaration::Interface::Builder::disownSuperclasses() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Expression>>::disown(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Method::Reader::hasParams() const { + return !_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Method::Builder::hasParams() { + return !_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Declaration::ParamList::Reader Declaration::Method::Reader::getParams() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::ParamList>::get(_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Declaration::ParamList::Builder Declaration::Method::Builder::getParams() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::ParamList>::get(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::Declaration::ParamList::Pipeline Declaration::Method::Pipeline::getParams() { + return ::capnp::compiler::Declaration::ParamList::Pipeline(_typeless.getPointerField(5)); +} +#endif // !CAPNP_LITE +inline void Declaration::Method::Builder::setParams( ::capnp::compiler::Declaration::ParamList::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::ParamList>::set(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Declaration::ParamList::Builder Declaration::Method::Builder::initParams() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::ParamList>::init(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline void Declaration::Method::Builder::adoptParams( + ::capnp::Orphan< ::capnp::compiler::Declaration::ParamList>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::ParamList>::adopt(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Declaration::ParamList> Declaration::Method::Builder::disownParams() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::ParamList>::disown(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} + +inline typename Declaration::Method::Results::Reader Declaration::Method::Reader::getResults() const { + return typename Declaration::Method::Results::Reader(_reader); +} +inline typename Declaration::Method::Results::Builder Declaration::Method::Builder::getResults() { + return typename Declaration::Method::Results::Builder(_builder); +} +#if !CAPNP_LITE +inline typename Declaration::Method::Results::Pipeline Declaration::Method::Pipeline::getResults() { + return typename Declaration::Method::Results::Pipeline(_typeless.noop()); +} +#endif // !CAPNP_LITE +inline typename Declaration::Method::Results::Builder Declaration::Method::Builder::initResults() { + _builder.setDataField< ::uint16_t>(::capnp::bounded<6>() * ::capnp::ELEMENTS, 0); + _builder.getPointerField(::capnp::bounded<6>() * ::capnp::POINTERS).clear(); + return typename Declaration::Method::Results::Builder(_builder); +} +inline ::capnp::compiler::Declaration::Method::Results::Which Declaration::Method::Results::Reader::which() const { + return _reader.getDataField<Which>( + ::capnp::bounded<6>() * ::capnp::ELEMENTS); +} +inline ::capnp::compiler::Declaration::Method::Results::Which Declaration::Method::Results::Builder::which() { + return _builder.getDataField<Which>( + ::capnp::bounded<6>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Method::Results::Reader::isNone() const { + return which() == Declaration::Method::Results::NONE; +} +inline bool Declaration::Method::Results::Builder::isNone() { + return which() == Declaration::Method::Results::NONE; +} +inline ::capnp::Void Declaration::Method::Results::Reader::getNone() const { + KJ_IREQUIRE((which() == Declaration::Method::Results::NONE), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Declaration::Method::Results::Builder::getNone() { + KJ_IREQUIRE((which() == Declaration::Method::Results::NONE), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Declaration::Method::Results::Builder::setNone( ::capnp::Void value) { + _builder.setDataField<Declaration::Method::Results::Which>( + ::capnp::bounded<6>() * ::capnp::ELEMENTS, Declaration::Method::Results::NONE); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Method::Results::Reader::isExplicit() const { + return which() == Declaration::Method::Results::EXPLICIT; +} +inline bool Declaration::Method::Results::Builder::isExplicit() { + return which() == Declaration::Method::Results::EXPLICIT; +} +inline bool Declaration::Method::Results::Reader::hasExplicit() const { + if (which() != Declaration::Method::Results::EXPLICIT) return false; + return !_reader.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Method::Results::Builder::hasExplicit() { + if (which() != Declaration::Method::Results::EXPLICIT) return false; + return !_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Declaration::ParamList::Reader Declaration::Method::Results::Reader::getExplicit() const { + KJ_IREQUIRE((which() == Declaration::Method::Results::EXPLICIT), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::ParamList>::get(_reader.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Declaration::ParamList::Builder Declaration::Method::Results::Builder::getExplicit() { + KJ_IREQUIRE((which() == Declaration::Method::Results::EXPLICIT), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::ParamList>::get(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS)); +} +inline void Declaration::Method::Results::Builder::setExplicit( ::capnp::compiler::Declaration::ParamList::Reader value) { + _builder.setDataField<Declaration::Method::Results::Which>( + ::capnp::bounded<6>() * ::capnp::ELEMENTS, Declaration::Method::Results::EXPLICIT); + ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::ParamList>::set(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Declaration::ParamList::Builder Declaration::Method::Results::Builder::initExplicit() { + _builder.setDataField<Declaration::Method::Results::Which>( + ::capnp::bounded<6>() * ::capnp::ELEMENTS, Declaration::Method::Results::EXPLICIT); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::ParamList>::init(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS)); +} +inline void Declaration::Method::Results::Builder::adoptExplicit( + ::capnp::Orphan< ::capnp::compiler::Declaration::ParamList>&& value) { + _builder.setDataField<Declaration::Method::Results::Which>( + ::capnp::bounded<6>() * ::capnp::ELEMENTS, Declaration::Method::Results::EXPLICIT); + ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::ParamList>::adopt(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Declaration::ParamList> Declaration::Method::Results::Builder::disownExplicit() { + KJ_IREQUIRE((which() == Declaration::Method::Results::EXPLICIT), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration::ParamList>::disown(_builder.getPointerField( + ::capnp::bounded<6>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Annotation::Reader::hasType() const { + return !_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline bool Declaration::Annotation::Builder::hasType() { + return !_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Expression::Reader Declaration::Annotation::Reader::getType() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_reader.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Expression::Builder Declaration::Annotation::Builder::getType() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::get(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::Expression::Pipeline Declaration::Annotation::Pipeline::getType() { + return ::capnp::compiler::Expression::Pipeline(_typeless.getPointerField(5)); +} +#endif // !CAPNP_LITE +inline void Declaration::Annotation::Builder::setType( ::capnp::compiler::Expression::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::set(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Expression::Builder Declaration::Annotation::Builder::initType() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::init(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline void Declaration::Annotation::Builder::adoptType( + ::capnp::Orphan< ::capnp::compiler::Expression>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::adopt(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Expression> Declaration::Annotation::Builder::disownType() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Expression>::disown(_builder.getPointerField( + ::capnp::bounded<5>() * ::capnp::POINTERS)); +} + +inline bool Declaration::Annotation::Reader::getTargetsFile() const { + return _reader.getDataField<bool>( + ::capnp::bounded<96>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Annotation::Builder::getTargetsFile() { + return _builder.getDataField<bool>( + ::capnp::bounded<96>() * ::capnp::ELEMENTS); +} +inline void Declaration::Annotation::Builder::setTargetsFile(bool value) { + _builder.setDataField<bool>( + ::capnp::bounded<96>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Annotation::Reader::getTargetsConst() const { + return _reader.getDataField<bool>( + ::capnp::bounded<97>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Annotation::Builder::getTargetsConst() { + return _builder.getDataField<bool>( + ::capnp::bounded<97>() * ::capnp::ELEMENTS); +} +inline void Declaration::Annotation::Builder::setTargetsConst(bool value) { + _builder.setDataField<bool>( + ::capnp::bounded<97>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Annotation::Reader::getTargetsEnum() const { + return _reader.getDataField<bool>( + ::capnp::bounded<98>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Annotation::Builder::getTargetsEnum() { + return _builder.getDataField<bool>( + ::capnp::bounded<98>() * ::capnp::ELEMENTS); +} +inline void Declaration::Annotation::Builder::setTargetsEnum(bool value) { + _builder.setDataField<bool>( + ::capnp::bounded<98>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Annotation::Reader::getTargetsEnumerant() const { + return _reader.getDataField<bool>( + ::capnp::bounded<99>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Annotation::Builder::getTargetsEnumerant() { + return _builder.getDataField<bool>( + ::capnp::bounded<99>() * ::capnp::ELEMENTS); +} +inline void Declaration::Annotation::Builder::setTargetsEnumerant(bool value) { + _builder.setDataField<bool>( + ::capnp::bounded<99>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Annotation::Reader::getTargetsStruct() const { + return _reader.getDataField<bool>( + ::capnp::bounded<100>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Annotation::Builder::getTargetsStruct() { + return _builder.getDataField<bool>( + ::capnp::bounded<100>() * ::capnp::ELEMENTS); +} +inline void Declaration::Annotation::Builder::setTargetsStruct(bool value) { + _builder.setDataField<bool>( + ::capnp::bounded<100>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Annotation::Reader::getTargetsField() const { + return _reader.getDataField<bool>( + ::capnp::bounded<101>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Annotation::Builder::getTargetsField() { + return _builder.getDataField<bool>( + ::capnp::bounded<101>() * ::capnp::ELEMENTS); +} +inline void Declaration::Annotation::Builder::setTargetsField(bool value) { + _builder.setDataField<bool>( + ::capnp::bounded<101>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Annotation::Reader::getTargetsUnion() const { + return _reader.getDataField<bool>( + ::capnp::bounded<102>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Annotation::Builder::getTargetsUnion() { + return _builder.getDataField<bool>( + ::capnp::bounded<102>() * ::capnp::ELEMENTS); +} +inline void Declaration::Annotation::Builder::setTargetsUnion(bool value) { + _builder.setDataField<bool>( + ::capnp::bounded<102>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Annotation::Reader::getTargetsGroup() const { + return _reader.getDataField<bool>( + ::capnp::bounded<103>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Annotation::Builder::getTargetsGroup() { + return _builder.getDataField<bool>( + ::capnp::bounded<103>() * ::capnp::ELEMENTS); +} +inline void Declaration::Annotation::Builder::setTargetsGroup(bool value) { + _builder.setDataField<bool>( + ::capnp::bounded<103>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Annotation::Reader::getTargetsInterface() const { + return _reader.getDataField<bool>( + ::capnp::bounded<104>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Annotation::Builder::getTargetsInterface() { + return _builder.getDataField<bool>( + ::capnp::bounded<104>() * ::capnp::ELEMENTS); +} +inline void Declaration::Annotation::Builder::setTargetsInterface(bool value) { + _builder.setDataField<bool>( + ::capnp::bounded<104>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Annotation::Reader::getTargetsMethod() const { + return _reader.getDataField<bool>( + ::capnp::bounded<105>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Annotation::Builder::getTargetsMethod() { + return _builder.getDataField<bool>( + ::capnp::bounded<105>() * ::capnp::ELEMENTS); +} +inline void Declaration::Annotation::Builder::setTargetsMethod(bool value) { + _builder.setDataField<bool>( + ::capnp::bounded<105>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Annotation::Reader::getTargetsParam() const { + return _reader.getDataField<bool>( + ::capnp::bounded<106>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Annotation::Builder::getTargetsParam() { + return _builder.getDataField<bool>( + ::capnp::bounded<106>() * ::capnp::ELEMENTS); +} +inline void Declaration::Annotation::Builder::setTargetsParam(bool value) { + _builder.setDataField<bool>( + ::capnp::bounded<106>() * ::capnp::ELEMENTS, value); +} + +inline bool Declaration::Annotation::Reader::getTargetsAnnotation() const { + return _reader.getDataField<bool>( + ::capnp::bounded<107>() * ::capnp::ELEMENTS); +} + +inline bool Declaration::Annotation::Builder::getTargetsAnnotation() { + return _builder.getDataField<bool>( + ::capnp::bounded<107>() * ::capnp::ELEMENTS); +} +inline void Declaration::Annotation::Builder::setTargetsAnnotation(bool value) { + _builder.setDataField<bool>( + ::capnp::bounded<107>() * ::capnp::ELEMENTS, value); +} + +inline bool ParsedFile::Reader::hasRoot() const { + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool ParsedFile::Builder::hasRoot() { + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::compiler::Declaration::Reader ParsedFile::Reader::getRoot() const { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::compiler::Declaration::Builder ParsedFile::Builder::getRoot() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::capnp::compiler::Declaration::Pipeline ParsedFile::Pipeline::getRoot() { + return ::capnp::compiler::Declaration::Pipeline(_typeless.getPointerField(0)); +} +#endif // !CAPNP_LITE +inline void ParsedFile::Builder::setRoot( ::capnp::compiler::Declaration::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::compiler::Declaration::Builder ParsedFile::Builder::initRoot() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void ParsedFile::Builder::adoptRoot( + ::capnp::Orphan< ::capnp::compiler::Declaration>&& value) { + ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::compiler::Declaration> ParsedFile::Builder::disownRoot() { + return ::capnp::_::PointerHelpers< ::capnp::compiler::Declaration>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +} // namespace +} // namespace + +#endif // CAPNP_INCLUDED_c56be168dcbbc3c6_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/lexer.capnp.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/lexer.capnp.h new file mode 100644 index 0000000..0526751 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/lexer.capnp.h @@ -0,0 +1,1242 @@ +// Generated by Cap'n Proto compiler, DO NOT EDIT +// source: lexer.capnp + +#ifndef CAPNP_INCLUDED_a73956d2621fc3ee_ +#define CAPNP_INCLUDED_a73956d2621fc3ee_ + +#include <capnp/generated-header-support.h> + +#if CAPNP_VERSION != 7000 +#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." +#endif + + +namespace capnp { +namespace schemas { + +CAPNP_DECLARE_SCHEMA(91cc55cd57de5419); +CAPNP_DECLARE_SCHEMA(c6725e678d60fa37); +CAPNP_DECLARE_SCHEMA(9e69a92512b19d18); +CAPNP_DECLARE_SCHEMA(a11f97b9d6c73dd4); + +} // namespace schemas +} // namespace capnp + +namespace capnp { +namespace compiler { + +struct Token { + Token() = delete; + + class Reader; + class Builder; + class Pipeline; + enum Which: uint16_t { + IDENTIFIER, + STRING_LITERAL, + INTEGER_LITERAL, + FLOAT_LITERAL, + OPERATOR, + PARENTHESIZED_LIST, + BRACKETED_LIST, + BINARY_LITERAL, + }; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(91cc55cd57de5419, 3, 1) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct Statement { + Statement() = delete; + + class Reader; + class Builder; + class Pipeline; + enum Which: uint16_t { + LINE, + BLOCK, + }; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(c6725e678d60fa37, 2, 3) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct LexedTokens { + LexedTokens() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(9e69a92512b19d18, 0, 1) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +struct LexedStatements { + LexedStatements() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(a11f97b9d6c73dd4, 0, 1) + #if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } + #endif // !CAPNP_LITE + }; +}; + +// ======================================================================================= + +class Token::Reader { +public: + typedef Token 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 Which which() const; + inline bool isIdentifier() const; + inline bool hasIdentifier() const; + inline ::capnp::Text::Reader getIdentifier() const; + + inline bool isStringLiteral() const; + inline bool hasStringLiteral() const; + inline ::capnp::Text::Reader getStringLiteral() const; + + inline bool isIntegerLiteral() const; + inline ::uint64_t getIntegerLiteral() const; + + inline bool isFloatLiteral() const; + inline double getFloatLiteral() const; + + inline bool isOperator() const; + inline bool hasOperator() const; + inline ::capnp::Text::Reader getOperator() const; + + inline bool isParenthesizedList() const; + inline bool hasParenthesizedList() const; + inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader getParenthesizedList() const; + + inline bool isBracketedList() const; + inline bool hasBracketedList() const; + inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader getBracketedList() const; + + inline ::uint32_t getStartByte() const; + + inline ::uint32_t getEndByte() const; + + inline bool isBinaryLiteral() const; + inline bool hasBinaryLiteral() const; + inline ::capnp::Data::Reader getBinaryLiteral() 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 Token::Builder { +public: + typedef Token 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 Which which(); + inline bool isIdentifier(); + inline bool hasIdentifier(); + inline ::capnp::Text::Builder getIdentifier(); + inline void setIdentifier( ::capnp::Text::Reader value); + inline ::capnp::Text::Builder initIdentifier(unsigned int size); + inline void adoptIdentifier(::capnp::Orphan< ::capnp::Text>&& value); + inline ::capnp::Orphan< ::capnp::Text> disownIdentifier(); + + inline bool isStringLiteral(); + inline bool hasStringLiteral(); + inline ::capnp::Text::Builder getStringLiteral(); + inline void setStringLiteral( ::capnp::Text::Reader value); + inline ::capnp::Text::Builder initStringLiteral(unsigned int size); + inline void adoptStringLiteral(::capnp::Orphan< ::capnp::Text>&& value); + inline ::capnp::Orphan< ::capnp::Text> disownStringLiteral(); + + inline bool isIntegerLiteral(); + inline ::uint64_t getIntegerLiteral(); + inline void setIntegerLiteral( ::uint64_t value); + + inline bool isFloatLiteral(); + inline double getFloatLiteral(); + inline void setFloatLiteral(double value); + + inline bool isOperator(); + inline bool hasOperator(); + inline ::capnp::Text::Builder getOperator(); + inline void setOperator( ::capnp::Text::Reader value); + inline ::capnp::Text::Builder initOperator(unsigned int size); + inline void adoptOperator(::capnp::Orphan< ::capnp::Text>&& value); + inline ::capnp::Orphan< ::capnp::Text> disownOperator(); + + inline bool isParenthesizedList(); + inline bool hasParenthesizedList(); + inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder getParenthesizedList(); + inline void setParenthesizedList( ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader value); + inline void setParenthesizedList(::kj::ArrayPtr<const ::capnp::List< ::capnp::compiler::Token>::Reader> value); + inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder initParenthesizedList(unsigned int size); + inline void adoptParenthesizedList(::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>> disownParenthesizedList(); + + inline bool isBracketedList(); + inline bool hasBracketedList(); + inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder getBracketedList(); + inline void setBracketedList( ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader value); + inline void setBracketedList(::kj::ArrayPtr<const ::capnp::List< ::capnp::compiler::Token>::Reader> value); + inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder initBracketedList(unsigned int size); + inline void adoptBracketedList(::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>> disownBracketedList(); + + inline ::uint32_t getStartByte(); + inline void setStartByte( ::uint32_t value); + + inline ::uint32_t getEndByte(); + inline void setEndByte( ::uint32_t value); + + inline bool isBinaryLiteral(); + inline bool hasBinaryLiteral(); + inline ::capnp::Data::Builder getBinaryLiteral(); + inline void setBinaryLiteral( ::capnp::Data::Reader value); + inline ::capnp::Data::Builder initBinaryLiteral(unsigned int size); + inline void adoptBinaryLiteral(::capnp::Orphan< ::capnp::Data>&& value); + inline ::capnp::Orphan< ::capnp::Data> disownBinaryLiteral(); + +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 Token::Pipeline { +public: + typedef Token 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 Statement::Reader { +public: + typedef Statement 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 Which which() const; + inline bool hasTokens() const; + inline ::capnp::List< ::capnp::compiler::Token>::Reader getTokens() const; + + inline bool isLine() const; + inline ::capnp::Void getLine() const; + + inline bool isBlock() const; + inline bool hasBlock() const; + inline ::capnp::List< ::capnp::compiler::Statement>::Reader getBlock() const; + + inline bool hasDocComment() const; + inline ::capnp::Text::Reader getDocComment() const; + + inline ::uint32_t getStartByte() const; + + inline ::uint32_t getEndByte() 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 Statement::Builder { +public: + typedef Statement 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 Which which(); + inline bool hasTokens(); + inline ::capnp::List< ::capnp::compiler::Token>::Builder getTokens(); + inline void setTokens( ::capnp::List< ::capnp::compiler::Token>::Reader value); + inline ::capnp::List< ::capnp::compiler::Token>::Builder initTokens(unsigned int size); + inline void adoptTokens(::capnp::Orphan< ::capnp::List< ::capnp::compiler::Token>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Token>> disownTokens(); + + inline bool isLine(); + inline ::capnp::Void getLine(); + inline void setLine( ::capnp::Void value = ::capnp::VOID); + + inline bool isBlock(); + inline bool hasBlock(); + inline ::capnp::List< ::capnp::compiler::Statement>::Builder getBlock(); + inline void setBlock( ::capnp::List< ::capnp::compiler::Statement>::Reader value); + inline ::capnp::List< ::capnp::compiler::Statement>::Builder initBlock(unsigned int size); + inline void adoptBlock(::capnp::Orphan< ::capnp::List< ::capnp::compiler::Statement>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Statement>> disownBlock(); + + inline bool hasDocComment(); + inline ::capnp::Text::Builder getDocComment(); + inline void setDocComment( ::capnp::Text::Reader value); + inline ::capnp::Text::Builder initDocComment(unsigned int size); + inline void adoptDocComment(::capnp::Orphan< ::capnp::Text>&& value); + inline ::capnp::Orphan< ::capnp::Text> disownDocComment(); + + inline ::uint32_t getStartByte(); + inline void setStartByte( ::uint32_t value); + + inline ::uint32_t getEndByte(); + inline void setEndByte( ::uint32_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 Statement::Pipeline { +public: + typedef Statement 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 LexedTokens::Reader { +public: + typedef LexedTokens 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 hasTokens() const; + inline ::capnp::List< ::capnp::compiler::Token>::Reader getTokens() 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 LexedTokens::Builder { +public: + typedef LexedTokens 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 hasTokens(); + inline ::capnp::List< ::capnp::compiler::Token>::Builder getTokens(); + inline void setTokens( ::capnp::List< ::capnp::compiler::Token>::Reader value); + inline ::capnp::List< ::capnp::compiler::Token>::Builder initTokens(unsigned int size); + inline void adoptTokens(::capnp::Orphan< ::capnp::List< ::capnp::compiler::Token>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Token>> disownTokens(); + +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 LexedTokens::Pipeline { +public: + typedef LexedTokens 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 LexedStatements::Reader { +public: + typedef LexedStatements 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 hasStatements() const; + inline ::capnp::List< ::capnp::compiler::Statement>::Reader getStatements() 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 LexedStatements::Builder { +public: + typedef LexedStatements 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 hasStatements(); + inline ::capnp::List< ::capnp::compiler::Statement>::Builder getStatements(); + inline void setStatements( ::capnp::List< ::capnp::compiler::Statement>::Reader value); + inline ::capnp::List< ::capnp::compiler::Statement>::Builder initStatements(unsigned int size); + inline void adoptStatements(::capnp::Orphan< ::capnp::List< ::capnp::compiler::Statement>>&& value); + inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Statement>> disownStatements(); + +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 LexedStatements::Pipeline { +public: + typedef LexedStatements 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 + +// ======================================================================================= + +inline ::capnp::compiler::Token::Which Token::Reader::which() const { + return _reader.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline ::capnp::compiler::Token::Which Token::Builder::which() { + return _builder.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline bool Token::Reader::isIdentifier() const { + return which() == Token::IDENTIFIER; +} +inline bool Token::Builder::isIdentifier() { + return which() == Token::IDENTIFIER; +} +inline bool Token::Reader::hasIdentifier() const { + if (which() != Token::IDENTIFIER) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Token::Builder::hasIdentifier() { + if (which() != Token::IDENTIFIER) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::Text::Reader Token::Reader::getIdentifier() const { + KJ_IREQUIRE((which() == Token::IDENTIFIER), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder Token::Builder::getIdentifier() { + KJ_IREQUIRE((which() == Token::IDENTIFIER), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Token::Builder::setIdentifier( ::capnp::Text::Reader value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::IDENTIFIER); + ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::Text::Builder Token::Builder::initIdentifier(unsigned int size) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::IDENTIFIER); + return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void Token::Builder::adoptIdentifier( + ::capnp::Orphan< ::capnp::Text>&& value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::IDENTIFIER); + ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::Text> Token::Builder::disownIdentifier() { + KJ_IREQUIRE((which() == Token::IDENTIFIER), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Token::Reader::isStringLiteral() const { + return which() == Token::STRING_LITERAL; +} +inline bool Token::Builder::isStringLiteral() { + return which() == Token::STRING_LITERAL; +} +inline bool Token::Reader::hasStringLiteral() const { + if (which() != Token::STRING_LITERAL) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Token::Builder::hasStringLiteral() { + if (which() != Token::STRING_LITERAL) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::Text::Reader Token::Reader::getStringLiteral() const { + KJ_IREQUIRE((which() == Token::STRING_LITERAL), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder Token::Builder::getStringLiteral() { + KJ_IREQUIRE((which() == Token::STRING_LITERAL), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Token::Builder::setStringLiteral( ::capnp::Text::Reader value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::STRING_LITERAL); + ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::Text::Builder Token::Builder::initStringLiteral(unsigned int size) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::STRING_LITERAL); + return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void Token::Builder::adoptStringLiteral( + ::capnp::Orphan< ::capnp::Text>&& value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::STRING_LITERAL); + ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::Text> Token::Builder::disownStringLiteral() { + KJ_IREQUIRE((which() == Token::STRING_LITERAL), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Token::Reader::isIntegerLiteral() const { + return which() == Token::INTEGER_LITERAL; +} +inline bool Token::Builder::isIntegerLiteral() { + return which() == Token::INTEGER_LITERAL; +} +inline ::uint64_t Token::Reader::getIntegerLiteral() const { + KJ_IREQUIRE((which() == Token::INTEGER_LITERAL), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline ::uint64_t Token::Builder::getIntegerLiteral() { + KJ_IREQUIRE((which() == Token::INTEGER_LITERAL), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void Token::Builder::setIntegerLiteral( ::uint64_t value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::INTEGER_LITERAL); + _builder.setDataField< ::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + +inline bool Token::Reader::isFloatLiteral() const { + return which() == Token::FLOAT_LITERAL; +} +inline bool Token::Builder::isFloatLiteral() { + return which() == Token::FLOAT_LITERAL; +} +inline double Token::Reader::getFloatLiteral() const { + KJ_IREQUIRE((which() == Token::FLOAT_LITERAL), + "Must check which() before get()ing a union member."); + return _reader.getDataField<double>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline double Token::Builder::getFloatLiteral() { + KJ_IREQUIRE((which() == Token::FLOAT_LITERAL), + "Must check which() before get()ing a union member."); + return _builder.getDataField<double>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void Token::Builder::setFloatLiteral(double value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::FLOAT_LITERAL); + _builder.setDataField<double>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + +inline bool Token::Reader::isOperator() const { + return which() == Token::OPERATOR; +} +inline bool Token::Builder::isOperator() { + return which() == Token::OPERATOR; +} +inline bool Token::Reader::hasOperator() const { + if (which() != Token::OPERATOR) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Token::Builder::hasOperator() { + if (which() != Token::OPERATOR) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::Text::Reader Token::Reader::getOperator() const { + KJ_IREQUIRE((which() == Token::OPERATOR), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder Token::Builder::getOperator() { + KJ_IREQUIRE((which() == Token::OPERATOR), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Token::Builder::setOperator( ::capnp::Text::Reader value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::OPERATOR); + ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::Text::Builder Token::Builder::initOperator(unsigned int size) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::OPERATOR); + return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void Token::Builder::adoptOperator( + ::capnp::Orphan< ::capnp::Text>&& value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::OPERATOR); + ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::Text> Token::Builder::disownOperator() { + KJ_IREQUIRE((which() == Token::OPERATOR), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Token::Reader::isParenthesizedList() const { + return which() == Token::PARENTHESIZED_LIST; +} +inline bool Token::Builder::isParenthesizedList() { + return which() == Token::PARENTHESIZED_LIST; +} +inline bool Token::Reader::hasParenthesizedList() const { + if (which() != Token::PARENTHESIZED_LIST) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Token::Builder::hasParenthesizedList() { + if (which() != Token::PARENTHESIZED_LIST) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader Token::Reader::getParenthesizedList() const { + KJ_IREQUIRE((which() == Token::PARENTHESIZED_LIST), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder Token::Builder::getParenthesizedList() { + KJ_IREQUIRE((which() == Token::PARENTHESIZED_LIST), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Token::Builder::setParenthesizedList( ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::PARENTHESIZED_LIST); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline void Token::Builder::setParenthesizedList(::kj::ArrayPtr<const ::capnp::List< ::capnp::compiler::Token>::Reader> value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::PARENTHESIZED_LIST); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder Token::Builder::initParenthesizedList(unsigned int size) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::PARENTHESIZED_LIST); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void Token::Builder::adoptParenthesizedList( + ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>&& value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::PARENTHESIZED_LIST); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>> Token::Builder::disownParenthesizedList() { + KJ_IREQUIRE((which() == Token::PARENTHESIZED_LIST), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Token::Reader::isBracketedList() const { + return which() == Token::BRACKETED_LIST; +} +inline bool Token::Builder::isBracketedList() { + return which() == Token::BRACKETED_LIST; +} +inline bool Token::Reader::hasBracketedList() const { + if (which() != Token::BRACKETED_LIST) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Token::Builder::hasBracketedList() { + if (which() != Token::BRACKETED_LIST) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader Token::Reader::getBracketedList() const { + KJ_IREQUIRE((which() == Token::BRACKETED_LIST), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder Token::Builder::getBracketedList() { + KJ_IREQUIRE((which() == Token::BRACKETED_LIST), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Token::Builder::setBracketedList( ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::BRACKETED_LIST); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline void Token::Builder::setBracketedList(::kj::ArrayPtr<const ::capnp::List< ::capnp::compiler::Token>::Reader> value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::BRACKETED_LIST); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder Token::Builder::initBracketedList(unsigned int size) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::BRACKETED_LIST); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void Token::Builder::adoptBracketedList( + ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>&& value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::BRACKETED_LIST); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>> Token::Builder::disownBracketedList() { + KJ_IREQUIRE((which() == Token::BRACKETED_LIST), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline ::uint32_t Token::Reader::getStartByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Token::Builder::getStartByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void Token::Builder::setStartByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + +inline ::uint32_t Token::Reader::getEndByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<4>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Token::Builder::getEndByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<4>() * ::capnp::ELEMENTS); +} +inline void Token::Builder::setEndByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<4>() * ::capnp::ELEMENTS, value); +} + +inline bool Token::Reader::isBinaryLiteral() const { + return which() == Token::BINARY_LITERAL; +} +inline bool Token::Builder::isBinaryLiteral() { + return which() == Token::BINARY_LITERAL; +} +inline bool Token::Reader::hasBinaryLiteral() const { + if (which() != Token::BINARY_LITERAL) return false; + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Token::Builder::hasBinaryLiteral() { + if (which() != Token::BINARY_LITERAL) return false; + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::Data::Reader Token::Reader::getBinaryLiteral() const { + KJ_IREQUIRE((which() == Token::BINARY_LITERAL), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Data>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Data::Builder Token::Builder::getBinaryLiteral() { + KJ_IREQUIRE((which() == Token::BINARY_LITERAL), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Data>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Token::Builder::setBinaryLiteral( ::capnp::Data::Reader value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::BINARY_LITERAL); + ::capnp::_::PointerHelpers< ::capnp::Data>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::Data::Builder Token::Builder::initBinaryLiteral(unsigned int size) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::BINARY_LITERAL); + return ::capnp::_::PointerHelpers< ::capnp::Data>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void Token::Builder::adoptBinaryLiteral( + ::capnp::Orphan< ::capnp::Data>&& value) { + _builder.setDataField<Token::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Token::BINARY_LITERAL); + ::capnp::_::PointerHelpers< ::capnp::Data>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::Data> Token::Builder::disownBinaryLiteral() { + KJ_IREQUIRE((which() == Token::BINARY_LITERAL), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::Data>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline ::capnp::compiler::Statement::Which Statement::Reader::which() const { + return _reader.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline ::capnp::compiler::Statement::Which Statement::Builder::which() { + return _builder.getDataField<Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline bool Statement::Reader::hasTokens() const { + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool Statement::Builder::hasTokens() { + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::compiler::Token>::Reader Statement::Reader::getTokens() const { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Token>>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::compiler::Token>::Builder Statement::Builder::getTokens() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Token>>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void Statement::Builder::setTokens( ::capnp::List< ::capnp::compiler::Token>::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Token>>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::compiler::Token>::Builder Statement::Builder::initTokens(unsigned int size) { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Token>>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void Statement::Builder::adoptTokens( + ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Token>>&& value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Token>>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Token>> Statement::Builder::disownTokens() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Token>>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool Statement::Reader::isLine() const { + return which() == Statement::LINE; +} +inline bool Statement::Builder::isLine() { + return which() == Statement::LINE; +} +inline ::capnp::Void Statement::Reader::getLine() const { + KJ_IREQUIRE((which() == Statement::LINE), + "Must check which() before get()ing a union member."); + return _reader.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::capnp::Void Statement::Builder::getLine() { + KJ_IREQUIRE((which() == Statement::LINE), + "Must check which() before get()ing a union member."); + return _builder.getDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void Statement::Builder::setLine( ::capnp::Void value) { + _builder.setDataField<Statement::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Statement::LINE); + _builder.setDataField< ::capnp::Void>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool Statement::Reader::isBlock() const { + return which() == Statement::BLOCK; +} +inline bool Statement::Builder::isBlock() { + return which() == Statement::BLOCK; +} +inline bool Statement::Reader::hasBlock() const { + if (which() != Statement::BLOCK) return false; + return !_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline bool Statement::Builder::hasBlock() { + if (which() != Statement::BLOCK) return false; + return !_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::compiler::Statement>::Reader Statement::Reader::getBlock() const { + KJ_IREQUIRE((which() == Statement::BLOCK), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Statement>>::get(_reader.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::compiler::Statement>::Builder Statement::Builder::getBlock() { + KJ_IREQUIRE((which() == Statement::BLOCK), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Statement>>::get(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void Statement::Builder::setBlock( ::capnp::List< ::capnp::compiler::Statement>::Reader value) { + _builder.setDataField<Statement::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Statement::BLOCK); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Statement>>::set(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::compiler::Statement>::Builder Statement::Builder::initBlock(unsigned int size) { + _builder.setDataField<Statement::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Statement::BLOCK); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Statement>>::init(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), size); +} +inline void Statement::Builder::adoptBlock( + ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Statement>>&& value) { + _builder.setDataField<Statement::Which>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, Statement::BLOCK); + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Statement>>::adopt(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Statement>> Statement::Builder::disownBlock() { + KJ_IREQUIRE((which() == Statement::BLOCK), + "Must check which() before get()ing a union member."); + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Statement>>::disown(_builder.getPointerField( + ::capnp::bounded<1>() * ::capnp::POINTERS)); +} + +inline bool Statement::Reader::hasDocComment() const { + return !_reader.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); +} +inline bool Statement::Builder::hasDocComment() { + return !_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::Text::Reader Statement::Reader::getDocComment() const { + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder Statement::Builder::getDocComment() { + return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS)); +} +inline void Statement::Builder::setDocComment( ::capnp::Text::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS), value); +} +inline ::capnp::Text::Builder Statement::Builder::initDocComment(unsigned int size) { + return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS), size); +} +inline void Statement::Builder::adoptDocComment( + ::capnp::Orphan< ::capnp::Text>&& value) { + ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::Text> Statement::Builder::disownDocComment() { + return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( + ::capnp::bounded<2>() * ::capnp::POINTERS)); +} + +inline ::uint32_t Statement::Reader::getStartByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Statement::Builder::getStartByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void Statement::Builder::setStartByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + +inline ::uint32_t Statement::Reader::getEndByte() const { + return _reader.getDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t Statement::Builder::getEndByte() { + return _builder.getDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS); +} +inline void Statement::Builder::setEndByte( ::uint32_t value) { + _builder.setDataField< ::uint32_t>( + ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); +} + +inline bool LexedTokens::Reader::hasTokens() const { + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool LexedTokens::Builder::hasTokens() { + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::compiler::Token>::Reader LexedTokens::Reader::getTokens() const { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Token>>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::compiler::Token>::Builder LexedTokens::Builder::getTokens() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Token>>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void LexedTokens::Builder::setTokens( ::capnp::List< ::capnp::compiler::Token>::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Token>>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::compiler::Token>::Builder LexedTokens::Builder::initTokens(unsigned int size) { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Token>>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void LexedTokens::Builder::adoptTokens( + ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Token>>&& value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Token>>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Token>> LexedTokens::Builder::disownTokens() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Token>>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool LexedStatements::Reader::hasStatements() const { + return !_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline bool LexedStatements::Builder::hasStatements() { + return !_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); +} +inline ::capnp::List< ::capnp::compiler::Statement>::Reader LexedStatements::Reader::getStatements() const { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Statement>>::get(_reader.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::List< ::capnp::compiler::Statement>::Builder LexedStatements::Builder::getStatements() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Statement>>::get(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void LexedStatements::Builder::setStatements( ::capnp::List< ::capnp::compiler::Statement>::Reader value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Statement>>::set(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), value); +} +inline ::capnp::List< ::capnp::compiler::Statement>::Builder LexedStatements::Builder::initStatements(unsigned int size) { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Statement>>::init(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), size); +} +inline void LexedStatements::Builder::adoptStatements( + ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Statement>>&& value) { + ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Statement>>::adopt(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); +} +inline ::capnp::Orphan< ::capnp::List< ::capnp::compiler::Statement>> LexedStatements::Builder::disownStatements() { + return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::compiler::Statement>>::disown(_builder.getPointerField( + ::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +} // namespace +} // namespace + +#endif // CAPNP_INCLUDED_a73956d2621fc3ee_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/lexer.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/lexer.h new file mode 100644 index 0000000..d18923d --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/lexer.h @@ -0,0 +1,102 @@ +// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef CAPNP_COMPILER_LEXER_H_ +#define CAPNP_COMPILER_LEXER_H_ + +#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) +#pragma GCC system_header +#endif + +#include <capnp/compiler/lexer.capnp.h> +#include <kj/parse/common.h> +#include <kj/arena.h> +#include "error-reporter.h" + +namespace capnp { +namespace compiler { + +bool lex(kj::ArrayPtr<const char> input, LexedStatements::Builder result, + ErrorReporter& errorReporter); +bool lex(kj::ArrayPtr<const char> input, LexedTokens::Builder result, ErrorReporter& errorReporter); +// Lex the given source code, placing the results in `result`. Returns true if there +// were no errors, false if there were. Even when errors are present, the file may have partial +// content which can be fed into later stages of parsing in order to find more errors. +// +// There are two versions, one that parses a list of statements, and one which just parses tokens +// that might form a part of one statement. In other words, in the later case, the input should +// not contain semicolons or curly braces, unless they are in string literals of course. + +class Lexer { + // Advanced lexer interface. This interface exposes the inner parsers so that you can embed them + // into your own parsers. + +public: + Lexer(Orphanage orphanage, ErrorReporter& errorReporter); + // `orphanage` is used to allocate Cap'n Proto message objects in the result. `inputStart` is + // a pointer to the beginning of the input, used to compute byte offsets. + + ~Lexer() noexcept(false); + + class ParserInput: public kj::parse::IteratorInput<char, const char*> { + // Like IteratorInput<char, const char*> except that positions are measured as byte offsets + // rather than pointers. + + public: + ParserInput(const char* begin, const char* end) + : IteratorInput<char, const char*>(begin, end), begin(begin) {} + explicit ParserInput(ParserInput& parent) + : IteratorInput<char, const char*>(parent), begin(parent.begin) {} + + inline uint32_t getBest() { + return IteratorInput<char, const char*>::getBest() - begin; + } + inline uint32_t getPosition() { + return IteratorInput<char, const char*>::getPosition() - begin; + } + + private: + const char* begin; + }; + + template <typename Output> + using Parser = kj::parse::ParserRef<ParserInput, Output>; + + struct Parsers { + Parser<kj::Tuple<>> emptySpace; + Parser<Orphan<Token>> token; + Parser<kj::Array<Orphan<Token>>> tokenSequence; + Parser<Orphan<Statement>> statement; + Parser<kj::Array<Orphan<Statement>>> statementSequence; + }; + + const Parsers& getParsers() { return parsers; } + +private: + Orphanage orphanage; + kj::Arena arena; + Parsers parsers; +}; + +} // namespace compiler +} // namespace capnp + +#endif // CAPNP_COMPILER_LEXER_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/module-loader.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/module-loader.h new file mode 100644 index 0000000..86e6db2 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/module-loader.h @@ -0,0 +1,65 @@ +// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef CAPNP_COMPILER_MODULE_LOADER_H_ +#define CAPNP_COMPILER_MODULE_LOADER_H_ + +#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) +#pragma GCC system_header +#endif + +#include "compiler.h" +#include "error-reporter.h" +#include <kj/memory.h> +#include <kj/array.h> +#include <kj/string.h> + +namespace capnp { +namespace compiler { + +class ModuleLoader { +public: + explicit ModuleLoader(GlobalErrorReporter& errorReporter); + // Create a ModuleLoader that reports error messages to the given reporter. + + KJ_DISALLOW_COPY(ModuleLoader); + + ~ModuleLoader() noexcept(false); + + void addImportPath(kj::String path); + // Add a directory to the list of paths that is searched for imports that start with a '/'. + + kj::Maybe<Module&> loadModule(kj::StringPtr localName, kj::StringPtr sourceName); + // Tries to load the module with the given filename. `localName` is the path to the file on + // disk (as you'd pass to open(2)), and `sourceName` is the canonical name it should be given + // in the schema (this is used e.g. to decide output file locations). Often, these are the same. + +private: + class Impl; + kj::Own<Impl> impl; + + class ModuleImpl; +}; + +} // namespace compiler +} // namespace capnp + +#endif // CAPNP_COMPILER_MODULE_LOADER_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/node-translator.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/node-translator.h new file mode 100644 index 0000000..4687000 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/node-translator.h @@ -0,0 +1,323 @@ +// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef CAPNP_COMPILER_NODE_TRANSLATOR_H_ +#define CAPNP_COMPILER_NODE_TRANSLATOR_H_ + +#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) +#pragma GCC system_header +#endif + +#include <capnp/orphan.h> +#include <capnp/compiler/grammar.capnp.h> +#include <capnp/schema.capnp.h> +#include <capnp/dynamic.h> +#include <kj/vector.h> +#include <kj/one-of.h> +#include "error-reporter.h" +#include <map> + +namespace capnp { +namespace compiler { + +class NodeTranslator { + // Translates one node in the schema from AST form to final schema form. A "node" is anything + // that has a unique ID, such as structs, enums, constants, and annotations, but not fields, + // unions, enumerants, or methods (the latter set have 16-bit ordinals but not 64-bit global IDs). + +public: + class Resolver { + // Callback class used to find other nodes relative to this one. + // + // TODO(cleanup): This has evolved into being a full interface for traversing the node tree. + // Maybe we should rename it as such, and move it out of NodeTranslator. See also + // TODO(cleanup) on NodeTranslator::BrandedDecl. + + public: + struct ResolvedDecl { + uint64_t id; + uint genericParamCount; + uint64_t scopeId; + Declaration::Which kind; + Resolver* resolver; + + kj::Maybe<schema::Brand::Reader> brand; + // If present, then it is necessary to replace the brand scope with the given brand before + // using the target type. This happens when the decl resolved to an alias; all other fields + // of `ResolvedDecl` refer to the target of the alias, except for `scopeId` which is the + // scope that contained the alias. + }; + + struct ResolvedParameter { + uint64_t id; // ID of the node declaring the parameter. + uint index; // Index of the parameter. + }; + + typedef kj::OneOf<ResolvedDecl, ResolvedParameter> ResolveResult; + + virtual kj::Maybe<ResolveResult> resolve(kj::StringPtr name) = 0; + // Look up the given name, relative to this node, and return basic information about the + // target. + + virtual kj::Maybe<ResolveResult> resolveMember(kj::StringPtr name) = 0; + // Look up a member of this node. + + virtual ResolvedDecl resolveBuiltin(Declaration::Which which) = 0; + virtual ResolvedDecl resolveId(uint64_t id) = 0; + + virtual kj::Maybe<ResolvedDecl> getParent() = 0; + // Returns the parent of this scope, or null if this is the top scope. + + virtual ResolvedDecl getTopScope() = 0; + // Get the top-level scope containing this node. + + virtual kj::Maybe<Schema> resolveBootstrapSchema(uint64_t id, schema::Brand::Reader brand) = 0; + // Get the schema for the given ID. If a schema is returned, it must be safe to traverse its + // dependencies via the Schema API. A schema that is only at the bootstrap stage is + // acceptable. + // + // Throws an exception if the id is not one that was found by calling resolve() or by + // traversing other schemas. Returns null if the ID is recognized, but the corresponding + // schema node failed to be built for reasons that were already reported. + + virtual kj::Maybe<schema::Node::Reader> resolveFinalSchema(uint64_t id) = 0; + // Get the final schema for the given ID. A bootstrap schema is not acceptable. A raw + // node reader is returned rather than a Schema object because using a Schema object built + // by the final schema loader could trigger lazy initialization of dependencies which could + // lead to a cycle and deadlock. + // + // Throws an exception if the id is not one that was found by calling resolve() or by + // traversing other schemas. Returns null if the ID is recognized, but the corresponding + // schema node failed to be built for reasons that were already reported. + + virtual kj::Maybe<ResolvedDecl> resolveImport(kj::StringPtr name) = 0; + // Get the ID of an imported file given the import path. + + virtual kj::Maybe<kj::Array<const byte>> readEmbed(kj::StringPtr name) = 0; + // Read and return the contents of a file for an `embed` expression. + + virtual kj::Maybe<Type> resolveBootstrapType(schema::Type::Reader type, Schema scope) = 0; + // Compile a schema::Type into a Type whose dependencies may safely be traversed via the schema + // API. These dependencies may have only bootstrap schemas. Returns null if the type could not + // be constructed due to already-reported errors. + }; + + NodeTranslator(Resolver& resolver, ErrorReporter& errorReporter, + const Declaration::Reader& decl, Orphan<schema::Node> wipNode, + bool compileAnnotations); + // Construct a NodeTranslator to translate the given declaration. The wipNode starts out with + // `displayName`, `id`, `scopeId`, and `nestedNodes` already initialized. The `NodeTranslator` + // fills in the rest. + + ~NodeTranslator() noexcept(false); + + struct NodeSet { + schema::Node::Reader node; + // The main node. + + kj::Array<schema::Node::Reader> auxNodes; + // Auxiliary nodes that were produced when translating this node and should be loaded along + // with it. In particular, structs that contain groups (or named unions) spawn extra nodes + // representing those, and interfaces spawn struct nodes representing method params/results. + + kj::Array<schema::Node::SourceInfo::Reader> sourceInfo; + // The SourceInfo for the node and all aux nodes. + }; + + NodeSet getBootstrapNode(); + // Get an incomplete version of the node in which pointer-typed value expressions have not yet + // been translated. Instead, for all `schema.Value` objects representing pointer-type values, + // the value is set to an appropriate "empty" value. This version of the schema can be used to + // bootstrap the dynamic API which can then in turn be used to encode the missing complex values. + // + // If the final node has already been built, this will actually return the final node (in fact, + // it's the same node object). + + NodeSet finish(); + // Finish translating the node (including filling in all the pieces that are missing from the + // bootstrap node) and return it. + + static kj::Maybe<Resolver::ResolveResult> compileDecl( + uint64_t scopeId, uint scopeParameterCount, Resolver& resolver, ErrorReporter& errorReporter, + Expression::Reader expression, schema::Brand::Builder brandBuilder); + // Compile a one-off declaration expression without building a NodeTranslator. Used for + // evaluating aliases. + // + // `brandBuilder` may be used to construct a message which will fill in ResolvedDecl::brand in + // the result. + +private: + class DuplicateNameDetector; + class DuplicateOrdinalDetector; + class StructLayout; + class StructTranslator; + class BrandedDecl; + class BrandScope; + + Resolver& resolver; + ErrorReporter& errorReporter; + Orphanage orphanage; + bool compileAnnotations; + kj::Own<BrandScope> localBrand; + + Orphan<schema::Node> wipNode; + // The work-in-progress schema node. + + Orphan<schema::Node::SourceInfo> sourceInfo; + // Doc comments and other source info for this node. + + struct AuxNode { + Orphan<schema::Node> node; + Orphan<schema::Node::SourceInfo> sourceInfo; + }; + + kj::Vector<AuxNode> groups; + // If this is a struct node and it contains groups, these are the nodes for those groups, which + // must be loaded together with the top-level node. + + kj::Vector<AuxNode> paramStructs; + // If this is an interface, these are the auto-generated structs representing params and results. + + struct UnfinishedValue { + Expression::Reader source; + schema::Type::Reader type; + Schema typeScope; + schema::Value::Builder target; + }; + kj::Vector<UnfinishedValue> unfinishedValues; + // List of values in `wipNode` which have not yet been interpreted, because they are structs + // or lists and as such interpreting them require using the types' schemas (to take advantage + // of the dynamic API). Once bootstrap schemas have been built, they can be used to interpret + // these values. + + void compileNode(Declaration::Reader decl, schema::Node::Builder builder); + + void compileConst(Declaration::Const::Reader decl, schema::Node::Const::Builder builder); + void compileAnnotation(Declaration::Annotation::Reader decl, + schema::Node::Annotation::Builder builder); + + void compileEnum(Void decl, List<Declaration>::Reader members, + schema::Node::Builder builder); + void compileStruct(Void decl, List<Declaration>::Reader members, + schema::Node::Builder builder); + void compileInterface(Declaration::Interface::Reader decl, + List<Declaration>::Reader members, + schema::Node::Builder builder); + // The `members` arrays contain only members with ordinal numbers, in code order. Other members + // are handled elsewhere. + + struct ImplicitParams { + // Represents a set of implicit parameters visible in the current context. + + uint64_t scopeId; + // If zero, then any reference to an implciit param in this context should be compiled to a + // `implicitMethodParam` AnyPointer. If non-zero, it should be compiled to a `parameter` + // AnyPointer. + + List<Declaration::BrandParameter>::Reader params; + }; + + static inline ImplicitParams noImplicitParams() { + return { 0, List<Declaration::BrandParameter>::Reader() }; + } + + template <typename InitBrandFunc> + uint64_t compileParamList(kj::StringPtr methodName, uint16_t ordinal, bool isResults, + Declaration::ParamList::Reader paramList, + typename List<Declaration::BrandParameter>::Reader implicitParams, + InitBrandFunc&& initBrand); + // Compile a param (or result) list and return the type ID of the struct type. + + kj::Maybe<BrandedDecl> compileDeclExpression( + Expression::Reader source, ImplicitParams implicitMethodParams); + // Compile an expression which is expected to resolve to a declaration or type expression. + + bool compileType(Expression::Reader source, schema::Type::Builder target, + ImplicitParams implicitMethodParams); + // Returns false if there was a problem, in which case value expressions of this type should + // not be parsed. + + void compileDefaultDefaultValue(schema::Type::Reader type, schema::Value::Builder target); + // Initializes `target` to contain the "default default" value for `type`. + + void compileBootstrapValue( + Expression::Reader source, schema::Type::Reader type, schema::Value::Builder target, + Schema typeScope = Schema()); + // Calls compileValue() if this value should be interpreted at bootstrap time. Otheriwse, + // adds the value to `unfinishedValues` for later evaluation. + // + // If `type` comes from some other node, `typeScope` is the schema for that node. This is only + // really needed for looking up generic parameter bindings, therefore if the type comes from + // the node being built, an empty "Schema" (the default) works here because the node being built + // is of course being built for all possible bindings and thus none of its generic parameters are + // bound. + + void compileValue(Expression::Reader source, schema::Type::Reader type, + Schema typeScope, schema::Value::Builder target, bool isBootstrap); + // Interprets the value expression and initializes `target` with the result. + + kj::Maybe<DynamicValue::Reader> readConstant(Expression::Reader name, bool isBootstrap); + // Get the value of the given constant. May return null if some error occurs, which will already + // have been reported. + + kj::Maybe<kj::Array<const byte>> readEmbed(LocatedText::Reader filename); + // Read a raw file for embedding. + + Orphan<List<schema::Annotation>> compileAnnotationApplications( + List<Declaration::AnnotationApplication>::Reader annotations, + kj::StringPtr targetsFlagName); +}; + +class ValueTranslator { +public: + class Resolver { + public: + virtual kj::Maybe<DynamicValue::Reader> resolveConstant(Expression::Reader name) = 0; + virtual kj::Maybe<kj::Array<const byte>> readEmbed(LocatedText::Reader filename) = 0; + }; + + ValueTranslator(Resolver& resolver, ErrorReporter& errorReporter, Orphanage orphanage) + : resolver(resolver), errorReporter(errorReporter), orphanage(orphanage) {} + + kj::Maybe<Orphan<DynamicValue>> compileValue(Expression::Reader src, Type type); + + void fillStructValue(DynamicStruct::Builder builder, + List<Expression::Param>::Reader assignments); + // Interprets the given assignments and uses them to fill in the given struct builder. + +private: + Resolver& resolver; + ErrorReporter& errorReporter; + Orphanage orphanage; + + Orphan<DynamicValue> compileValueInner(Expression::Reader src, Type type); + // Helper for compileValue(). + + kj::String makeNodeName(Schema node); + kj::String makeTypeName(Type type); + + kj::Maybe<ListSchema> makeListSchemaOf(schema::Type::Reader elementType); +}; + +} // namespace compiler +} // namespace capnp + +#endif // CAPNP_COMPILER_NODE_TRANSLATOR_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/parser.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/parser.h new file mode 100644 index 0000000..50370af --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/parser.h @@ -0,0 +1,151 @@ +// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef CAPNP_COMPILER_PARSER_H_ +#define CAPNP_COMPILER_PARSER_H_ + +#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) +#pragma GCC system_header +#endif + +#include <capnp/compiler/grammar.capnp.h> +#include <capnp/compiler/lexer.capnp.h> +#include <kj/parse/common.h> +#include <kj/arena.h> +#include "error-reporter.h" + +namespace capnp { +namespace compiler { + +void parseFile(List<Statement>::Reader statements, ParsedFile::Builder result, + ErrorReporter& errorReporter); +// Parse a list of statements to build a ParsedFile. +// +// If any errors are reported, then the output is not usable. However, it may be passed on through +// later stages of compilation in order to detect additional errors. + +uint64_t generateRandomId(); +// Generate a new random unique ID. This lives here mostly for lack of a better location. + +uint64_t generateChildId(uint64_t parentId, kj::StringPtr childName); +// Generate the ID for a child node given its parent ID and name. + +uint64_t generateGroupId(uint64_t parentId, uint16_t groupIndex); +// Generate the ID for a group within a struct. + +uint64_t generateMethodParamsId(uint64_t parentId, uint16_t methodOrdinal, bool isResults); +// Generate the ID for a struct representing method params / results. +// +// TODO(cleanup): Move generate*Id() somewhere more sensible. + +class CapnpParser { + // Advanced parser interface. This interface exposes the inner parsers so that you can embed + // them into your own parsers. + +public: + CapnpParser(Orphanage orphanage, ErrorReporter& errorReporter); + // `orphanage` is used to allocate Cap'n Proto message objects in the result. `inputStart` is + // a pointer to the beginning of the input, used to compute byte offsets. + + ~CapnpParser() noexcept(false); + + KJ_DISALLOW_COPY(CapnpParser); + + using ParserInput = kj::parse::IteratorInput<Token::Reader, List<Token>::Reader::Iterator>; + struct DeclParserResult; + template <typename Output> + using Parser = kj::parse::ParserRef<ParserInput, Output>; + using DeclParser = Parser<DeclParserResult>; + + kj::Maybe<Orphan<Declaration>> parseStatement( + Statement::Reader statement, const DeclParser& parser); + // Parse a statement using the given parser. In addition to parsing the token sequence itself, + // this takes care of parsing the block (if any) and copying over the doc comment (if any). + + struct DeclParserResult { + // DeclParser parses a sequence of tokens representing just the "line" part of the statement -- + // i.e. everything up to the semicolon or opening curly brace. + // + // Use `parseStatement()` to avoid having to deal with this struct. + + Orphan<Declaration> decl; + // The decl parsed so far. The decl's `docComment` and `nestedDecls` are both empty at this + // point. + + kj::Maybe<DeclParser> memberParser; + // If null, the statement should not have a block. If non-null, the statement should have a + // block containing statements parseable by this parser. + + DeclParserResult(Orphan<Declaration>&& decl, const DeclParser& memberParser) + : decl(kj::mv(decl)), memberParser(memberParser) {} + explicit DeclParserResult(Orphan<Declaration>&& decl) + : decl(kj::mv(decl)), memberParser(nullptr) {} + }; + + struct Parsers { + DeclParser genericDecl; + // Parser that matches any declaration type except those that have ordinals (since they are + // context-dependent). + + DeclParser fileLevelDecl; + DeclParser enumLevelDecl; + DeclParser structLevelDecl; + DeclParser interfaceLevelDecl; + // Parsers that match genericDecl *and* the ordinal-based declaration types valid in the given + // contexts. Note that these may match declarations that are not actually allowed in the given + // contexts, as long as the grammar is unambiguous. E.g. nested types are not allowed in + // enums, but they'll be accepted by enumLevelDecl. A later stage of compilation should report + // these as errors. + + Parser<Orphan<Expression>> expression; + Parser<Orphan<Declaration::AnnotationApplication>> annotation; + Parser<Orphan<LocatedInteger>> uid; + Parser<Orphan<LocatedInteger>> ordinal; + Parser<Orphan<Declaration::Param>> param; + + DeclParser usingDecl; + DeclParser constDecl; + DeclParser enumDecl; + DeclParser enumerantDecl; + DeclParser structDecl; + DeclParser fieldDecl; + DeclParser unionDecl; + DeclParser groupDecl; + DeclParser interfaceDecl; + DeclParser methodDecl; + DeclParser paramDecl; + DeclParser annotationDecl; + // Parsers for individual declaration types. + }; + + const Parsers& getParsers() { return parsers; } + +private: + Orphanage orphanage; + ErrorReporter& errorReporter; + kj::Arena arena; + Parsers parsers; +}; + +} // namespace compiler +} // namespace capnp + +#endif // CAPNP_COMPILER_PARSER_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/type-id.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/type-id.h new file mode 100644 index 0000000..23d0618 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compiler/type-id.h @@ -0,0 +1,45 @@ +// Copyright (c) 2017 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef CAPNP_COMPILER_TYPE_ID_H +#define CAPNP_COMPILER_TYPE_ID_H + +#include <kj/string.h> +#include <kj/array.h> +#include <capnp/common.h> + +namespace capnp { +namespace compiler { + +uint64_t generateChildId(uint64_t parentId, kj::StringPtr childName); +uint64_t generateGroupId(uint64_t parentId, uint16_t groupIndex); +uint64_t generateMethodParamsId(uint64_t parentId, uint16_t methodOrdinal, bool isResults); +// Generate a default type ID for various symbols. These are used only if the developer did not +// specify an ID explicitly. +// +// The returned ID always has the most-significant bit set. The remaining bits are generated +// pseudo-randomly from the input using an algorithm that should produce a uniform distribution of +// IDs. + +} // namespace compiler +} // namespace capnp + +#endif // CAPNP_COMPILER_TYPE_ID_H diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/test-util.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/test-util.h new file mode 100644 index 0000000..64fcaa5 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/test-util.h @@ -0,0 +1,312 @@ +// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef CAPNP_TEST_UTIL_H_ +#define CAPNP_TEST_UTIL_H_ + +#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) +#pragma GCC system_header +#endif + +#include <capnp/test.capnp.h> +#include <iostream> +#include "blob.h" +#include <kj/compat/gtest.h> + +#if !CAPNP_LITE +#include "dynamic.h" +#endif // !CAPNP_LITE + +// TODO(cleanup): Auto-generate stringification functions for union discriminants. +namespace capnproto_test { +namespace capnp { +namespace test { +inline kj::String KJ_STRINGIFY(TestUnion::Union0::Which which) { + return kj::str(static_cast<uint16_t>(which)); +} +inline kj::String KJ_STRINGIFY(TestUnion::Union1::Which which) { + return kj::str(static_cast<uint16_t>(which)); +} +inline kj::String KJ_STRINGIFY(TestUnion::Union2::Which which) { + return kj::str(static_cast<uint16_t>(which)); +} +inline kj::String KJ_STRINGIFY(TestUnion::Union3::Which which) { + return kj::str(static_cast<uint16_t>(which)); +} +inline kj::String KJ_STRINGIFY(TestUnnamedUnion::Which which) { + return kj::str(static_cast<uint16_t>(which)); +} +inline kj::String KJ_STRINGIFY(TestGroups::Groups::Which which) { + return kj::str(static_cast<uint16_t>(which)); +} +inline kj::String KJ_STRINGIFY(TestInterleavedGroups::Group1::Which which) { + return kj::str(static_cast<uint16_t>(which)); +} +} // namespace test +} // namespace capnp +} // namespace capnproto_test + +namespace capnp { +namespace _ { // private + +inline Data::Reader data(const char* str) { + return Data::Reader(reinterpret_cast<const byte*>(str), strlen(str)); +} + +namespace test = capnproto_test::capnp::test; + +// We don't use "using namespace" to pull these in because then things would still compile +// correctly if they were generated in the global namespace. +using ::capnproto_test::capnp::test::TestAllTypes; +using ::capnproto_test::capnp::test::TestDefaults; +using ::capnproto_test::capnp::test::TestEnum; +using ::capnproto_test::capnp::test::TestUnion; +using ::capnproto_test::capnp::test::TestUnionDefaults; +using ::capnproto_test::capnp::test::TestNestedTypes; +using ::capnproto_test::capnp::test::TestUsing; +using ::capnproto_test::capnp::test::TestListDefaults; + +void initTestMessage(TestAllTypes::Builder builder); +void initTestMessage(TestDefaults::Builder builder); +void initTestMessage(TestListDefaults::Builder builder); + +void checkTestMessage(TestAllTypes::Builder builder); +void checkTestMessage(TestDefaults::Builder builder); +void checkTestMessage(TestListDefaults::Builder builder); + +void checkTestMessage(TestAllTypes::Reader reader); +void checkTestMessage(TestDefaults::Reader reader); +void checkTestMessage(TestListDefaults::Reader reader); + +void checkTestMessageAllZero(TestAllTypes::Builder builder); +void checkTestMessageAllZero(TestAllTypes::Reader reader); + +#if !CAPNP_LITE +void initDynamicTestMessage(DynamicStruct::Builder builder); +void initDynamicTestLists(DynamicStruct::Builder builder); +void checkDynamicTestMessage(DynamicStruct::Builder builder); +void checkDynamicTestLists(DynamicStruct::Builder builder); +void checkDynamicTestMessage(DynamicStruct::Reader reader); +void checkDynamicTestLists(DynamicStruct::Reader reader); +void checkDynamicTestMessageAllZero(DynamicStruct::Builder builder); +void checkDynamicTestMessageAllZero(DynamicStruct::Reader reader); +#endif // !CAPNP_LITE + +template <typename T> +inline void checkElement(T a, T b) { + EXPECT_EQ(a, b); +} + +template <> +inline void checkElement<float>(float a, float b) { + EXPECT_FLOAT_EQ(a, b); +} + +template <> +inline void checkElement<double>(double a, double b) { + EXPECT_DOUBLE_EQ(a, b); +} + +template <typename T, typename L = typename T::Reads> +void checkList(T reader, std::initializer_list<decltype(reader[0])> expected) { + ASSERT_EQ(expected.size(), reader.size()); + for (uint i = 0; i < expected.size(); i++) { + checkElement<decltype(reader[0])>(expected.begin()[i], reader[i]); + } +} + +template <typename T, typename L = typename T::Builds, bool = false> +void checkList(T reader, std::initializer_list<decltype(typename L::Reader()[0])> expected) { + ASSERT_EQ(expected.size(), reader.size()); + for (uint i = 0; i < expected.size(); i++) { + checkElement<decltype(typename L::Reader()[0])>(expected.begin()[i], reader[i]); + } +} + +inline void checkList(List<test::TestOldVersion>::Reader reader, + std::initializer_list<int64_t> expectedData, + std::initializer_list<Text::Reader> expectedPointers) { + ASSERT_EQ(expectedData.size(), reader.size()); + for (uint i = 0; i < expectedData.size(); i++) { + EXPECT_EQ(expectedData.begin()[i], reader[i].getOld1()); + EXPECT_EQ(expectedPointers.begin()[i], reader[i].getOld2()); + } +} + +// Hack because as<>() is a template-parameter-dependent lookup everywhere below... +#define as template as + +template <typename T> void expectPrimitiveEq(T a, T b) { EXPECT_EQ(a, b); } +inline void expectPrimitiveEq(float a, float b) { EXPECT_FLOAT_EQ(a, b); } +inline void expectPrimitiveEq(double a, double b) { EXPECT_DOUBLE_EQ(a, b); } +inline void expectPrimitiveEq(Text::Reader a, Text::Builder b) { EXPECT_EQ(a, b); } +inline void expectPrimitiveEq(Data::Reader a, Data::Builder b) { EXPECT_EQ(a, b); } + +#if !CAPNP_LITE +template <typename Element, typename T> +void checkList(T reader, std::initializer_list<ReaderFor<Element>> expected) { + auto list = reader.as<DynamicList>(); + ASSERT_EQ(expected.size(), list.size()); + for (uint i = 0; i < expected.size(); i++) { + expectPrimitiveEq(expected.begin()[i], list[i].as<Element>()); + } + + auto typed = reader.as<List<Element>>(); + ASSERT_EQ(expected.size(), typed.size()); + for (uint i = 0; i < expected.size(); i++) { + expectPrimitiveEq(expected.begin()[i], typed[i]); + } +} +#endif // !CAPNP_LITE + +#undef as + +// ======================================================================================= +// Interface implementations. + +#if !CAPNP_LITE + +class TestInterfaceImpl final: public test::TestInterface::Server { +public: + TestInterfaceImpl(int& callCount); + + kj::Promise<void> foo(FooContext context) override; + + kj::Promise<void> baz(BazContext context) override; + +private: + int& callCount; +}; + +class TestExtendsImpl final: public test::TestExtends2::Server { +public: + TestExtendsImpl(int& callCount); + + kj::Promise<void> foo(FooContext context) override; + + kj::Promise<void> grault(GraultContext context) override; + +private: + int& callCount; +}; + +class TestPipelineImpl final: public test::TestPipeline::Server { +public: + TestPipelineImpl(int& callCount); + + kj::Promise<void> getCap(GetCapContext context) override; + kj::Promise<void> getAnyCap(GetAnyCapContext context) override; + +private: + int& callCount; +}; + +class TestCallOrderImpl final: public test::TestCallOrder::Server { +public: + kj::Promise<void> getCallSequence(GetCallSequenceContext context) override; + +private: + uint count = 0; +}; + +class TestTailCallerImpl final: public test::TestTailCaller::Server { +public: + TestTailCallerImpl(int& callCount); + + kj::Promise<void> foo(FooContext context) override; + +private: + int& callCount; +}; + +class TestTailCalleeImpl final: public test::TestTailCallee::Server { +public: + TestTailCalleeImpl(int& callCount); + + kj::Promise<void> foo(FooContext context) override; + +private: + int& callCount; +}; + +class TestMoreStuffImpl final: public test::TestMoreStuff::Server { +public: + TestMoreStuffImpl(int& callCount, int& handleCount); + + kj::Promise<void> getCallSequence(GetCallSequenceContext context) override; + + kj::Promise<void> callFoo(CallFooContext context) override; + + kj::Promise<void> callFooWhenResolved(CallFooWhenResolvedContext context) override; + + kj::Promise<void> neverReturn(NeverReturnContext context) override; + + kj::Promise<void> hold(HoldContext context) override; + + kj::Promise<void> callHeld(CallHeldContext context) override; + + kj::Promise<void> getHeld(GetHeldContext context) override; + + kj::Promise<void> echo(EchoContext context) override; + + kj::Promise<void> expectCancel(ExpectCancelContext context) override; + + kj::Promise<void> getHandle(GetHandleContext context) override; + + kj::Promise<void> getNull(GetNullContext context) override; + + kj::Promise<void> getEnormousString(GetEnormousStringContext context) override; + +private: + int& callCount; + int& handleCount; + test::TestInterface::Client clientToHold = nullptr; + + kj::Promise<void> loop(uint depth, test::TestInterface::Client cap, ExpectCancelContext context); +}; + +class TestCapDestructor final: public test::TestInterface::Server { + // Implementation of TestInterface that notifies when it is destroyed. + +public: + TestCapDestructor(kj::Own<kj::PromiseFulfiller<void>>&& fulfiller) + : fulfiller(kj::mv(fulfiller)), impl(dummy) {} + + ~TestCapDestructor() { + fulfiller->fulfill(); + } + + kj::Promise<void> foo(FooContext context) { + return impl.foo(context); + } + +private: + kj::Own<kj::PromiseFulfiller<void>> fulfiller; + int dummy = 0; + TestInterfaceImpl impl; +}; + +#endif // !CAPNP_LITE + +} // namespace _ (private) +} // namespace capnp + +#endif // TEST_UTIL_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/array.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/array.h index 51b5dcf..3aa4ae2 100644 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/array.h +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/array.h @@ -177,6 +177,11 @@ inline T& front() { return *ptr; } inline T& back() { return *(ptr + size_ - 1); } + template <typename U> + inline bool operator==(const U& other) const { return asPtr() == other; } + template <typename U> + inline bool operator!=(const U& other) const { return asPtr() != other; } + inline ArrayPtr<T> slice(size_t start, size_t end) { KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds Array::slice()."); return ArrayPtr<T>(ptr + start, end - start); @@ -249,6 +254,8 @@ template <typename U> friend class Array; + template <typename U> + friend class ArrayBuilder; }; static_assert(!canMemcpy<Array<char>>(), "canMemcpy<>() is broken"); @@ -320,6 +327,13 @@ other.ptr = nullptr; other.pos = nullptr; other.endPtr = nullptr; + } + ArrayBuilder(Array<T>&& other) + : ptr(other.ptr), pos(other.ptr + other.size_), endPtr(pos), disposer(other.disposer) { + // Create an already-full ArrayBuilder from an Array of the same type. This constructor + // primarily exists to enable Vector<T> to be constructed from Array<T>. + other.ptr = nullptr; + other.size_ = 0; } KJ_DISALLOW_COPY(ArrayBuilder); inline ~ArrayBuilder() noexcept(false) { dispose(); } @@ -808,6 +822,15 @@ return heapArray<T>(init.begin(), init.end()); } +#if __cplusplus > 201402L +template <typename T, typename... Params> +inline Array<Decay<T>> arr(T&& param1, Params&&... params) { + ArrayBuilder<Decay<T>> builder = heapArrayBuilder<Decay<T>>(sizeof...(params) + 1); + (builder.add(kj::fwd<T>(param1)), ... , builder.add(kj::fwd<Params>(params))); + return builder.finish(); +} +#endif + } // namespace kj #endif // KJ_ARRAY_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/common.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/common.h index 4a908ae..cd765e5 100644 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/common.h +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/common.h @@ -455,6 +455,10 @@ // KJ_DECLTYPE_REF(i) i3(i); // i3 has type int&. // KJ_DECLTYPE_REF(kj::mv(i)) i4(kj::mv(i)); // i4 has type int. +template <typename T, typename U> struct IsSameType_ { static constexpr bool value = false; }; +template <typename T> struct IsSameType_<T, T> { static constexpr bool value = true; }; +template <typename T, typename U> constexpr bool isSameType() { return IsSameType_<T, U>::value; } + template <typename T> struct CanConvert_ { static int sfinae(T); @@ -911,7 +915,6 @@ return value; } -private: // internal interface used by friends only inline NullableValue() noexcept: isSet(false) {} inline NullableValue(T&& t) noexcept(noexcept(T(instance<T&&>()))) : isSet(true) { @@ -1089,18 +1092,32 @@ inline bool operator==(decltype(nullptr)) const { return ptr == nullptr; } inline bool operator!=(decltype(nullptr)) const { return ptr != nullptr; } - T& orDefault(T& defaultValue) { + T& orDefault(T& defaultValue) & { if (ptr == nullptr) { return defaultValue; } else { return *ptr; } } - const T& orDefault(const T& defaultValue) const { + const T& orDefault(const T& defaultValue) const & { if (ptr == nullptr) { return defaultValue; } else { return *ptr; + } + } + T&& orDefault(T&& defaultValue) && { + if (ptr == nullptr) { + return kj::mv(defaultValue); + } else { + return kj::mv(*ptr); + } + } + const T&& orDefault(const T&& defaultValue) const && { + if (ptr == nullptr) { + return kj::mv(defaultValue); + } else { + return kj::mv(*ptr); } } @@ -1163,7 +1180,7 @@ template <typename U> inline Maybe(Maybe<U&>& other) noexcept: ptr(other.ptr) {} template <typename U> - inline Maybe(const Maybe<const U&>& other) noexcept: ptr(other.ptr) {} + inline Maybe(const Maybe<U&>& other) noexcept: ptr(const_cast<const U*>(other.ptr)) {} inline Maybe(decltype(nullptr)) noexcept: ptr(nullptr) {} inline Maybe& operator=(T& other) noexcept { ptr = &other; return *this; } @@ -1230,8 +1247,31 @@ : ptr(init.begin()), size_(init.size()) {} template <size_t size> - inline constexpr ArrayPtr(T (&native)[size]): ptr(native), size_(size) {} - // Construct an ArrayPtr from a native C-style array. + inline constexpr ArrayPtr(T (&native)[size]): ptr(native), size_(size) { + // Construct an ArrayPtr from a native C-style array. + // + // We disable this constructor for const char arrays because otherwise you would be able to + // implicitly convert a character literal to ArrayPtr<const char>, which sounds really great, + // except that the NUL terminator would be included, which probably isn't what you intended. + // + // TODO(someday): Maybe we should support character literals but explicitly chop off the NUL + // terminator. This could do the wrong thing if someone tries to construct an + // ArrayPtr<const char> from a non-NUL-terminated char array, but evidence suggests that all + // real use cases are in fact intending to remove the NUL terminator. It's convenient to be + // able to specify ArrayPtr<const char> as a parameter type and be able to accept strings + // as input in addition to arrays. Currently, you'll need overloading to support string + // literals in this case, but if you overload StringPtr, then you'll find that several + // conversions (e.g. from String and from a literal char array) become ambiguous! You end up + // having to overload for literal char arrays specifically which is cumbersome. + + static_assert(!isSameType<T, const char>(), + "Can't implicitly convert literal char array to ArrayPtr because we don't know if " + "you meant to include the NUL terminator. We may change this in the future to " + "automatically drop the NUL terminator. For now, try explicitly converting to StringPtr, " + "which can in turn implicitly convert to ArrayPtr<const char>."); + static_assert(!isSameType<T, const char16_t>(), "see above"); + static_assert(!isSameType<T, const char32_t>(), "see above"); + } inline operator ArrayPtr<const T>() const { return ArrayPtr<const T>(ptr, size_); @@ -1291,6 +1331,17 @@ } inline bool operator!=(const ArrayPtr& other) const { return !(*this == other); } + template <typename U> + inline bool operator==(const ArrayPtr<U>& other) const { + if (size_ != other.size()) return false; + for (size_t i = 0; i < size_; i++) { + if (ptr[i] != other[i]) return false; + } + return true; + } + template <typename U> + inline bool operator!=(const ArrayPtr<U>& other) const { return !(*this == other); } + private: T* ptr; size_t size_; diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/compat/http.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/compat/http.h index 8d455cc..98844ad 100644 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/compat/http.h +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/compat/http.h @@ -144,7 +144,7 @@ // // HttpHeaderId::HOST // - // TODO(0.7): Fill this out with more common headers. + // TODO(soon): Fill this out with more common headers. #define DECLARE_HEADER(id, name) \ static const HttpHeaderId id; @@ -433,7 +433,7 @@ // // `url` and `headers` are invalidated when the returned promise resolves. - virtual kj::Promise<kj::Own<kj::AsyncIoStream>> connect(kj::String host); + virtual kj::Promise<kj::Own<kj::AsyncIoStream>> connect(kj::StringPtr host); // Handles CONNECT requests. Only relevant for proxy clients. Default implementation throws // UNIMPLEMENTED. }; @@ -494,7 +494,7 @@ // // `url` and `headers` are invalidated when the returned promise resolves. - virtual kj::Promise<kj::Own<kj::AsyncIoStream>> connect(kj::String host); + virtual kj::Promise<kj::Own<kj::AsyncIoStream>> connect(kj::StringPtr host); // Handles CONNECT requests. Only relevant for proxy services. Default implementation throws // UNIMPLEMENTED. }; diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/compat/readiness-io.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/compat/readiness-io.h new file mode 100644 index 0000000..c208172 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/compat/readiness-io.h @@ -0,0 +1,92 @@ +// Copyright (c) 2016 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef KJ_COMPAT_READINESS_IO_H_ +#define KJ_COMPAT_READINESS_IO_H_ + +#include <kj/async-io.h> + +namespace kj { + +class ReadyInputStreamWrapper { + // Provides readiness-based Async I/O as a wrapper around KJ's standard completion-based API, for + // compatibility with libraries that use readiness-based abstractions (e.g. OpenSSL). + // + // Unfortunately this requires buffering, so is not very efficient. + +public: + ReadyInputStreamWrapper(AsyncInputStream& input); + ~ReadyInputStreamWrapper() noexcept(false); + KJ_DISALLOW_COPY(ReadyInputStreamWrapper); + + kj::Maybe<size_t> read(kj::ArrayPtr<byte> dst); + // Reads bytes into `dst`, returning the number of bytes read. Returns zero only at EOF. Returns + // nullptr if not ready. + + kj::Promise<void> whenReady(); + // Returns a promise that resolves when read() will return non-null. + +private: + AsyncInputStream& input; + kj::ForkedPromise<void> pumpTask = nullptr; + bool isPumping = false; + bool eof = false; + + kj::ArrayPtr<const byte> content = nullptr; // Points to currently-valid part of `buffer`. + byte buffer[8192]; +}; + +class ReadyOutputStreamWrapper { + // Provides readiness-based Async I/O as a wrapper around KJ's standard completion-based API, for + // compatibility with libraries that use readiness-based abstractions (e.g. OpenSSL). + // + // Unfortunately this requires buffering, so is not very efficient. + +public: + ReadyOutputStreamWrapper(AsyncOutputStream& output); + ~ReadyOutputStreamWrapper() noexcept(false); + KJ_DISALLOW_COPY(ReadyOutputStreamWrapper); + + kj::Maybe<size_t> write(kj::ArrayPtr<const byte> src); + // Writes bytes from `src`, returning the number of bytes written. Never returns zero. Returns + // nullptr if not ready. + + kj::Promise<void> whenReady(); + // Returns a promise that resolves when write() will return non-null. + +private: + AsyncOutputStream& output; + ArrayPtr<const byte> segments[2]; + kj::ForkedPromise<void> pumpTask = nullptr; + bool isPumping = false; + + uint start = 0; // index of first byte + uint filled = 0; // number of bytes currently in buffer + + byte buffer[8192]; + + kj::Promise<void> pump(); + // Asyncronously push the buffer out to the underlying stream. +}; + +} // namespace kj + +#endif // KJ_COMPAT_READINESS_IO_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/compat/tls.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/compat/tls.h new file mode 100644 index 0000000..b910471 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/compat/tls.h @@ -0,0 +1,226 @@ +// Copyright (c) 2016 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef KJ_COMPAT_TLS_H_ +#define KJ_COMPAT_TLS_H_ +// This file implements TLS (aka SSL) encrypted networking. It is actually a wrapper, currently +// around OpenSSL / BoringSSL / LibreSSL, but the interface is intended to remain +// implementation-agnostic. +// +// Unlike OpenSSL's API, the API defined in this file is intended to be hard to use wrong. Good +// ciphers and settings are used by default. Certificates validation is performed automatically +// and cannot be bypassed. + +#include <kj/async-io.h> + +namespace kj { + +class TlsPrivateKey; +class TlsCertificate; +struct TlsKeypair; +class TlsSniCallback; + +enum class TlsVersion { + SSL_3, // avoid; cryptographically broken + TLS_1_0, + TLS_1_1, + TLS_1_2 +}; + +class TlsContext { + // TLS system. Allocate one of these, configure it with the proper keys and certificates (or + // use the defaults), and then use it to wrap the standard KJ network interfaces in + // implementations that transparently use TLS. + +public: + struct Options { + Options(); + // Initializes all values to reasonable defaults. + + bool useSystemTrustStore; + // Whether or not to trust the system's default trust store. Default: true. + + kj::ArrayPtr<const TlsCertificate> trustedCertificates; + // Additional certificates which should be trusted. Default: none. + + TlsVersion minVersion; + // Minimum version. Defaults to minimum version that hasn't been cryptographically broken. + // If you override this, consider doing: + // + // options.minVersion = kj::max(myVersion, options.minVersion); + + kj::StringPtr cipherList; + // OpenSSL cipher list string. The default is a curated list designed to be compatible with + // almost all software in curent use (specifically, based on Mozilla's "intermediate" + // recommendations). The defaults will change in future versions of this library to account + // for the latest cryptanalysis. + // + // Generally you should only specify your own `cipherList` if: + // - You have extreme backwards-compatibility needs and wish to enable obsolete and/or broken + // algorithms. + // - You need quickly to disable an algorithm recently discovered to be broken. + + kj::Maybe<const TlsKeypair&> defaultKeypair; + // Default keypair to use for all connections. Required for servers; optional for clients. + + kj::Maybe<TlsSniCallback&> sniCallback; + // Callback that can be used to choose a different key/certificate based on the specific + // hostname requested by the client. + }; + + TlsContext(Options options = Options()); + ~TlsContext() noexcept(false); + KJ_DISALLOW_COPY(TlsContext); + + kj::Promise<kj::Own<kj::AsyncIoStream>> wrapServer(kj::Own<kj::AsyncIoStream> stream); + // Upgrade a regular network stream to TLS and begin the initial handshake as the server. The + // returned promise resolves when the handshake has completed successfully. + + kj::Promise<kj::Own<kj::AsyncIoStream>> wrapClient( + kj::Own<kj::AsyncIoStream> stream, kj::StringPtr expectedServerHostname); + // Upgrade a regular network stream to TLS and begin the initial handshake as a client. The + // returned promise resolves when the handshake has completed successfully, including validating + // the server's certificate. + // + // You must specify the server's hostname. This is used for two purposes: + // 1. It is sent to the server in the initial handshake via the TLS SNI extension, so that a + // server serving multiple hosts knows which certificate to use. + // 2. The server's certificate is validated against this hostname. If validation fails, the + // promise returned by wrapClient() will be broken; you'll never get a stream. + + kj::Own<kj::ConnectionReceiver> wrapPort(kj::Own<kj::ConnectionReceiver> port); + // Upgrade a ConnectionReceiver to one that automatically upgrades all accepted connections to + // TLS (acting as the server). + + kj::Own<kj::Network> wrapNetwork(kj::Network& network); + // Upgrade a Network to one that automatically upgrades all connections to TLS. The network will + // only accept addresses of the form "hostname" and "hostname:port" (it does not accept raw IP + // addresses). It will automatically use SNI and verify certificates based on these hostnames. + +private: + void* ctx; // actually type SSL_CTX, but we don't want to #include the OpenSSL headers here + + static int sniCallback(void* ssl, int* ad, void* arg); +}; + +class TlsPrivateKey { + // A private key suitable for use in a TLS server. + +public: + TlsPrivateKey(kj::ArrayPtr<const byte> asn1); + // Parse a single binary (ASN1) private key. Supports PKCS8 keys as well as "traditional format" + // RSA and DSA keys. Does not accept encrypted keys; it is the caller's responsibility to + // decrypt. + + TlsPrivateKey(kj::StringPtr pem); + // Parse a single PEM-encoded private key. Supports PKCS8 keys as well as "traditional format" + // RSA and DSA keys. Does not accept encrypted keys; it is the caller's responsibility to + // decrypt. + + ~TlsPrivateKey() noexcept(false); + + TlsPrivateKey(const TlsPrivateKey& other); + TlsPrivateKey& operator=(const TlsPrivateKey& other); + // Copy-by-refcount. + + inline TlsPrivateKey(TlsPrivateKey&& other): pkey(other.pkey) { other.pkey = nullptr; } + inline TlsPrivateKey& operator=(TlsPrivateKey&& other) { + pkey = other.pkey; other.pkey = nullptr; + return *this; + } + +private: + void* pkey; // actually type EVP_PKEY* + + friend class TlsContext; +}; + +class TlsCertificate { + // A TLS certificate, possibly with chained intermediate certificates. + +public: + TlsCertificate(kj::ArrayPtr<const byte> asn1); + // Parse a single binary (ASN1) X509 certificate. + + TlsCertificate(kj::ArrayPtr<const kj::ArrayPtr<const byte>> asn1); + // Parse a chain of binary (ASN1) X509 certificates. + + TlsCertificate(kj::StringPtr pem); + // Parse a PEM-encode X509 certificate or certificate chain. A chain can be constructed by + // concatenating multiple PEM-encoded certificates, starting with the leaf certificate. + + ~TlsCertificate() noexcept(false); + + TlsCertificate(const TlsCertificate& other); + TlsCertificate& operator=(const TlsCertificate& other); + // Copy-by-refcount. + + inline TlsCertificate(TlsCertificate&& other) { + memcpy(chain, other.chain, sizeof(chain)); + memset(other.chain, 0, sizeof(chain)); + } + inline TlsCertificate& operator=(TlsCertificate&& other) { + memcpy(chain, other.chain, sizeof(chain)); + memset(other.chain, 0, sizeof(chain)); + return *this; + } + +private: + void* chain[10]; + // Actually type X509*[10]. + // + // Note that OpenSSL has a default maximum cert chain length of 10. Although configurable at + // runtime, you'd actually have to convince the _peer_ to reconfigure, which is unlikely except + // in specific use cases. So to avoid excess allocations we just assume a max of 10 certs. + // + // If this proves to be a problem, we should maybe use STACK_OF(X509) here, but stacks are not + // refcounted -- the X509_chain_up_ref() function actually allocates a new stack and uprefs all + // the certs. + + friend class TlsContext; +}; + +struct TlsKeypair { + // A pair of a private key and a certificate, for use by a server. + + TlsPrivateKey privateKey; + TlsCertificate certificate; +}; + +class TlsSniCallback { + // Callback object to implement Server Name Indication, in which the server is able to decide + // what key and certificate to use based on the hostname that the client is requesting. + // + // TODO(someday): Currently this callback is synchronous, because the OpenSSL API seems to be + // synchronous. Other people (e.g. Node) have figured out how to do it asynchronously, but + // it's unclear to me if and how this is possible while using the OpenSSL APIs. It looks like + // Node may be manually parsing the ClientHello message rather than relying on OpenSSL. We + // could do that but it's too much work for today. + +public: + virtual kj::Maybe<TlsKeypair> getKey(kj::StringPtr hostname) = 0; + // Get the key to use for `hostname`. Null return means use the default from + // TlsContext::Options::defaultKeypair. +}; + +} // namespace kj + +#endif // KJ_COMPAT_TLS_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/exception.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/exception.h index f6c0b2d..811638e 100644 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/exception.h +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/exception.h @@ -33,6 +33,7 @@ namespace kj { class ExceptionImpl; +template <typename T> class Function; class Exception { // Exception thrown in case of fatal errors. @@ -216,6 +217,11 @@ virtual StackTraceMode stackTraceMode(); // Returns the current preferred stack trace mode. + virtual Function<void(Function<void()>)> getThreadInitializer(); + // Called just before a new thread is spawned using kj::Thread. Returns a function which should + // be invoked inside the new thread to initialize the thread's ExceptionCallback. The initializer + // function itself receives, as its parameter, the thread's main function, which it must call. + protected: ExceptionCallback& next; @@ -224,6 +230,8 @@ class RootExceptionCallback; friend ExceptionCallback& getExceptionCallback(); + + friend class Thread; }; ExceptionCallback& getExceptionCallback(); diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/filesystem.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/filesystem.h new file mode 100644 index 0000000..9e14941 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/filesystem.h @@ -0,0 +1,923 @@ +// Copyright (c) 2015 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef KJ_FILESYSTEM_H_ +#define KJ_FILESYSTEM_H_ + +#include "memory.h" +#include "io.h" +#include <inttypes.h> +#include "time.h" // TODO(now): problematic +#include "function.h" + +namespace kj { + +template <typename T> +class Vector; + +class PathPtr; + +class Path { + // A Path identifies a file in a directory tree. + // + // In KJ, we avoid representing paths as plain strings because this can lead to path injection + // bugs as well as numerous kinds of bugs relating to path parsing edge cases. The Path class's + // interface is designed to "make it hard to screw up". + // + // A "Path" is in fact a list of strings, each string being one component of the path (as would + // normally be separated by '/'s). Path components are not allowed to contain '/' nor '\0', nor + // are they allowed to be the special names "", ".", nor "..". + // + // If you explicitly want to parse a path that contains '/'s, ".", and "..", you must use + // parse() and/or eval(). However, users of this interface are encouraged to avoid parsing + // paths at all, and instead express paths as string arrays. + // + // Note that when using the Path class, ".." is always canonicalized in path space without + // consulting the actual filesystem. This means that "foo/some-symlink/../bar" is exactly + // equivalent to "foo/bar". This differs from the kernel's behavior when resolving paths passed + // to system calls: the kernel would have resolved "some-symlink" to its target physical path, + // and then would have interpreted ".." relative to that. In practice, the kernel's behavior is + // rarely what the user or programmer intended, hence canonicalizing in path space produces a + // better result. + // + // Path objects are "immutable": functions that "modify" the path return a new path. However, + // if the path being operated on is an rvalue, copying can be avoided. Hence it makes sense to + // write code like: + // + // Path p = ...; + // p = kj::mv(p).append("bar"); // in-place update, avoids string copying + +public: + Path(decltype(nullptr)); // empty path + + explicit Path(StringPtr name); + explicit Path(String&& name); + // Create a Path containing only one component. `name` is a single filename; it cannot contain + // '/' nor '\0' nor can it be exactly "" nor "." nor "..". + // + // If you want to allow '/'s and such, you must call Path::parse(). We force you to do this to + // prevent path injection bugs where you didn't consider what would happen if the path contained + // a '/'. + + explicit Path(std::initializer_list<StringPtr> parts); + explicit Path(ArrayPtr<const StringPtr> parts); + explicit Path(Array<String> parts); + // Construct a path from an array. Note that this means you can do: + // + // Path{"foo", "bar", "baz"} // equivalent to Path::parse("foo/bar/baz") + + KJ_DISALLOW_COPY(Path); + Path(Path&&) = default; + Path& operator=(Path&&) = default; + + Path clone() const; + + static Path parse(StringPtr path); + // Parses a path in traditional format. Components are separated by '/'. Any use of "." or + // ".." will be canonicalized (if they can't be canonicalized, e.g. because the path starts with + // "..", an exception is thrown). Multiple consecutive '/'s will be collapsed. A leading '/' + // is NOT accepted -- if that is a problem, you probably want `eval()`. Trailing '/'s are + // ignored. + + Path append(Path suffix) const&; + Path append(Path suffix) &&; + Path append(PathPtr suffix) const&; + Path append(PathPtr suffix) &&; + Path append(StringPtr suffix) const&; + Path append(StringPtr suffix) &&; + Path append(String suffix) const&; + Path append(String suffix) &&; + // Create a new path by appending the given path to this path. + // + // `suffix` cannot contain '/' characters. Instead, you can append an array: + // + // path.append({"foo", "bar"}) + // + // Or, use Path::parse(): + // + // path.append(Path::parse("foo//baz/../bar")) + + Path eval(StringPtr pathText) const&; + Path eval(StringPtr pathText) &&; + // Evaluates a traditional path relative to this one. `pathText` is parsed like `parse()` would, + // except that: + // - It can contain leading ".." components that traverse up the tree. + // - It can have a leading '/' which completely replaces the current path. + // + // THE NAME OF THIS METHOD WAS CHOSEN TO INSPIRE FEAR. + // + // Instead of using `path.eval(str)`, always consider whether you really want + // `path.append(Path::parse(str))`. The former is much riskier than the latter in terms of path + // injection vulnerabilities. + + PathPtr basename() const&; + Path basename() &&; + // Get the last component of the path. (Use `basename()[0]` to get just the string.) + + PathPtr parent() const&; + Path parent() &&; + // Get the parent path. + + String toString(bool absolute = false) const; + // Converts the path to a traditional path string, appropriate to pass to a unix system call. + // Never throws. + + const String& operator[](size_t i) const&; + String operator[](size_t i) &&; + size_t size() const; + const String* begin() const; + const String* end() const; + PathPtr slice(size_t start, size_t end) const&; + Path slice(size_t start, size_t end) &&; + // A Path can be accessed as an array of strings. + + Path evalWin32(StringPtr pathText) const&; + Path evalWin32(StringPtr pathText) &&; + // Evaluates a Win32-style path. Differences from `eval()` include: + // + // - Backslashes can be used as path separators. + // - Absolute paths begin with a drive letter followed by a colon. The drive letter, including + // the colon, will become the first component of the path, e.g. "c:\foo" becomes {"c:", "foo"}. + // - A network path like "\\host\share\path" is parsed as {"host", "share", "path"}. + + String toWin32String(bool absolute = false) const; + // Converts the path to a Win32 path string. + // + // (In most cases you'll want to further convert the returned string from UTF-8 to UTF-16.) + // + // If `absolute` is true, the path is expected to be an absolute path, meaning the first + // component is a drive letter, namespace, or network host name. These are converted to their + // regular Win32 format -- i.e. this method does the reverse of `evalWin32()`. + // + // This throws if the path would have unexpected special meaning or is otherwise invalid on + // Windows, such as if it contains backslashes (within a path component), colons, or special + // names like "con". + +private: + Array<String> parts; + + // TODO(perf): Consider unrolling one element from `parts`, so that a one-element path doesn't + // require allocation of an array. + + enum { ALREADY_CHECKED }; + Path(Array<String> parts, decltype(ALREADY_CHECKED)); + + friend class PathPtr; + + static String stripNul(String input); + static void validatePart(StringPtr part); + static void evalPart(Vector<String>& parts, ArrayPtr<const char> part); + static Path evalImpl(Vector<String>&& parts, StringPtr path); + static Path evalWin32Impl(Vector<String>&& parts, StringPtr path); + static size_t countParts(StringPtr path); + static size_t countPartsWin32(StringPtr path); + static bool isWin32Drive(ArrayPtr<const char> part); + static bool isNetbiosName(ArrayPtr<const char> part); + static bool isWin32Special(StringPtr part); +}; + +class PathPtr { + // Points to a Path or a slice of a Path, but doesn't own it. + // + // PathPtr is to Path as ArrayPtr is to Array and StringPtr is to String. + +public: + PathPtr(decltype(nullptr)); + PathPtr(const Path& path); + + Path clone(); + Path append(Path suffix) const; + Path append(PathPtr suffix) const; + Path append(StringPtr suffix) const; + Path append(String suffix) const; + Path eval(StringPtr pathText) const; + PathPtr basename() const; + PathPtr parent() const; + String toString(bool absolute = false) const; + const String& operator[](size_t i) const; + size_t size() const; + const String* begin() const; + const String* end() const; + PathPtr slice(size_t start, size_t end) const; + Path evalWin32(StringPtr pathText) const; + String toWin32String(bool absolute = false) const; + // Equivalent to the corresponding methods of `Path`. + +private: + ArrayPtr<const String> parts; + + explicit PathPtr(ArrayPtr<const String> parts); + + friend class Path; +}; + +// ======================================================================================= +// The filesystem API +// +// This API is strictly synchronous because, unfortunately, there's no such thing as asynchronous +// filesystem access in practice. The filesystem drivers on Linux are written to assume they can +// block. The AIO API is only actually asynchronous for reading/writing the raw file blocks, but if +// the filesystem needs to be involved (to allocate blocks, update metadata, etc.) that will block. +// It's best to imagine that the filesystem is just another tier of memory that happens to be +// slower than RAM (which is slower than L3 cache, which is slower than L2, which is slower than +// L1). You can't do asynchronous RAM access so why asynchronous filesystem? The only way to +// parallelize these is using threads. + +class FsNode { + // Base class for filesystem node types. + +public: + Own<FsNode> clone(); + // Creates a new object of exactly the same type as this one, pointing at exactly the same + // external object. + // + // Under the hood, this will call dup(), so the FD number will not be the same. + + virtual Maybe<int> getFd() = 0; + // Get the underlying file descriptor, if any. Returns nullptr if this object actually isn't + // wrapping a file descriptor. + + enum class Type { + FILE, + DIRECTORY, + SYMLINK, + BLOCK_DEVICE, + CHARACTER_DEVICE, + NAMED_PIPE, + SOCKET, + OTHER, + }; + + struct Metadata { + Type type = Type::FILE; + + uint64_t size = 0; + // Logical size of the file. + + uint64_t spaceUsed = 0; + // Physical size of the file on disk. May be smaller for sparse files, or larger for + // pre-allocated files. + + Date lastModified = UNIX_EPOCH; + // Last modification time of the file. + + uint linkCount = 1; + // Number of hard links pointing to this node. + + // Not currently included: + // - Device / inode number: Rarely useful, and not safe to use in practice anyway. + // - Access control info: Differs wildly across platforms, and KJ prefers capabilities anyway. + // - Other timestamps: Differs across platforms. + // - Device number: If you care, you're probably doing platform-specific stuff anyway. + + Metadata() = default; + Metadata(Type type, uint64_t size, uint64_t spaceUsed, Date lastModified, uint linkCount) + : type(type), size(size), spaceUsed(spaceUsed), lastModified(lastModified), + linkCount(linkCount) {} + // TODO(cleanup): This constructor is redundant in C++14, but needed in C++11. + }; + + virtual Metadata stat() = 0; + + virtual void sync() = 0; + virtual void datasync() = 0; + // Maps to fsync() and fdatasync() system calls. + // + // Also, when creating or overwriting a file, the first call to sync() atomically links the file + // into the filesystem (*after* syncing the data), so than incomplete data is never visible to + // other processes. (In practice this works by writing into a temporary file and then rename()ing + // it.) + +protected: + virtual Own<FsNode> cloneFsNode() = 0; + // Implements clone(). Required to return an object with exactly the same type as this one. + // Hence, every subclass must implement this. +}; + +class ReadableFile: public FsNode { +public: + Own<ReadableFile> clone(); + + String readAllText(); + // Read all text in the file and return as a big string. + + Array<byte> readAllBytes(); + // Read all bytes in the file and return as a big byte array. + // + // This differs from mmap() in that the read is performed all at once. Future changes to the file + // do not affect the returned copy. Consider using mmap() instead, particularly for large files. + + virtual size_t read(uint64_t offset, ArrayPtr<byte> buffer) = 0; + // Fills `buffer` with data starting at `offset`. Returns the number of bytes actually read -- + // the only time this is less than `buffer.size()` is when EOF occurs mid-buffer. + + virtual Array<const byte> mmap(uint64_t offset, uint64_t size) = 0; + // Maps the file to memory read-only. The returned array always has exactly the requested size. + // Depending on the capabilities of the OS and filesystem, the mapping may or may not reflect + // changes that happen to the file after mmap() returns. + // + // Multiple calls to mmap() on the same file may or may not return the same mapping (it is + // immutable, so there's no possibility of interference). + // + // If the file cannot be mmap()ed, an implementation may choose to allocate a buffer on the heap, + // read into it, and return that. This should only happen if a real mmap() is impossible. + // + // The returned array is always exactly the size requested. However, accessing bytes beyond the + // current end of the file may raise SIGBUS, or may simply return zero. + + virtual Array<byte> mmapPrivate(uint64_t offset, uint64_t size) = 0; + // Like mmap() but returns a view that the caller can modify. Modifications will not be written + // to the underlying file. Every call to this method returns a unique mapping. Changes made to + // the underlying file by other clients may or may not be reflected in the mapping -- in fact, + // some changes may be reflected while others aren't, even within the same mapping. + // + // In practice this is often implemented using copy-on-write pages. When you first write to a + // page, a copy is made. Hence, changes to the underlying file within that page stop being + // reflected in the mapping. +}; + +class AppendableFile: public FsNode, public OutputStream { +public: + Own<AppendableFile> clone(); + + // All methods are inherited. +}; + +class WritableFileMapping { +public: + virtual ArrayPtr<byte> get() = 0; + // Gets the mapped bytes. The returned array can be modified, and those changes may be written to + // the underlying file, but there is no guarantee that they are written unless you subsequently + // call changed(). + + virtual void changed(ArrayPtr<byte> slice) = 0; + // Notifies the implementation that the given bytes have changed. For some implementations this + // may be a no-op while for others it may be necessary in order for the changes to be written + // back at all. + // + // `slice` must be a slice of `bytes()`. + + virtual void sync(ArrayPtr<byte> slice) = 0; + // Implies `changed()`, and then waits until the range has actually been written to disk before + // returning. + // + // `slice` must be a slice of `bytes()`. +}; + +class File: public ReadableFile { +public: + Own<File> clone(); + + void writeAll(ArrayPtr<const byte> bytes); + void writeAll(StringPtr text); + // Completely replace the file with the given bytes or text. + + virtual void write(uint64_t offset, ArrayPtr<const byte> data) = 0; + // Write the given data starting at the given offset in the file. + + virtual void zero(uint64_t offset, uint64_t size) = 0; + // Write zeros to the file, starting at `offset` and continuing for `size` bytes. If the platform + // supports it, this will "punch a hole" in the file, such that blocks that are entirely zeros + // do not take space on disk. + + virtual void truncate(uint64_t size) = 0; + // Set the file end pointer to `size`. If `size` is less than the current size, data past the end + // is truncated. If `size` is larger than the current size, zeros are added to the end of the + // file. If the platform supports it, blocks containing all-zeros will not be stored to disk. + + virtual Own<WritableFileMapping> mmapWritable(uint64_t offset, uint64_t size) = 0; + // Like ReadableFile::mmap() but returns a mapping for which any changes will be immediately + // visible in other mappings of the file on the same system and will eventually be written back + // to the file. + + virtual size_t copy(uint64_t offset, ReadableFile& from, uint64_t fromOffset, uint64_t size); + // Copies bytes from one file to another. + // + // Copies `size` bytes or to EOF, whichever comes first. Returns the number of bytes actually + // copied. Hint: Pass kj::maxValue for `size` to always copy to EOF. + // + // The copy is not atomic. Concurrent writes may lead to garbage results. + // + // The default implementation performs a series of reads and writes. Subclasses can often provide + // superior implementations that offload the work to the OS or even implement copy-on-write. +}; + +class ReadableDirectory: public FsNode { + // Read-only subset of `Directory`. + +public: + Own<ReadableDirectory> clone(); + + virtual Array<String> listNames() = 0; + // List the contents of this directory. Does NOT include "." nor "..". + + struct Entry { + FsNode::Type type; + String name; + + inline bool operator< (const Entry& other) const { return name < other.name; } + inline bool operator> (const Entry& other) const { return name > other.name; } + inline bool operator<=(const Entry& other) const { return name <= other.name; } + inline bool operator>=(const Entry& other) const { return name >= other.name; } + // Convenience comparison operators to sort entries by name. + }; + + virtual Array<Entry> listEntries() = 0; + // List the contents of the directory including the type of each file. On some platforms and + // filesystems, this is just as fast as listNames(), but on others it may require stat()ing each + // file. + + virtual bool exists(PathPtr path) = 0; + // Does the specified path exist? + // + // If the path is a symlink, the symlink is followed and the return value indicates if the target + // exists. If you want to know if the symlink exists, use lstat(). (This implies that listNames() + // may return names for which exists() reports false.) + + FsNode::Metadata lstat(PathPtr path); + virtual Maybe<FsNode::Metadata> tryLstat(PathPtr path) = 0; + // Gets metadata about the path. If the path is a symlink, it is not followed -- the metadata + // describes the symlink itself. `tryLstat()` returns null if the path doesn't exist. + + Own<ReadableFile> openFile(PathPtr path); + virtual Maybe<Own<ReadableFile>> tryOpenFile(PathPtr path) = 0; + // Open a file for reading. + // + // `tryOpenFile()` returns null if the path doesn't exist. Other errors still throw exceptions. + + Own<ReadableDirectory> openSubdir(PathPtr path); + virtual Maybe<Own<ReadableDirectory>> tryOpenSubdir(PathPtr path) = 0; + // Opens a subdirectory. + // + // `tryOpenSubdir()` returns null if the path doesn't exist. Other errors still throw exceptions. + + String readlink(PathPtr path); + virtual Maybe<String> tryReadlink(PathPtr path) = 0; + // If `path` is a symlink, reads and returns the link contents. + // + // See Directory::symlink() for warnings about symlinks. +}; + +enum class WriteMode { + // Mode for opening a file (or directory) for write. + // + // (To open a file or directory read-only, do not specify a mode.) + // + // WriteMode is a bitfield. Hence, it overloads the bitwise logic operators. To check if a + // particular bit is set in a bitfield, use kj::has(), like: + // + // if (kj::has(mode, WriteMode::MUST_EXIST)) { + // requireExists(path); + // } + // + // (`if (mode & WriteMode::MUST_EXIST)` doesn't work because WriteMode is an enum class, which + // cannot be converted to bool. Alas, C++ does not allow you to define a conversion operator + // on an enum type, so we can't define a conversion to bool.) + + // ----------------------------------------- + // Core flags + // + // At least one of CREATE or MODIFY must be specified. Optionally, the two flags can be combined + // with a bitwise-OR. + + CREATE = 1, + // Create a new empty file. + // + // This can be OR'd with MODIFY, but not with REPLACE. + // + // When not combined with MODIFY, if the file already exists (including as a broken symlink), + // tryOpenFile() returns null (and openFile() throws). + // + // When combined with MODIFY, if the path already exists, it will be opened as if CREATE hadn't + // been specified at all. If the path refers to a broken symlink, the file at the target of the + // link will be created (if its parent directory exists). + + MODIFY = 2, + // Modify an existing file. + // + // This can be OR'd with CREATE, but not with REPLACE. + // + // When not combined with CREATE, if the file doesn't exist (including if it is a broken symlink), + // tryOpenFile() returns null (and openFile() throws). + // + // When combined with CREATE, if the path doesn't exist, it will be created as if MODIFY hadn't + // been specified at all. If the path refers to a broken symlink, the file at the target of the + // link will be created (if its parent directory exists). + + // ----------------------------------------- + // Additional flags + // + // Any number of these may be OR'd with the core flags. + + CREATE_PARENT = 4, + // Indicates that if the target node's parent directory doesn't exist, it should be created + // automatically, along with its parent, and so on. This creation is NOT atomic. + // + // This bit only makes sense with CREATE or REPLACE. + + EXECUTABLE = 8, + // Mark this file executable, if this is a meaningful designation on the host platform. + + PRIVATE = 16, + // Indicates that this file is sensitive and should have permissions masked so that it is only + // accessible by the current user. + // + // When this is not used, the platform's default access control settings are used. On Unix, + // that usually means the umask is applied. On Windows, it means permissions are inherited from + // the parent. +}; + +inline constexpr WriteMode operator|(WriteMode a, WriteMode b) { + return static_cast<WriteMode>(static_cast<uint>(a) | static_cast<uint>(b)); +} +inline constexpr WriteMode operator&(WriteMode a, WriteMode b) { + return static_cast<WriteMode>(static_cast<uint>(a) & static_cast<uint>(b)); +} +inline constexpr WriteMode operator+(WriteMode a, WriteMode b) { + return static_cast<WriteMode>(static_cast<uint>(a) | static_cast<uint>(b)); +} +inline constexpr WriteMode operator-(WriteMode a, WriteMode b) { + return static_cast<WriteMode>(static_cast<uint>(a) & ~static_cast<uint>(b)); +} +template <typename T, typename = EnableIf<__is_enum(T)>> +bool has(T haystack, T needle) { + return (static_cast<__underlying_type(T)>(haystack) & + static_cast<__underlying_type(T)>(needle)) == + static_cast<__underlying_type(T)>(needle); +} + +enum class TransferMode { + // Specifies desired behavior for Directory::transfer(). + + MOVE, + // The node is moved to the new location, i.e. the old location is deleted. If possible, this + // move is performed without copying, otherwise it is performed as a copy followed by a delete. + + LINK, + // The new location becomes a synonym for the old location (a "hard link"). Filesystems have + // varying support for this -- typically, it is not supported on directories. + + COPY + // The new location becomes a copy of the old. + // + // Some filesystems may implement this in terms of copy-on-write. + // + // If the filesystem supports sparse files, COPY takes sparseness into account -- it will punch + // holes in the target file where holes exist in the source file. +}; + +class Directory: public ReadableDirectory { + // Refers to a specific directory on disk. + // + // A `Directory` object *only* provides access to children of the directory, not parents. That + // is, you cannot open the file "..", nor jump to the root directory with "/". + // + // On OSs that support in, a `Directory` is backed by an open handle to the directory node. This + // means: + // - If the directory is renamed on-disk, the `Directory` object still points at it. + // - Opening files in the directory only requires the OS to traverse the path from the directory + // to the file; it doesn't have to re-traverse all the way from the filesystem root. + +public: + Own<Directory> clone(); + + template <typename T> + class Replacer { + // Implements an atomic replacement of a file or directory, allowing changes to be made to + // storage in a way that avoids losing data in a power outage and prevents other processes + // from observing content in an inconsistent state. + // + // `T` may be `File` or `Directory`. For readability, the text below describes replacing a + // file, but the logic is the same for directories. + // + // When you call `Directory::replaceFile()`, a temporary file is created, but the specified + // path is not yet touched. You may call `get()` to obtain the temporary file object, through + // which you may initialize its content, knowing that no other process can see it yet. The file + // is atomically moved to its final path when you call `commit()`. If you destroy the Replacer + // without calling commit(), the temporary file is deleted. + // + // Note that most operating systems sadly do not support creating a truly unnamed temporary file + // and then linking it in later. Moreover, the file cannot necessarily be created in the system + // temporary directory because it might not be on the same filesystem as the target. Therefore, + // the replacement file may initially be created in the same directory as its eventual target. + // The implementation of Directory will choose a name that is unique and "hidden" according to + // the conventions of the filesystem. Additionally, the implementation of Directory will avoid + // returning these temporary files from its list*() methods, in order to avoid observable + // inconsistencies across platforms. + public: + explicit Replacer(WriteMode mode); + + virtual T& get() = 0; + // Gets the File or Directory representing the replacement data. Fill in this object before + // calling commit(). + + void commit(); + virtual bool tryCommit() = 0; + // Commit the replacement. + // + // `tryCommit()` may return false based on the CREATE/MODIFY bits passed as the WriteMode when + // the replacement was initiated. (If CREATE but not MODIFY was used, tryCommit() returns + // false to indicate that the target file already existed. If MODIFY but not CREATE was used, + // tryCommit() returns false to indicate that the file didn't exist.) + // + // `commit()` is atomic, meaning that there is no point in time at which other processes + // observing the file will see it in an intermediate state -- they will either see the old + // content or the complete new content. This includes in the case of a power outage or machine + // failure: on recovery, the file will either be in the old state or the new state, but not in + // some intermediate state. + // + // It's important to note that a power failure *after commit() returns* can still revert the + // file to its previous state. That is, `commit()` does NOT guarantee that, upon return, the + // new content is durable. In order to guarantee this, you must call `sync()` on the immediate + // parent directory of the replaced file. + // + // Note that, sadly, not all filesystems / platforms are capable of supporting all of the + // guarantees documented above. In such cases, commit() will make a best-effort attempt to do + // what it claims. Some examples of possible problems include: + // - Any guarantees about durability through a power outage probably require a journaling + // filesystem. + // - Many platforms do not support atomically replacing a non-empty directory. Linux does as + // of kernel 3.15 (via the renameat2() syscall using RENAME_EXCHANGE). Where not supported, + // the old directory will be moved away just before the replacement is moved into place. + // - Many platforms do not support atomically requiring the existence or non-existence of a + // file before replacing it. In these cases, commit() may have to perform the check as a + // separate step, with a small window for a race condition. + // - Many platforms do not support "unlinking" a non-empty directory, meaning that a replaced + // directory will need to be deconstructed by deleting all contents. If another process has + // the directory open when it is replaced, that process will observe the contents + // disappearing after the replacement (actually, a swap) has taken place. This differs from + // files, where a process that has opened a file before it is replaced will continue see the + // file's old content unchanged after the replacement. + + protected: + const WriteMode mode; + }; + + using ReadableDirectory::openFile; + using ReadableDirectory::openSubdir; + using ReadableDirectory::tryOpenFile; + using ReadableDirectory::tryOpenSubdir; + + Own<File> openFile(PathPtr path, WriteMode mode); + virtual Maybe<Own<File>> tryOpenFile(PathPtr path, WriteMode mode) = 0; + // Open a file for writing. + // + // `tryOpenFile()` returns null if the path is required to exist but doesn't (MODIFY or REPLACE) + // or if the path is required not to exist but does (CREATE or RACE). + + virtual Own<Replacer<File>> replaceFile(PathPtr path, WriteMode mode) = 0; + // Construct a file which, when ready, will be atomically moved to `path`, replacing whatever + // is there already. See `Replacer<T>` for detalis. + // + // The `CREATE` and `MODIFY` bits of `mode` are not enforced until commit time, hence + // `replaceFile()` has no "try" variant. + + virtual Own<File> createTemporary() = 0; + // Create a temporary file backed by this directory's filesystem, but which isn't linked into + // the directory tree. The file is deleted from disk when all references to it have been dropped. + + Own<AppendableFile> appendFile(PathPtr path, WriteMode mode); + virtual Maybe<Own<AppendableFile>> tryAppendFile(PathPtr path, WriteMode mode) = 0; + // Opens the file for appending only. Useful for log files. + // + // If the underlying filesystem supports it, writes to the file will always be appended even if + // other writers are writing to the same file at the same time -- however, some implementations + // may instead assume that no other process is changing the file size between writes. + + Own<Directory> openSubdir(PathPtr path, WriteMode mode); + virtual Maybe<Own<Directory>> tryOpenSubdir(PathPtr path, WriteMode mode) = 0; + // Opens a subdirectory for writing. + + virtual Own<Replacer<Directory>> replaceSubdir(PathPtr path, WriteMode mode) = 0; + // Construct a directory which, when ready, will be atomically moved to `path`, replacing + // whatever is there already. See `Replacer<T>` for detalis. + // + // The `CREATE` and `MODIFY` bits of `mode` are not enforced until commit time, hence + // `replaceSubdir()` has no "try" variant. + + void symlink(PathPtr linkpath, StringPtr content, WriteMode mode); + virtual bool trySymlink(PathPtr linkpath, StringPtr content, WriteMode mode) = 0; + // Create a symlink. `content` is the raw text which will be written into the symlink node. + // How this text is interpreted is entirely dependent on the filesystem. Note in particular that: + // - Windows will require a path that uses backslashes as the separator. + // - InMemoryDirectory does not support symlinks containing "..". + // + // Unfortunately under many implementations symlink() can be used to break out of the directory + // by writing an absolute path or utilizing "..". Do not call this method with a value for + // `target` that you don't trust. + // + // `mode` must be CREATE or REPLACE, not MODIFY. CREATE_PARENT is honored but EXECUTABLE and + // PRIVATE have no effect. `trySymlink()` returns false in CREATE mode when the target already + // exists. + + void transfer(PathPtr toPath, WriteMode toMode, + PathPtr fromPath, TransferMode mode); + void transfer(PathPtr toPath, WriteMode toMode, + Directory& fromDirectory, PathPtr fromPath, + TransferMode mode); + virtual bool tryTransfer(PathPtr toPath, WriteMode toMode, + Directory& fromDirectory, PathPtr fromPath, + TransferMode mode); + virtual Maybe<bool> tryTransferTo(Directory& toDirectory, PathPtr toPath, WriteMode toMode, + PathPtr fromPath, TransferMode mode); + // Move, link, or copy a file/directory tree from one location to another. + // + // Filesystems vary in what kinds of transfers are allowed, especially for TransferMode::LINK, + // and whether TransferMode::MOVE is implemented as an actual move vs. copy+delete. + // + // tryTransfer() returns false if the source location didn't exist, or when `toMode` is CREATE + // and the target already exists. The default implementation implements only TransferMode::COPY. + // + // tryTransferTo() exists to implement double-dispatch. It should be called as a fallback by + // implementations of tryTransfer() in cases where the target directory would otherwise fail or + // perform a pessimal transfer. The default implementation returns nullptr, which the caller + // should interpret as: "I don't have any special optimizations; do the obvious thing." + // + // `toMode` controls how the target path is created. CREATE_PARENT is honored but EXECUTABLE and + // PRIVATE have no effect. + + void remove(PathPtr path); + virtual bool tryRemove(PathPtr path) = 0; + // Deletes/unlinks the given path. If the path names a directory, it is recursively deleted. + // + // tryRemove() returns false if the path doesn't exist; remove() throws in this case. + + // TODO(someday): + // - Support sockets? There's no openat()-like interface for sockets, so it's hard to support + // them currently. Also you'd probably want to use them with the async library. + // - Support named pipes? Unclear if there's a use case that isn't better-served by sockets. + // Then again, they can be openat()ed. + // - Support watching for changes (inotify). Probably also requires the async library. Also + // lacks openat()-like semantics. + // - xattrs -- linux-specific + // - chown/chmod/etc. -- unix-specific, ACLs, eww + // - set timestamps -- only needed by archiving programs/ + // - advisory locks + // - sendfile? + // - fadvise and such + +private: + static void commitFailed(WriteMode mode); +}; + +class Filesystem { +public: + virtual Directory& getRoot() = 0; + // Get the filesystem's root directory, as of the time the Filesystem object was created. + + virtual Directory& getCurrent() = 0; + // Get the filesystem's current directory, as of the time the Filesystem object was created. + + virtual PathPtr getCurrentPath() = 0; + // Get the path from the root to the current directory, as of the time the Filesystem object was + // created. Note that because a `Directory` does not provide access to its parent, if you want to + // follow `..` from the current directory, you must use `getCurrentPath().eval("..")` or + // `getCurrentPath().parent()`. + // + // This function attempts to determine the path as it appeared in the user's shell before this + // program was started. That means, if the user had `cd`ed into a symlink, the path through that + // symlink is returned, *not* the canonical path. + // + // Because of this, there is an important difference between how the operating system interprets + // "../foo" and what you get when you write `getCurrentPath().eval("../foo")`: The former + // will interpret ".." relative to the directory's canonical path, whereas the latter will + // interpret it relative to the path shown in the user's shell. In practice, the latter is + // almost always what the user wants! But the former behavior is what almost all commands do + // in practice, and it leads to confusion. KJ commands should implement the behavior the user + // expects. +}; + +// ======================================================================================= + +Own<File> newInMemoryFile(Clock& clock); +Own<Directory> newInMemoryDirectory(Clock& clock); +// Construct file and directory objects which reside in-memory. +// +// InMemoryFile has the following special properties: +// - The backing store is not sparse and never gets smaller even if you truncate the file. +// - While a non-private memory mapping exists, the backing store cannot get larger. Any operation +// which would expand it will throw. +// +// InMemoryDirectory has the following special properties: +// - Symlinks are processed using Path::parse(). This implies tha a symlink cannot point to a +// parent directory -- InMemoryDirectory does not know its parent. +// - link() can link directory nodes in addition to files. +// - link() and rename() accept any kind of Directory as `fromDirectory` -- it doesn't need to be +// another InMemoryDirectory. However, for rename(), the from path must be a directory. + +Own<AppendableFile> newFileAppender(Own<File> inner); +// Creates an AppendableFile by wrapping a File. Note that this implementation assumes it is the +// only writer. A correct implementation should always append to the file even if other writes +// are happening simultaneously, as is achieved with the O_APPEND flag to open(2), but that +// behavior is not possible to emulate on top of `File`. + +Own<ReadableFile> newDiskReadableFile(kj::AutoCloseFd fd); +Own<AppendableFile> newDiskAppendableFile(kj::AutoCloseFd fd); +Own<File> newDiskFile(kj::AutoCloseFd fd); +Own<ReadableDirectory> newDiskReadableDirectory(kj::AutoCloseFd fd); +Own<Directory> newDiskDirectory(kj::AutoCloseFd fd); +// Wrap a file descriptor as various filesystem types. + +Own<Filesystem> newDiskFilesystem(); +// Get at implementation of `Filesystem` representing the real filesystem. +// +// DO NOT CALL THIS except at the top level of your program, e.g. in main(). Anywhere else, you +// should instead have your caller pass in a Filesystem object, or a specific Directory object, +// or whatever it is that your code needs. This ensures that your code supports dependency +// injection, which makes it more reusable and testable. +// +// newDiskFilesystem() reads the current working directory at the time it is called. The returned +// object is not affected by subsequent calls to chdir(). + +// ======================================================================================= +// inline implementation details + +inline Path::Path(decltype(nullptr)): parts(nullptr) {} +inline Path::Path(std::initializer_list<StringPtr> parts) + : Path(arrayPtr(parts.begin(), parts.end())) {} +inline Path::Path(Array<String> parts, decltype(ALREADY_CHECKED)) + : parts(kj::mv(parts)) {} +inline Path Path::clone() const { return PathPtr(*this).clone(); } +inline Path Path::append(Path suffix) const& { return PathPtr(*this).append(kj::mv(suffix)); } +inline Path Path::append(PathPtr suffix) const& { return PathPtr(*this).append(suffix); } +inline Path Path::append(StringPtr suffix) const& { return append(Path(suffix)); } +inline Path Path::append(StringPtr suffix) && { return kj::mv(*this).append(Path(suffix)); } +inline Path Path::append(String suffix) const& { return append(Path(kj::mv(suffix))); } +inline Path Path::append(String suffix) && { return kj::mv(*this).append(Path(kj::mv(suffix))); } +inline Path Path::eval(StringPtr pathText) const& { return PathPtr(*this).eval(pathText); } +inline PathPtr Path::basename() const& { return PathPtr(*this).basename(); } +inline PathPtr Path::parent() const& { return PathPtr(*this).parent(); } +inline const String& Path::operator[](size_t i) const& { return parts[i]; } +inline String Path::operator[](size_t i) && { return kj::mv(parts[i]); } +inline size_t Path::size() const { return parts.size(); } +inline const String* Path::begin() const { return parts.begin(); } +inline const String* Path::end() const { return parts.end(); } +inline PathPtr Path::slice(size_t start, size_t end) const& { + return PathPtr(*this).slice(start, end); +} +inline String Path::toString(bool absolute) const { return PathPtr(*this).toString(absolute); } +inline Path Path::evalWin32(StringPtr pathText) const& { + return PathPtr(*this).evalWin32(pathText); +} +inline String Path::toWin32String(bool absolute) const { + return PathPtr(*this).toWin32String(absolute); +} + +inline PathPtr::PathPtr(decltype(nullptr)): parts(nullptr) {} +inline PathPtr::PathPtr(const Path& path): parts(path.parts) {} +inline PathPtr::PathPtr(ArrayPtr<const String> parts): parts(parts) {} +inline Path PathPtr::append(StringPtr suffix) const { return append(Path(suffix)); } +inline Path PathPtr::append(String suffix) const { return append(Path(kj::mv(suffix))); } +inline const String& PathPtr::operator[](size_t i) const { return parts[i]; } +inline size_t PathPtr::size() const { return parts.size(); } +inline const String* PathPtr::begin() const { return parts.begin(); } +inline const String* PathPtr::end() const { return parts.end(); } +inline PathPtr PathPtr::slice(size_t start, size_t end) const { + return PathPtr(parts.slice(start, end)); +} + +inline Own<FsNode> FsNode::clone() { return cloneFsNode().downcast<FsNode>(); } +inline Own<ReadableFile> ReadableFile::clone() { return cloneFsNode().downcast<ReadableFile>(); } +inline Own<AppendableFile> AppendableFile::clone() { + return cloneFsNode().downcast<AppendableFile>(); +} +inline Own<File> File::clone() { return cloneFsNode().downcast<File>(); } +inline Own<ReadableDirectory> ReadableDirectory::clone() { + return cloneFsNode().downcast<ReadableDirectory>(); +} +inline Own<Directory> Directory::clone() { return cloneFsNode().downcast<Directory>(); } + +inline void Directory::transfer( + PathPtr toPath, WriteMode toMode, PathPtr fromPath, TransferMode mode) { + return transfer(toPath, toMode, *this, fromPath, mode); +} + +template <typename T> +inline Directory::Replacer<T>::Replacer(WriteMode mode): mode(mode) {} + +template <typename T> +void Directory::Replacer<T>::commit() { + if (!tryCommit()) commitFailed(mode); +} + +} // namespace kj + +#endif // KJ_FILESYSTEM_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/miniposix.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/miniposix.h new file mode 100644 index 0000000..111c9bc --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/miniposix.h @@ -0,0 +1,152 @@ +// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +// Licensed under the MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef KJ_MINIPOSIX_H_ +#define KJ_MINIPOSIX_H_ + +// This header provides a small subset of the POSIX API which also happens to be available on +// Windows under slightly-different names. + +#if defined(__GNUC__) && !KJ_HEADER_WARNINGS +#pragma GCC system_header +#endif + +#if _WIN32 +#include <io.h> +#include <direct.h> +#include <fcntl.h> // _O_BINARY +#else +#include <limits.h> +#include <errno.h> +#endif + +#if !_WIN32 || __MINGW32__ +#include <unistd.h> +#include <sys/stat.h> +#include <sys/types.h> +#endif + +#if !_WIN32 +#include <sys/uio.h> +#endif + +namespace kj { +namespace miniposix { + +#if _WIN32 && !__MINGW32__ +// We're on Windows and not MinGW. So, we need to define wrappers for the POSIX API. + +typedef int ssize_t; + +inline ssize_t read(int fd, void* buffer, size_t size) { + return ::_read(fd, buffer, size); +} +inline ssize_t write(int fd, const void* buffer, size_t size) { + return ::_write(fd, buffer, size); +} +inline int close(int fd) { + return ::_close(fd); +} + +#ifndef F_OK +#define F_OK 0 // access() existence test +#endif + +#ifndef S_ISREG +#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) // stat() regular file test +#endif +#ifndef S_ISDIR +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) // stat() directory test +#endif + +#ifndef STDIN_FILENO +#define STDIN_FILENO 0 +#endif +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif +#ifndef STDERR_FILENO +#define STDERR_FILENO 2 +#endif + +#else +// We're on a POSIX system or MinGW which already defines the wrappers for us. + +using ::ssize_t; +using ::read; +using ::write; +using ::close; + +#endif + +#if _WIN32 +// We're on Windows, including MinGW. pipe() and mkdir() are non-standard even on MinGW. + +inline int pipe(int fds[2]) { + return ::_pipe(fds, 8192, _O_BINARY); +} +inline int mkdir(const char* path, int mode) { + return ::_mkdir(path); +} + +#else +// We're on real POSIX. + +using ::pipe; +using ::mkdir; + +inline size_t iovMax(size_t count) { + // Apparently, there is a maximum number of iovecs allowed per call. I don't understand why. + // Most platforms define IOV_MAX but Linux defines only UIO_MAXIOV and others, like Hurd, + // define neither. + // + // On platforms where both IOV_MAX and UIO_MAXIOV are undefined, we poke sysconf(_SC_IOV_MAX), + // then try to fall back to the POSIX-mandated minimum of _XOPEN_IOV_MAX if that fails. + // + // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html#tag_13_23_03_01 + +#if defined(IOV_MAX) + // Solaris (and others?) + return IOV_MAX; +#elif defined(UIO_MAXIOV) + // Linux + return UIO_MAXIOV; +#else + // POSIX mystery meat + + long iovmax; + + errno = 0; + if ((iovmax = sysconf(_SC_IOV_MAX)) == -1) { + // assume iovmax == -1 && errno == 0 means "unbounded" + return errno ? _XOPEN_IOV_MAX : count; + } else { + return (size_t) iovmax; + } +#endif +} + +#endif + +} // namespace miniposix +} // namespace kj + +#endif // KJ_MINIPOSIX_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/mutex.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/mutex.h index d211ebf..76edeb2 100644 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/mutex.h +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/mutex.h @@ -67,6 +67,16 @@ // non-trivial, assert that the mutex is locked (which should be good enough to catch problems // in unit tests). In non-debug builds, do nothing. +#if KJ_USE_FUTEX // TODO(soon): Implement on pthread & win32 + class Predicate { + public: + virtual bool check() = 0; + }; + + void lockWhen(Predicate& predicate); + // Lock (exclusively) when predicate.check() returns true. +#endif + private: #if KJ_USE_FUTEX uint futex; @@ -79,6 +89,11 @@ static constexpr uint EXCLUSIVE_HELD = 1u << 31; static constexpr uint EXCLUSIVE_REQUESTED = 1u << 30; static constexpr uint SHARED_COUNT_MASK = EXCLUSIVE_REQUESTED - 1; + + struct Waiter; + kj::Maybe<Waiter&> waitersHead = nullptr; + kj::Maybe<Waiter&>* waitersTail = &waitersHead; + // linked list of waitUntil()s; can only modify under lock #elif _WIN32 uintptr_t srwLock; // Actually an SRWLOCK, but don't want to #include <windows.h> in header. @@ -249,6 +264,39 @@ inline T& getAlreadyLockedExclusive() const; // Like `getWithoutLock()`, but asserts that the lock is already held by the calling thread. +#if KJ_USE_FUTEX // TODO(soon): Implement on pthread & win32 + template <typename Cond, typename Func> + auto when(Cond&& condition, Func&& callback) const -> decltype(callback(instance<T&>())) { + // Waits until condition(state) returns true, then calls callback(state) under lock. + // + // `condition`, when called, receives as its parameter a const reference to the state, which is + // locked (either shared or exclusive). `callback` returns a mutable reference, which is + // exclusively locked. + // + // `condition()` may be called multiple times, from multiple threads, while waiting for the + // condition to become true. It may even return true once, but then be called more times. + // It is guaranteed, though, that at the time `callback()` is finally called, `condition()` + // would currently return true (assuming it is a pure function of the guarded data). + + struct PredicateImpl final: public _::Mutex::Predicate { + bool check() override { + return condition(value); + } + + Cond&& condition; + const T& value; + + PredicateImpl(Cond&& condition, const T& value) + : condition(kj::fwd<Cond>(condition)), value(value) {} + }; + + PredicateImpl impl(kj::fwd<Cond>(condition), value); + mutex.lockWhen(impl); + KJ_DEFER(mutex.unlock(_::Mutex::EXCLUSIVE)); + return callback(value); + } +#endif + private: mutable _::Mutex mutex; mutable T value; diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/one-of.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/one-of.h index 6e143c4..7b3f965 100644 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/one-of.h +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/one-of.h @@ -81,6 +81,21 @@ return *reinterpret_cast<T*>(space); } + template <typename T> + Maybe<T&> tryGet() { + if (is<T>()) { + return *reinterpret_cast<T*>(space); + } else { + return nullptr; + } + } + + template <uint i> + KJ_NORETURN(void allHandled()); + // After a series of if/else blocks handling each variant of the OneOf, have the final else + // block call allHandled<n>() where n is the number of variants. This will fail to compile + // if new variants are added in the future. + private: uint tag; @@ -150,6 +165,17 @@ } }; +template <typename... Variants> +template <uint i> +void OneOf<Variants...>::allHandled() { + // After a series of if/else blocks handling each variant of the OneOf, have the final else + // block call allHandled<n>() where n is the number of variants. This will fail to compile + // if new variants are added in the future. + + static_assert(i == sizeof...(Variants), "new OneOf variants need to be handled here"); + KJ_UNREACHABLE; +} + } // namespace kj #endif // KJ_ONE_OF_H_ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/parse/char.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/parse/char.h index 2e6d519..ee582bd 100644 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/parse/char.h +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/parse/char.h @@ -111,6 +111,13 @@ return (bits[c / 64] & (1ll << (c % 64))) != 0; } + inline bool containsAll(ArrayPtr<const char> text) const { + for (char c: text) { + if (!contains(c)) return false; + } + return true; + } + template <typename Input> Maybe<char> operator()(Input& input) const { if (input.atEnd()) return nullptr; diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/thread.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/thread.h index b17b88c..29146fb 100644 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/thread.h +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/thread.h @@ -53,7 +53,10 @@ private: struct ThreadState { + ThreadState(Function<void()> func); + Function<void()> func; + Function<void(Function<void()>)> initializer; kj::Maybe<kj::Exception> exception; unsigned int refcount; diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/vector.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/vector.h index 44613f3..f99c9e3 100644 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/vector.h +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/vector.h @@ -43,6 +43,7 @@ public: inline Vector() = default; inline explicit Vector(size_t capacity): builder(heapArrayBuilder<T>(capacity)) {} + inline Vector(Array<T>&& array): builder(kj::mv(array)) {} inline operator ArrayPtr<T>() { return builder; } inline operator ArrayPtr<const T>() const { return builder; } @@ -69,6 +70,18 @@ setCapacity(size()); } return builder.finish(); + } + + template <typename U> + inline bool operator==(const U& other) const { return asPtr() == other; } + template <typename U> + inline bool operator!=(const U& other) const { return asPtr() != other; } + + inline ArrayPtr<T> slice(size_t start, size_t end) { + return asPtr().slice(start, end); + } + inline ArrayPtr<const T> slice(size_t start, size_t end) const { + return asPtr().slice(start, end); } template <typename... Params> @@ -103,9 +116,7 @@ } inline void clear() { - while (builder.size() > 0) { - builder.removeLast(); - } + builder.resize(0); } inline void truncate(size_t size) { diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-0.6.1.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-0.6.1.so deleted file mode 100644 index 44becdd..0000000 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-0.6.1.so +++ /dev/null Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-0.7-dev.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-0.7-dev.so new file mode 100644 index 0000000..b18404c --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-0.7-dev.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-json-0.7-dev.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-json-0.7-dev.so new file mode 100644 index 0000000..cb40c16 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-json-0.7-dev.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-json.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-json.so new file mode 100644 index 0000000..cb40c16 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp-json.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp.so new file mode 100644 index 0000000..b18404c --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnp.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnpc-0.6.1.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnpc-0.6.1.so deleted file mode 100644 index db69c7d..0000000 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnpc-0.6.1.so +++ /dev/null Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnpc-0.7-dev.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnpc-0.7-dev.so new file mode 100644 index 0000000..347e32a --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnpc-0.7-dev.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnpc.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnpc.so new file mode 100644 index 0000000..347e32a --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libcapnpc.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libkj-0.6.1.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libkj-0.6.1.so deleted file mode 100644 index b96778d..0000000 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libkj-0.6.1.so +++ /dev/null Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libkj-0.7-dev.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libkj-0.7-dev.so new file mode 100644 index 0000000..95087f8 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libkj-0.7-dev.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libkj.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libkj.so new file mode 100644 index 0000000..95087f8 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/arm64-v8a/libkj.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-0.6.1.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-0.6.1.so deleted file mode 100644 index cd3fbb6..0000000 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-0.6.1.so +++ /dev/null Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-0.7-dev.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-0.7-dev.so new file mode 100644 index 0000000..0d5a86b --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-0.7-dev.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-json-0.7-dev.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-json-0.7-dev.so new file mode 100644 index 0000000..03b04d8 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-json-0.7-dev.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-json.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-json.so new file mode 100644 index 0000000..03b04d8 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp-json.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp.so new file mode 100644 index 0000000..0d5a86b --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnp.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnpc-0.6.1.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnpc-0.6.1.so deleted file mode 100644 index d60a5f5..0000000 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnpc-0.6.1.so +++ /dev/null Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnpc-0.7-dev.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnpc-0.7-dev.so new file mode 100644 index 0000000..516f122 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnpc-0.7-dev.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnpc.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnpc.so new file mode 100644 index 0000000..516f122 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libcapnpc.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libkj-0.6.1.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libkj-0.6.1.so deleted file mode 100644 index d43ccb2..0000000 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libkj-0.6.1.so +++ /dev/null Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libkj-0.7-dev.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libkj-0.7-dev.so new file mode 100644 index 0000000..1d9d6ea --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libkj-0.7-dev.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libkj.so b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libkj.so new file mode 100644 index 0000000..1d9d6ea --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/lib/armeabi-v7a/libkj.so Binary files differ -- Gitblit v1.8.0