├── .envrc ├── .gitattributes ├── .github └── workflows │ └── pre-commit.yml ├── .gitignore ├── .gitlab-ci.yml ├── .pre-commit-config.yaml ├── 3rd-parties ├── SaferCPlusPlus │ ├── LICENSE_1_0.txt │ ├── README.md │ ├── README2.md │ ├── gppbuild_mse_example.sh │ ├── msealgorithm.h │ ├── mseany.h │ ├── mseasyncshared.h │ ├── msecregistered.h │ ├── msefunctional.h │ ├── mseivector.h │ ├── mselegacyhelpers.h │ ├── msemsearray.h │ ├── msemsestring.h │ ├── msemsevector.h │ ├── msemstdarray.h │ ├── msemstdstring.h │ ├── msemstdvector.h │ ├── msenorad.h │ ├── msenoradproxy.h │ ├── mseoptional.h │ ├── msepointerbasics.h │ ├── msepoly.h │ ├── mseprimitives.h │ ├── mserefcounting.h │ ├── mseregistered.h │ ├── mseregisteredproxy.h │ ├── msescope.h │ ├── msescopeatomic.h │ ├── msestaticimmutable.h │ ├── msethreadlocal.h │ ├── msetl.h │ ├── msetl_example.cpp │ ├── msetl_example2.cpp │ ├── msetl_example2.h │ ├── msetl_example3.cpp │ ├── msetl_example3.h │ ├── msetl_example_defs.h │ ├── msetuple.h │ └── msevector_test.h ├── jaeger-client-cpp-0.7.0 │ ├── .appveyor.yml │ ├── .clang-format │ ├── .clang-tidy │ ├── .github │ │ ├── ISSUE_TEMPLATE.md │ │ ├── PULL_REQUEST_TEMPLATE.md │ │ └── workflows │ │ │ ├── macos.yml │ │ │ ├── ubuntu.yml │ │ │ └── windows.yml │ ├── .gitignore │ ├── .gitmodules │ ├── .travis.yml │ ├── .ycm_extra_conf.py │ ├── CHANGELOG.md │ ├── CMakeLists.txt │ ├── CONTRIBUTING.md │ ├── Dockerfile.plugin │ ├── LICENSE │ ├── README.md │ ├── RELEASE.md │ ├── cmake │ │ ├── CodeCoverage.cmake │ │ ├── Config.cmake.in │ │ ├── Findthrift.cmake │ │ ├── Hunter │ │ │ └── config.cmake │ │ ├── HunterGate.cmake │ │ └── toolchain.cmake │ ├── codecov.yml │ ├── crossdock │ │ ├── Dockerfile │ │ ├── Server.cpp │ │ ├── Server.h │ │ └── docker-compose.yml │ ├── examples │ │ ├── App.cpp │ │ └── config.yml │ ├── scripts │ │ ├── build-plugin.sh │ │ ├── build.sh │ │ ├── clang-format.sh │ │ ├── clang-tidy.sh │ │ ├── thrift-gen.patch │ │ ├── update-license.py │ │ ├── update-licenses.sh │ │ └── upload-coverage.sh │ └── src │ │ └── jaegertracing │ │ ├── Compilers.h │ │ ├── Config.cpp │ │ ├── Config.h │ │ ├── ConfigTest.cpp │ │ ├── Constants.h.in │ │ ├── DynamicLoad.cpp │ │ ├── DynamicallyLoadTracerTest.cpp │ │ ├── LogRecord.cpp │ │ ├── LogRecord.h │ │ ├── Logging.cpp │ │ ├── Logging.h │ │ ├── Reference.cpp │ │ ├── Reference.h │ │ ├── ReferenceTest.cpp │ │ ├── Sender.cpp │ │ ├── Sender.h │ │ ├── Span.cpp │ │ ├── Span.h │ │ ├── SpanContext.cpp │ │ ├── SpanContext.h │ │ ├── SpanContextTest.cpp │ │ ├── SpanTest.cpp │ │ ├── Tag.cpp │ │ ├── Tag.h │ │ ├── TagTest.cpp │ │ ├── ThriftMethods.cpp │ │ ├── ThriftSender.cpp │ │ ├── ThriftSender.h │ │ ├── ThriftSenderTest.cpp │ │ ├── TraceID.cpp │ │ ├── TraceID.h │ │ ├── TraceIDTest.cpp │ │ ├── Tracer.cpp │ │ ├── Tracer.h │ │ ├── TracerFactory.cpp │ │ ├── TracerFactory.h │ │ ├── TracerFactoryTest.cpp │ │ ├── TracerTest.cpp │ │ ├── baggage │ │ ├── BaggageSetter.cpp │ │ ├── BaggageSetter.h │ │ ├── BaggageTest.cpp │ │ ├── RemoteRestrictionJSON.cpp │ │ ├── RemoteRestrictionJSON.h │ │ ├── RemoteRestrictionManager.cpp │ │ ├── RemoteRestrictionManager.h │ │ ├── Restriction.cpp │ │ ├── Restriction.h │ │ ├── RestrictionManager.cpp │ │ ├── RestrictionManager.h │ │ ├── RestrictionsConfig.cpp │ │ └── RestrictionsConfig.h │ │ ├── metrics │ │ ├── Counter.cpp │ │ ├── Counter.h │ │ ├── Gauge.cpp │ │ ├── Gauge.h │ │ ├── InMemoryStatsReporter.cpp │ │ ├── InMemoryStatsReporter.h │ │ ├── Metric.cpp │ │ ├── Metric.h │ │ ├── Metrics.cpp │ │ ├── Metrics.h │ │ ├── MetricsTest.cpp │ │ ├── NullCounter.cpp │ │ ├── NullCounter.h │ │ ├── NullGauge.cpp │ │ ├── NullGauge.h │ │ ├── NullStatsFactory.cpp │ │ ├── NullStatsFactory.h │ │ ├── NullStatsFactoryTest.cpp │ │ ├── NullStatsReporter.cpp │ │ ├── NullStatsReporter.h │ │ ├── NullTimer.cpp │ │ ├── NullTimer.h │ │ ├── StatsFactory.cpp │ │ ├── StatsFactory.h │ │ ├── StatsFactoryImpl.cpp │ │ ├── StatsFactoryImpl.h │ │ ├── StatsReporter.cpp │ │ ├── StatsReporter.h │ │ ├── Timer.cpp │ │ └── Timer.h │ │ ├── net │ │ ├── IPAddress.cpp │ │ ├── IPAddress.h │ │ ├── IPAddressTest.cpp │ │ ├── Socket.cpp │ │ ├── Socket.h │ │ ├── SocketTest.cpp │ │ ├── URI.cpp │ │ ├── URI.h │ │ ├── URITest.cpp │ │ └── http │ │ │ ├── Error.cpp │ │ │ ├── Error.h │ │ │ ├── Header.cpp │ │ │ ├── Header.h │ │ │ ├── HeaderTest.cpp │ │ │ ├── Method.cpp │ │ │ ├── Method.h │ │ │ ├── MethodTest.cpp │ │ │ ├── Request.cpp │ │ │ ├── Request.h │ │ │ ├── Response.cpp │ │ │ ├── Response.h │ │ │ ├── ResponseTest.cpp │ │ │ └── SocketReader.h │ │ ├── platform │ │ ├── Endian.cpp │ │ ├── Endian.h │ │ ├── Hostname.cpp │ │ └── Hostname.h │ │ ├── propagation │ │ ├── Extractor.cpp │ │ ├── Extractor.h │ │ ├── Format.cpp │ │ ├── Format.h │ │ ├── HeadersConfig.cpp │ │ ├── HeadersConfig.h │ │ ├── Injector.cpp │ │ ├── Injector.h │ │ ├── JaegerPropagator.cpp │ │ ├── JaegerPropagator.h │ │ ├── Propagator.cpp │ │ ├── Propagator.h │ │ ├── PropagatorTest.cpp │ │ ├── W3CPropagator.cpp │ │ ├── W3CPropagator.h │ │ └── W3CPropagatorTest.cpp │ │ ├── reporters │ │ ├── CompositeReporter.cpp │ │ ├── CompositeReporter.h │ │ ├── Config.cpp │ │ ├── Config.h │ │ ├── ConfigTest.cpp │ │ ├── InMemoryReporter.cpp │ │ ├── InMemoryReporter.h │ │ ├── LoggingReporter.cpp │ │ ├── LoggingReporter.h │ │ ├── NullReporter.cpp │ │ ├── NullReporter.h │ │ ├── RemoteReporter.cpp │ │ ├── RemoteReporter.h │ │ ├── Reporter.cpp │ │ ├── Reporter.h │ │ └── ReporterTest.cpp │ │ ├── samplers │ │ ├── AdaptiveSampler.cpp │ │ ├── AdaptiveSampler.h │ │ ├── Config.cpp │ │ ├── Config.h │ │ ├── ConstSampler.cpp │ │ ├── ConstSampler.h │ │ ├── GuaranteedThroughputProbabilisticSampler.cpp │ │ ├── GuaranteedThroughputProbabilisticSampler.h │ │ ├── ProbabilisticSampler.cpp │ │ ├── ProbabilisticSampler.h │ │ ├── RateLimitingSampler.cpp │ │ ├── RateLimitingSampler.h │ │ ├── RemoteSamplingJSON.cpp │ │ ├── RemoteSamplingJSON.h │ │ ├── RemotelyControlledSampler.cpp │ │ ├── RemotelyControlledSampler.h │ │ ├── Sampler.cpp │ │ ├── Sampler.h │ │ ├── SamplerTest.cpp │ │ ├── SamplingStatus.cpp │ │ └── SamplingStatus.h │ │ ├── testutils │ │ ├── EnvVariable.cpp │ │ ├── EnvVariable.h │ │ ├── MockAgent.cpp │ │ ├── MockAgent.h │ │ ├── MockAgentTest.cpp │ │ ├── SamplingManager.cpp │ │ ├── SamplingManager.h │ │ ├── TUDPTransport.cpp │ │ ├── TUDPTransport.h │ │ ├── TUDPTransportTest.cpp │ │ ├── TracerUtil.cpp │ │ └── TracerUtil.h │ │ ├── thrift-gen │ │ ├── Agent.cpp │ │ ├── Agent.h │ │ ├── AggregationValidator.cpp │ │ ├── AggregationValidator.h │ │ ├── BaggageRestrictionManager.cpp │ │ ├── BaggageRestrictionManager.h │ │ ├── Collector.cpp │ │ ├── Collector.h │ │ ├── Dependency.cpp │ │ ├── Dependency.h │ │ ├── SamplingManager.cpp │ │ ├── SamplingManager.h │ │ ├── TracedService.cpp │ │ ├── TracedService.h │ │ ├── ZipkinCollector.cpp │ │ ├── ZipkinCollector.h │ │ ├── agent_constants.cpp │ │ ├── agent_constants.h │ │ ├── agent_types.cpp │ │ ├── agent_types.h │ │ ├── aggregation_validator_constants.cpp │ │ ├── aggregation_validator_constants.h │ │ ├── aggregation_validator_types.cpp │ │ ├── aggregation_validator_types.h │ │ ├── baggage_constants.cpp │ │ ├── baggage_constants.h │ │ ├── baggage_types.cpp │ │ ├── baggage_types.h │ │ ├── dependency_constants.cpp │ │ ├── dependency_constants.h │ │ ├── dependency_types.cpp │ │ ├── dependency_types.h │ │ ├── jaeger_constants.cpp │ │ ├── jaeger_constants.h │ │ ├── jaeger_types.cpp │ │ ├── jaeger_types.h │ │ ├── sampling_constants.cpp │ │ ├── sampling_constants.h │ │ ├── sampling_types.cpp │ │ ├── sampling_types.h │ │ ├── tracetest_constants.cpp │ │ ├── tracetest_constants.h │ │ ├── tracetest_types.cpp │ │ ├── tracetest_types.h │ │ ├── zipkincore_constants.cpp │ │ ├── zipkincore_constants.h │ │ ├── zipkincore_types.cpp │ │ └── zipkincore_types.h │ │ └── utils │ │ ├── EnvVariable.cpp │ │ ├── EnvVariable.h │ │ ├── ErrorUtil.cpp │ │ ├── ErrorUtil.h │ │ ├── ErrorUtilTest.cpp │ │ ├── HTTPTransporter.cpp │ │ ├── HTTPTransporter.h │ │ ├── HTTPTransporterTest.cpp │ │ ├── HexParsing.cpp │ │ ├── HexParsing.h │ │ ├── RateLimiter.cpp │ │ ├── RateLimiter.h │ │ ├── RateLimiterTest.cpp │ │ ├── Transport.h │ │ ├── UDPSenderTest.cpp │ │ ├── UDPTransporter.cpp │ │ ├── UDPTransporter.h │ │ ├── YAML.cpp │ │ └── YAML.h └── redis-cpp │ ├── .gitignore │ ├── CMakeLists.txt │ ├── LICENSE │ ├── README.md │ ├── cmake │ └── redis-cpp-config.cmake.in │ ├── examples │ ├── ping │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.cpp │ ├── pipeline │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.cpp │ ├── pubsub │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.cpp │ ├── resp │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.cpp │ └── setget │ │ ├── CMakeLists.txt │ │ └── src │ │ └── main.cpp │ ├── include │ └── redis-cpp │ │ ├── detail │ │ ├── config.h │ │ └── stream.hpp │ │ ├── execute.h │ │ ├── resp │ │ ├── deserialization.h │ │ ├── detail │ │ │ ├── marker.h │ │ │ └── overloaded.h │ │ └── serialization.h │ │ ├── stream.h │ │ └── value.h │ ├── redis-docker │ ├── Dockerfile │ ├── build.sh │ └── run.sh │ ├── src │ └── redis-cpp │ │ └── stream.cpp │ └── test │ └── package │ ├── This.cmake.in │ ├── compiled │ └── CMakeLists.txt │ ├── header_only │ └── CMakeLists.txt │ └── main.cpp ├── Chapter01 ├── CMakeLists.txt ├── README.md ├── cc │ ├── cohesion │ │ ├── high.cpp │ │ └── low.cpp │ └── coupling │ │ ├── loose.cpp │ │ └── tight.cpp ├── philosophy │ ├── algorithms │ │ ├── bad_dots.cpp │ │ └── good_dots.cpp │ └── time │ │ ├── bad_time.cpp │ │ └── good_time.cpp └── solid │ ├── dip │ ├── bad.cpp │ ├── dynamic_di.cpp │ └── static_dip.cpp │ ├── isp │ ├── bad.cpp │ ├── base.cpp │ └── good.cpp │ ├── lsp │ └── bad_substitution.cpp │ └── ocp │ ├── ostream_op_preferred.cpp │ └── ostream_op_private_access_needed.cpp ├── Chapter02 ├── CMakeLists.txt ├── README.md ├── conanfile.txt └── state │ ├── PaymentCalculatorV1.h │ ├── PaymentCalculatorV2.h │ └── PaymentCalculatorV3.h ├── Chapter03 ├── CMakeLists.txt ├── README.md ├── cmake │ └── FindSphinx.cmake ├── doc │ ├── CMakeLists.txt │ ├── api_reference.rst │ ├── conf.py.in │ ├── index.rst │ └── readme.rst ├── include │ └── breathe_demo │ │ └── demo.h └── src │ ├── CMakeLists.txt │ └── demo.cpp ├── Chapter04 ├── README.md ├── canary_releases │ ├── Dockerfile-front_proxy │ ├── build.sh │ ├── docker-compose.yaml │ ├── envoy-front_proxy.yaml │ ├── run.sh │ └── stop.sh ├── circuit_breaker │ ├── Dockerfile │ ├── build.sh │ ├── envoy-proxy.yaml │ ├── run.sh │ └── stop.sh ├── retrying_the_call │ ├── Dockerfile │ ├── build.sh │ ├── envoy-proxy.yaml │ ├── run.sh │ └── stop.sh └── tracing_and_reverse_proxy │ ├── Dockerfile-front_proxy │ ├── build.sh │ ├── docker-compose.yaml │ ├── envoy-front_proxy.yaml │ ├── run.sh │ └── stop.sh ├── Chapter05 ├── CMakeLists.txt ├── README.md ├── cmake │ └── CommonCompileFlags.cmake ├── conanfile.txt └── src │ ├── 1_base.cpp │ ├── 2_ranges_part_1.cpp │ ├── 3_ranges_part_2.cpp │ ├── 4_concepts.cpp │ ├── 5_modules │ ├── customer.cpp │ ├── main.cpp │ ├── merchant.cpp │ └── store.cpp │ ├── apis │ ├── declarative.cpp │ ├── inline.h │ ├── optional.h │ └── raii.h │ └── constexpr.cpp ├── Chapter06 ├── 01_raii_guards.cpp ├── 02_copy_move.cpp ├── 03_rules_of_5_and_0.cpp ├── 04_hidden_friend__copy_and_swap.cpp ├── 05_niebloids.cpp ├── 06_policy-based_design.cpp ├── 07_static_polymorphism.cpp ├── 08_type_erasure.cpp ├── 09_factory_functions.cpp ├── 10_factory_class.cpp ├── 11_builder.cpp ├── 12_state_and_visitation.cpp ├── 13_memory_arenas.cpp ├── CMakeLists.txt ├── README.md └── conanfile.txt ├── Chapter07 ├── README.md └── customer │ ├── CMakeLists.txt │ ├── LICENSE │ ├── README.md │ ├── cmake │ ├── CommonCompileFlags.cmake │ ├── CustomerConfig.cmake.in │ ├── FetchGTest.cmake │ └── FindMyDep.cmake │ ├── conan │ ├── conanfile.py.in │ └── test_package │ │ ├── CMakeLists.txt │ │ ├── conanfile.py │ │ └── example.cpp │ ├── conanfile.txt │ ├── include │ └── customer │ │ └── customer.h │ ├── src │ └── customer │ │ ├── CMakeLists.txt │ │ ├── lib.cpp │ │ └── main.cpp │ └── test │ ├── CMakeLists.txt │ └── customer │ ├── CMakeLists.txt │ └── unit.cpp ├── Chapter08 ├── README.md ├── customer │ ├── CMakeLists.txt │ ├── LICENSE │ ├── README.md │ ├── cmake │ │ ├── CommonCompileFlags.cmake │ │ ├── CustomerConfig.cmake.in │ │ ├── FetchCppUnit.cmake │ │ └── FetchGTest.cmake │ ├── conan │ │ ├── conanfile.py.in │ │ └── test_package │ │ │ ├── CMakeLists.txt │ │ │ ├── conanfile.py │ │ │ └── example.cpp │ ├── conanfile.txt │ ├── include │ │ └── customer │ │ │ └── customer.h │ ├── src │ │ └── customer │ │ │ ├── CMakeLists.txt │ │ │ ├── lib.cpp │ │ │ └── main.cpp │ └── test │ │ ├── CMakeLists.txt │ │ └── customer │ │ ├── CMakeLists.txt │ │ ├── catch.cpp │ │ ├── compiletime.cpp │ │ ├── cppunit.cpp │ │ ├── doctest.cpp │ │ ├── gmock.cpp │ │ └── gtest.cpp └── mobile_app │ ├── CMakeLists.txt │ ├── cmake │ ├── CommonCompileFlags.cmake │ └── FetchGTest.cmake │ ├── conanfile.txt │ ├── include │ └── merchants │ │ ├── reviews.h │ │ └── visited_merchant_history.h │ ├── src │ ├── CMakeLists.txt │ └── merchants │ │ ├── CMakeLists.txt │ │ ├── reviews.cpp │ │ └── visited_merchant_history.cpp │ └── test │ ├── CMakeLists.txt │ └── merchants │ ├── CMakeLists.txt │ ├── fake_customer_review_store.h │ ├── reviewtests_gmock.cpp │ └── reviewtests_trompeloeil.cpp ├── Chapter09 ├── .envrc ├── README.md ├── bdd │ ├── step_definitions.cpp │ └── sum.features ├── default.nix ├── env.example ├── gitlab-ci.yml ├── packer │ ├── packer_ami.json │ ├── packer_ami_provisioner.json │ └── provision.yml └── terraform │ └── main.tf ├── Chapter10 ├── README.md └── mobile_app │ ├── CMakeLists.txt │ ├── cmake │ └── CommonCompileFlags.cmake │ ├── conanfile.txt │ ├── include │ └── merchants │ │ ├── reviews.h │ │ └── visited_merchant_history.h │ └── src │ ├── CMakeLists.txt │ └── merchants │ ├── CMakeLists.txt │ ├── reviews.cpp │ └── visited_merchant_history.cpp ├── Chapter11 ├── CMakeLists.txt ├── README.md ├── conanfile.txt ├── coroutines │ └── main_1.cpp └── microbenchmarking │ ├── main_1.cpp │ ├── main_2.cpp │ ├── main_3.cpp │ └── main_4.cpp ├── Chapter12 ├── .envrc ├── README.md ├── default.nix ├── env.example ├── kubernetes │ └── merchant-manifest.yml ├── packer │ └── packer-digitalocean.json ├── rest │ ├── api-blueprint.md │ ├── openapi.json │ └── raml.yaml ├── rpc │ ├── jsonrpc.json │ └── soap.txt └── s3 │ ├── CMakeLists.txt │ ├── conanfile.txt │ └── s3.cpp ├── Chapter13 ├── CMakeLists.txt ├── README.md ├── cmake │ └── CommonCompileFlags.cmake ├── conanfile.txt ├── grpc │ ├── AsyncClient.cpp │ ├── AsyncServer.cpp │ └── service.proto └── redis │ └── redis.cpp ├── Chapter14 ├── .envrc ├── README.md ├── containers │ ├── ansible-bender │ │ └── bender.yaml │ ├── buildah │ │ └── buildah.sh │ └── docker │ │ ├── basic.Dockerfile │ │ ├── compile.Dockerfile │ │ ├── multi-stage.Dockerfile │ │ └── scratch.Dockerfile ├── default.nix └── orchestration │ ├── docker-compose │ └── docker-compose.yml │ ├── kubernetes │ └── merchant.yaml │ └── nomad │ ├── merchant.nomad │ └── nginx.nomad ├── Chapter15 ├── README.md └── customer │ ├── CMakeLists.txt │ ├── LICENSE │ ├── README.md │ ├── conanfile.txt │ ├── include │ └── customer │ │ └── customer.h │ └── src │ └── customer │ ├── CMakeLists.txt │ ├── lib.cpp │ └── main.cpp ├── LICENSE ├── README.md └── default.nix /.envrc: -------------------------------------------------------------------------------- 1 | dotenv 2 | use_nix 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.github/workflows/pre-commit.yml: -------------------------------------------------------------------------------- 1 | name: pre-commit 2 | 3 | on: 4 | pull_request: 5 | push: 6 | branches: [master] 7 | 8 | jobs: 9 | pre-commit: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v3 13 | - uses: actions/setup-python@v4 14 | with: 15 | python-version: '3.10' 16 | - uses: cachix/install-nix-action@v19 17 | with: 18 | nix_path: nixpkgs=channel:nixos-unstable 19 | - uses: actions/cache@v3 20 | with: 21 | path: ~/.cache/pre-commit 22 | key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }} 23 | - run: pip install pre-commit 24 | - run: SKIP=no-commit-to-branch pre-commit run --all-files 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *build*/ 3 | gcm.cache/ 4 | .vscode/ 5 | CMakeLists.txt.user 6 | venv 7 | .env 8 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v4.4.0 4 | hooks: 5 | - id: check-byte-order-marker 6 | exclude: 3rd-parties/ 7 | - id: check-case-conflict 8 | exclude: 3rd-parties/ 9 | - id: check-merge-conflict 10 | exclude: 3rd-parties/ 11 | - id: check-symlinks 12 | exclude: 3rd-parties/ 13 | - id: check-yaml 14 | exclude: kubernetes 15 | - id: end-of-file-fixer 16 | exclude: 3rd-parties/ 17 | - id: mixed-line-ending 18 | exclude: 3rd-parties/ 19 | # Prevent direct commits to the following branches 20 | - id: no-commit-to-branch 21 | args: [--branch, master] 22 | - id: trailing-whitespace 23 | exclude: 3rd-parties/ 24 | - repo: https://github.com/pre-commit/mirrors-clang-format 25 | rev: v17.0.6 26 | hooks: 27 | - id: clang-format 28 | args: [--style=Google, -i] 29 | exclude: 3rd-parties/ 30 | - repo: https://github.com/iconmaster5326/cmake-format-pre-commit-hook 31 | rev: v0.6.9 32 | hooks: 33 | - id: cmake-format 34 | exclude: 3rd-parties/ 35 | -------------------------------------------------------------------------------- /3rd-parties/SaferCPlusPlus/README2.md: -------------------------------------------------------------------------------- 1 | 2 | ### Versioning and deployment philosophy 3 | 4 | This library does not maintain "official versions". This is, in part, to avoid the long-standing problem that occurs when, for example, you'd like to use two different libraries in your project, but each of those libraries in turn has a dependency on a different (conflicting) version of a common library (aka "[dependency hell](https://en.wikipedia.org/wiki/Dependency_hell)"). The alternative to maintaining versions is simply a policy of avoiding as much as possible, changes to the library's interface that break existing code that uses the library. So, ideally, any code you write using the library should continue to work with future "versions" of the library. Google calls this approach "[living at head](https://www.youtube.com/watch?v=tISy7EJQPzI)". 5 | 6 | One of the goals of the library is to avoid as much as possible, being a "dependency risk". In fact, rather than a third-party library, you're encouraged to think of the library as, in a sense, just part of your project's source code. In that vein, it may not be a bad idea to have your project's code refer to a more personalized namespace alias, rather than the library's default namespace. 7 | 8 | -------------------------------------------------------------------------------- /3rd-parties/SaferCPlusPlus/gppbuild_mse_example.sh: -------------------------------------------------------------------------------- 1 | g++ -std=c++14 -pthread msetl_example.cpp msetl_example2.cpp msetl_example3.cpp -o msetl_example.gpp_run 2 | -------------------------------------------------------------------------------- /3rd-parties/SaferCPlusPlus/msetl.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright (c) 2015 Noah Lopez 3 | // Use, modification, and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | #pragma once 8 | #ifndef MSETL_H 9 | #define MSETL_H 10 | 11 | /* Basically all the headers */ 12 | 13 | #include "mselegacyhelpers.h" 14 | #include "msefunctional.h" 15 | 16 | #include "msepointerbasics.h" 17 | #include "mseregistered.h" 18 | #include "msecregistered.h" 19 | #include "msenorad.h" 20 | #include "mserefcounting.h" 21 | #include "msescope.h" 22 | #include "msemstdvector.h" 23 | #include "mseasyncshared.h" 24 | #include "mseany.h" 25 | #include "msemstdarray.h" 26 | #include "msemstdstring.h" 27 | #include "msestaticimmutable.h" 28 | #include "msethreadlocal.h" 29 | #include "msescopeatomic.h" 30 | 31 | #include "msealgorithm.h" 32 | #include "mseivector.h" 33 | #include "mseregisteredproxy.h" 34 | #include "msenoradproxy.h" 35 | #include "mseoptional.h" 36 | #include "msetuple.h" 37 | 38 | #include "msepoly.h" 39 | 40 | #include "mseprimitives.h" 41 | 42 | #endif /*ndef MSETL_H*/ 43 | -------------------------------------------------------------------------------- /3rd-parties/SaferCPlusPlus/msetl_example2.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright (c) 2015 Noah Lopez 3 | // Use, modification, and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | #pragma once 8 | #ifndef MSETL_EXAMPLE2_H 9 | #define MSETL_EXAMPLE2_H 10 | 11 | void msetl_example2(); 12 | 13 | #endif /*ndef MSETL_EXAMPLE2_H*/ 14 | -------------------------------------------------------------------------------- /3rd-parties/SaferCPlusPlus/msetl_example3.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright (c) 2015 Noah Lopez 3 | // Use, modification, and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | #pragma once 8 | #ifndef MSETL_EXAMPLE3_H 9 | #define MSETL_EXAMPLE3_H 10 | 11 | void msetl_example3(); 12 | 13 | #endif /*ndef MSETL_EXAMPLE3_H*/ 14 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/.appveyor.yml: -------------------------------------------------------------------------------- 1 | version: '{build}' 2 | 3 | image: Visual Studio 2017 4 | 5 | init: 6 | - cmd: git config --global core.autocrlf true 7 | 8 | platform: 9 | - x64 10 | 11 | configuration: 12 | - Debug 13 | 14 | before_build: 15 | - cmake -H. -Bbuild -A%PLATFORM% -DBUILD_TESTING=ON 16 | 17 | build: 18 | project: build\jaegertracing.sln 19 | parallel: true 20 | verbosity: normal 21 | 22 | test_script: 23 | - ps: | 24 | cd build 25 | ctest -V -C $env:configuration --timeout 600 --output-on-failure -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | ## Requirement - what kind of business use case are you trying to solve? 14 | 15 | 16 | 17 | ## Problem - what in Jaeger blocks you from solving the requirement? 18 | 19 | 20 | 21 | 22 | ## Proposal - what do you suggest to solve the problem or improve the existing situation? 23 | 24 | 25 | 26 | ## Any open questions to address 27 | 28 | 29 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 13 | 14 | ## Which problem is this PR solving? 15 | - 16 | 17 | ## Short description of the changes 18 | - 19 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/.github/workflows/macos.yml: -------------------------------------------------------------------------------- 1 | name: MacOS 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | env: 12 | CTEST_OUTPUT_ON_FAILURE: 1 13 | 14 | jobs: 15 | build: 16 | 17 | runs-on: macos-latest 18 | 19 | steps: 20 | 21 | - name: Set up cache 22 | uses: actions/cache@v2 23 | with: 24 | path: ~\.hunter 25 | key: ${{ runner.os }}-hunter-${{ hashFiles('**/') }} 26 | restore-keys: | 27 | ${{ runner.os }}-hunter- 28 | 29 | - name: Checkout repository 30 | uses: actions/checkout@v2 31 | 32 | - name: Configure 33 | run: cmake -Bbuild 34 | 35 | - name: Build 36 | run: cmake --build build -j4 37 | 38 | - name: Test 39 | run: | 40 | cd build 41 | ctest -V --timeout 600 42 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/.github/workflows/ubuntu.yml: -------------------------------------------------------------------------------- 1 | name: Ubuntu 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | env: 12 | CTEST_OUTPUT_ON_FAILURE: 1 13 | 14 | jobs: 15 | build: 16 | 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | 21 | - name: Set up cache 22 | uses: actions/cache@v2 23 | with: 24 | path: ~\.hunter 25 | key: ${{ runner.os }}-hunter-${{ hashFiles('**/') }} 26 | restore-keys: | 27 | ${{ runner.os }}-hunter- 28 | 29 | - name: Checkout repository 30 | uses: actions/checkout@v2 31 | 32 | - name: Configure 33 | run: cmake -Bbuild 34 | 35 | - name: Build 36 | run: cmake --build build -j4 37 | 38 | - name: Test 39 | run: | 40 | cd build 41 | ctest -V --timeout 600 42 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/.github/workflows/windows.yml: -------------------------------------------------------------------------------- 1 | name: Windows 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | env: 12 | CTEST_OUTPUT_ON_FAILURE: 1 13 | 14 | jobs: 15 | build: 16 | 17 | runs-on: windows-latest 18 | 19 | steps: 20 | 21 | - name: Set up cache 22 | uses: actions/cache@v2 23 | with: 24 | path: ~\AppData\Local\hunter 25 | key: ${{ runner.os }}-hunter-${{ hashFiles('**/') }} 26 | restore-keys: | 27 | ${{ runner.os }}-hunter- 28 | 29 | - name: Checkout repository 30 | uses: actions/checkout@v2 31 | 32 | - name: Configure 33 | run: cmake -Bbuild 34 | 35 | - name: Build 36 | run: cmake --build build -j4 37 | 38 | - name: Test 39 | run: | 40 | cd build 41 | ctest -V -C Debug --timeout 600 42 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/.gitignore: -------------------------------------------------------------------------------- 1 | # Build files 2 | /build 3 | /crossdock/crossdock 4 | /crossdock/jaeger-docker-compose.yml 5 | 6 | # vim swap files 7 | *.swo 8 | *.swp 9 | 10 | # Prerequisites 11 | *.d 12 | 13 | # Compiled Object files 14 | *.slo 15 | *.lo 16 | *.o 17 | *.obj 18 | 19 | # Precompiled Headers 20 | *.gch 21 | *.pch 22 | 23 | # Compiled Dynamic libraries 24 | *.so 25 | *.dylib 26 | *.dll 27 | 28 | # Fortran module files 29 | *.mod 30 | *.smod 31 | 32 | # Compiled Static libraries 33 | *.lai 34 | *.la 35 | *.a 36 | *.lib 37 | 38 | # Executables 39 | *.exe 40 | *.out 41 | *.app 42 | 43 | # Log files 44 | *.log 45 | 46 | # CLion folders 47 | cmake-build-debug 48 | .idea 49 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "idl"] 2 | path = idl 3 | url = https://github.com/uber/jaeger-idl.git 4 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/Dockerfile.plugin: -------------------------------------------------------------------------------- 1 | FROM debian 2 | RUN apt-get update 3 | RUN apt-get install --yes build-essential curl git 4 | RUN curl -L -O "https://cmake.org/files/v3.11/cmake-3.11.0-Linux-x86_64.sh" && \ 5 | bash cmake-3.11.0-Linux-x86_64.sh --skip-license 6 | 7 | ADD . /src/jaeger-cpp-client 8 | WORKDIR /src/jaeger-cpp-client 9 | RUN ./scripts/build-plugin.sh 10 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/RELEASE.md: -------------------------------------------------------------------------------- 1 | # Release Process 2 | 3 | 1. Create a PR "Preparing for release X.Y.Z" against master branch 4 | * Add section to `CHANGELOG.md` ` (YYYY-MM-DD)` with the list of changes 5 | * Change/verify vesion number in `CMakelists.txt` 6 | 2. Create a release "Release X.Y.Z" on Github 7 | * Create Tag `vX.Y.Z` 8 | * Copy `CHANGELOG.md` entry into the release notes 9 | 3. Create a PR "Back to development" against master branch 10 | * Update ` (unreleased)` section in the `CHANGELOG.md` 11 | * Update project version in CMakeLists.txt to the `` 12 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/cmake/Config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | set(package_deps @package_deps@) 4 | foreach(dep IN LISTS package_deps) 5 | if(dep STREQUAL "OpenSSL" OR dep STREQUAL "Threads") 6 | find_package(${dep} REQUIRED) 7 | elseif(dep STREQUAL "OpenTracing" OR 8 | dep STREQUAL "yaml-cpp") 9 | find_package(${dep} CONFIG REQUIRED) 10 | else() 11 | find_package(${dep} @hunter_config@ REQUIRED) 12 | endif() 13 | endforeach() 14 | 15 | set(boost_components @boost_components@) 16 | find_package(Boost CONFIG REQUIRED ${boost_components}) 17 | 18 | check_required_components("@PROJECT_NAME@") 19 | 20 | include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") 21 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/cmake/Hunter/config.cmake: -------------------------------------------------------------------------------- 1 | hunter_config(GTest VERSION 1.8.0-hunter-p11) 2 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/cmake/toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 2 | set(CMAKE_CXX_STANDARD 11) 3 | set(CMAKE_CXX_EXTENSIONS OFF) 4 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 5 | set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | notify: 3 | require_ci_to_pass: yes 4 | 5 | coverage: 6 | precision: 2 7 | round: down 8 | range: "70...100" 9 | 10 | status: 11 | project: yes 12 | patch: yes 13 | changes: no 14 | 15 | parsers: 16 | gcov: 17 | branch_detection: 18 | conditional: yes 19 | loop: yes 20 | method: no 21 | macro: no 22 | 23 | comment: 24 | layout: "reach, diff, flags, files, footer" 25 | behavior: default 26 | require_changes: no 27 | 28 | ignore: 29 | - "src/jaegertracing/thrift-gen" 30 | - "**/*Test.cpp" 31 | - "crossdock" 32 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/crossdock/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gcc:7.2 2 | 3 | ADD ./build/crossdock / 4 | 5 | ENV AGENT_HOST_PORT=jaeger-agent:5775 6 | ENV SAMPLING_SERVER_URL=http://test_driver:5778/sampling 7 | 8 | EXPOSE 8080-8082 9 | 10 | CMD ["/crossdock"] 11 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/examples/config.yml: -------------------------------------------------------------------------------- 1 | disabled: false 2 | reporter: 3 | logSpans: true 4 | sampler: 5 | type: const 6 | param: 1 7 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/scripts/build-plugin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | function main() { 6 | local project_dir 7 | project_dir="$(git rev-parse --show-toplevel)" 8 | 9 | mkdir -p build 10 | cd build 11 | export CFLAGS="$CFLAGS -march=x86-64" 12 | export CXXFLAGS="$CXXFLAGS -march=x86-64" 13 | 14 | cat < export.map 15 | { 16 | global: 17 | OpenTracingMakeTracerFactory; 18 | local: *; 19 | }; 20 | EOF 21 | 22 | cmake -DCMAKE_BUILD_TYPE=Release \ 23 | -DJAEGERTRACING_PLUGIN=ON \ 24 | -DBUILD_TESTING=ON \ 25 | -DHUNTER_CONFIGURATION_TYPES=Release \ 26 | .. 27 | make -j3 28 | mv libjaegertracing_plugin.so /libjaegertracing_plugin.so 29 | ./DynamicallyLoadTracerTest /libjaegertracing_plugin.so 30 | } 31 | 32 | main 33 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Based on https://github.com/codecov/example-cpp11-cmake/blob/master/run_build.sh. 4 | 5 | set -e 6 | 7 | RED='\033[0;31m' 8 | BLUE='\033[0;34m' 9 | NO_COLOR='\033[0m' 10 | GREEN='\033[0;32m' 11 | 12 | function info() { 13 | echo -e "${GREEN}$1${NO_COLOR}" 14 | } 15 | 16 | function working() { 17 | echo -e "${BLUE}$1${NO_COLOR}" 18 | } 19 | 20 | function main() { 21 | local project_dir 22 | project_dir=$(git rev-parse --show-toplevel) 23 | cd "$project_dir" 24 | 25 | mkdir -p build 26 | cd build 27 | cmake ${CMAKE_OPTIONS} .. 28 | make -j3 UnitTest 29 | info "Running tests..." 30 | ./UnitTest 31 | working "All tests compiled and passed" 32 | 33 | set -x 34 | if ! [[ "${CMAKE_OPTIONS}" =~ "-DJAEGERTRACING_BUILD_CROSSDOCK=ON" ]]; then 35 | exit 0 36 | fi 37 | make crossdock-fresh 38 | } 39 | 40 | main 41 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/scripts/clang-format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function main() { 4 | local project_dir 5 | project_dir=$(git rev-parse --show-toplevel) 6 | cd "$project_dir" || exit 1 7 | 8 | local srcs 9 | srcs=$(git ls-files src crossdock | 10 | grep -E -v 'thrift-gen' | 11 | grep -E '\.(cpp|h)$') 12 | 13 | local cmd 14 | for src in $srcs; do 15 | cmd="clang-format -i $src" 16 | echo "$cmd" 17 | eval "$cmd" 18 | done 19 | } 20 | 21 | main 22 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/scripts/clang-tidy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function main() { 4 | local project_dir 5 | project_dir=$(git rev-parse --show-toplevel) 6 | cd "$project_dir" || exit 1 7 | 8 | local srcs 9 | srcs=$(git ls-files src crossdock | 10 | grep -E -v 'thrift-gen|Test\.cpp' | 11 | grep -E '\.cpp$') 12 | 13 | local cmd 14 | for src in $srcs; do 15 | cmd="clang-tidy -p=build" 16 | cmd+=" -checks=\"-clang-diagnostic-unused-command-line-argument\" " 17 | cmd+=" $src" 18 | echo "$cmd" 19 | eval "$cmd" 20 | done 21 | } 22 | 23 | main 24 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/scripts/update-licenses.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | python scripts/update-license.py $(git ls-files "*\.cpp" "*\.h" | 6 | grep -v thrift-gen | 7 | grep -v tracetest) \ 8 | src/jaegertracing/Constants.h.in 9 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/Compilers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_COMPILERS_H 18 | #define JAEGERTRACING_COMPILERS_H 19 | 20 | #ifdef _MSC_VER 21 | 22 | #pragma warning(push) 23 | #pragma warning(disable : 4251) 24 | #pragma warning(disable : 4275) 25 | 26 | // Define NOMINMAX to inhibit definition of Macros min(a,b) and max(a,b) in 27 | // windows.h 28 | #ifndef NOMINMAX 29 | #define NOMINMAX 30 | #endif 31 | 32 | #endif // _MSC_VER 33 | 34 | #endif // JAEGERTRACING_COMPILERS_H 35 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/Logging.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_LOGGING_H 18 | #define JAEGERTRACING_LOGGING_H 19 | 20 | #include 21 | #include 22 | 23 | #include "jaegertracing/Compilers.h" 24 | 25 | namespace jaegertracing { 26 | namespace logging { 27 | 28 | class Logger { 29 | public: 30 | virtual ~Logger() = default; 31 | 32 | virtual void error(const std::string& message) = 0; 33 | 34 | virtual void info(const std::string& message) = 0; 35 | }; 36 | 37 | std::unique_ptr nullLogger(); 38 | 39 | std::unique_ptr consoleLogger(); 40 | 41 | } // namespace logging 42 | } // namespace jaegertracing 43 | 44 | #endif // JAEGERTRACING_LOGGING_H 45 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/Sender.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/Sender.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/SpanTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/Span.h" 18 | #include "jaegertracing/thrift-gen/jaeger_types.h" 19 | #include 20 | #include 21 | 22 | namespace jaegertracing { 23 | 24 | TEST(Span, testThriftConversion) 25 | { 26 | const Span span; 27 | ASSERT_TRUE(span.serviceName().empty()); 28 | ASSERT_TRUE(span.operationName().empty()); 29 | thrift::Span thriftSpan; 30 | ASSERT_NO_THROW(span.thrift(thriftSpan)); 31 | } 32 | 33 | } // namespace jaegertracing 34 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/TraceIDTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/TraceID.h" 18 | #include 19 | #include 20 | 21 | namespace jaegertracing { 22 | 23 | TEST(TraceID, testPrintWithouthHigh) 24 | { 25 | std::ostringstream oss; 26 | oss << TraceID(0, 10); 27 | ASSERT_EQ("000000000000000a", oss.str()); 28 | } 29 | 30 | TEST(TraceID, testPrintWithHigh) 31 | { 32 | std::ostringstream oss; 33 | oss << TraceID(1, 10); 34 | ASSERT_EQ("0000000000000001000000000000000a", oss.str()); 35 | } 36 | 37 | } // namespace jaegertracing 38 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/baggage/BaggageSetter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/baggage/BaggageSetter.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/baggage/RemoteRestrictionJSON.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/baggage/RemoteRestrictionJSON.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/baggage/Restriction.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/baggage/Restriction.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/baggage/RestrictionManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/baggage/RestrictionManager.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/baggage/RestrictionsConfig.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/baggage/RestrictionsConfig.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/Counter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/metrics/Counter.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/Counter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_METRICS_COUNTER_H 18 | #define JAEGERTRACING_METRICS_COUNTER_H 19 | 20 | #include "jaegertracing/Compilers.h" 21 | 22 | #include 23 | 24 | namespace jaegertracing { 25 | namespace metrics { 26 | 27 | class Counter { 28 | public: 29 | virtual ~Counter() = default; 30 | 31 | virtual void inc(int64_t delta) = 0; 32 | }; 33 | 34 | } // namespace metrics 35 | } // namespace jaegertracing 36 | 37 | #endif // JAEGERTRACING_METRICS_COUNTER_H 38 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/Gauge.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/metrics/Gauge.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/Gauge.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_METRICS_GAUGE_H 18 | #define JAEGERTRACING_METRICS_GAUGE_H 19 | 20 | #include "jaegertracing/Compilers.h" 21 | 22 | #include 23 | 24 | namespace jaegertracing { 25 | namespace metrics { 26 | 27 | class Gauge { 28 | public: 29 | virtual ~Gauge() = default; 30 | 31 | virtual void update(int64_t amount) = 0; 32 | }; 33 | 34 | } // namespace metrics 35 | } // namespace jaegertracing 36 | 37 | #endif // JAEGERTRACING_METRICS_GAUGE_H 38 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/Metric.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/metrics/Metric.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/NullCounter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/metrics/NullCounter.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/NullCounter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_METRICS_NULLCOUNTER_H 18 | #define JAEGERTRACING_METRICS_NULLCOUNTER_H 19 | 20 | #include "jaegertracing/metrics/Counter.h" 21 | #include 22 | 23 | namespace jaegertracing { 24 | namespace metrics { 25 | 26 | class NullCounter : public Counter { 27 | public: 28 | void inc(int64_t) override {} 29 | }; 30 | 31 | } // namespace metrics 32 | } // namespace jaegertracing 33 | 34 | #endif // JAEGERTRACING_METRICS_NULLCOUNTER_H 35 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/NullGauge.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/metrics/NullGauge.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/NullGauge.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_METRICS_NULLGAUGE_H 18 | #define JAEGERTRACING_METRICS_NULLGAUGE_H 19 | 20 | #include "jaegertracing/metrics/Gauge.h" 21 | #include 22 | 23 | namespace jaegertracing { 24 | namespace metrics { 25 | 26 | class NullGauge : public Gauge { 27 | public: 28 | void update(int64_t) override {} 29 | }; 30 | 31 | } // namespace metrics 32 | } // namespace jaegertracing 33 | 34 | #endif // JAEGERTRACING_METRICS_NULLGAUGE_H 35 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/NullStatsFactory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/metrics/NullStatsFactory.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/NullStatsFactoryTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/metrics/Counter.h" 18 | #include "jaegertracing/metrics/Gauge.h" 19 | #include "jaegertracing/metrics/NullStatsFactory.h" 20 | #include "jaegertracing/metrics/Timer.h" 21 | #include 22 | #include 23 | 24 | namespace jaegertracing { 25 | namespace metrics { 26 | 27 | TEST(NullStatsFactory, test) 28 | { 29 | NullStatsFactory factory; 30 | factory.createGauge("")->update(1); 31 | factory.createTimer("")->record(1); 32 | factory.createCounter("")->inc(1); 33 | } 34 | 35 | } // namespace metrics 36 | } // namespace jaegertracing 37 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/NullStatsReporter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/metrics/NullStatsReporter.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/NullTimer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/metrics/NullTimer.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/NullTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_METRICS_NULLTIMER_H 18 | #define JAEGERTRACING_METRICS_NULLTIMER_H 19 | 20 | #include "jaegertracing/metrics/Timer.h" 21 | #include 22 | 23 | namespace jaegertracing { 24 | namespace metrics { 25 | 26 | class NullTimer : public Timer { 27 | public: 28 | void record(int64_t) override {} 29 | }; 30 | 31 | } // namespace metrics 32 | } // namespace jaegertracing 33 | 34 | #endif // JAEGERTRACING_METRICS_NULLTIMER_H 35 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/StatsReporter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/metrics/StatsReporter.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/Timer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/metrics/Timer.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/metrics/Timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_METRICS_TIMER_H 18 | #define JAEGERTRACING_METRICS_TIMER_H 19 | 20 | #include 21 | 22 | namespace jaegertracing { 23 | namespace metrics { 24 | 25 | class Timer { 26 | public: 27 | virtual ~Timer() = default; 28 | 29 | virtual void record(int64_t time) = 0; 30 | }; 31 | 32 | } // namespace metrics 33 | } // namespace jaegertracing 34 | 35 | #endif // JAEGERTRACING_METRICS_TIMER_H 36 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/net/http/Error.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/net/http/Error.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/net/http/Header.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/net/http/Header.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/net/http/Method.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_NET_HTTP_METHOD_H 18 | #define JAEGERTRACING_NET_HTTP_METHOD_H 19 | 20 | #include 21 | 22 | #undef DELETE 23 | 24 | namespace jaegertracing { 25 | namespace net { 26 | namespace http { 27 | 28 | enum class Method { 29 | OPTIONS, 30 | GET, 31 | HEAD, 32 | POST, 33 | PUT, 34 | DELETE, 35 | TRACE, 36 | CONNECT, 37 | EXTENSION 38 | }; 39 | 40 | Method parseMethod(const std::string& methodName); 41 | 42 | } // namespace http 43 | } // namespace net 44 | } // namespace jaegertracing 45 | 46 | #endif // JAEGERTRACING_NET_HTTP_METHOD_H 47 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/platform/Endian.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/platform/Endian.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/platform/Hostname.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/platform/Hostname.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/propagation/Extractor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/propagation/Extractor.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/propagation/Extractor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_PROPAGATION_EXTRACTOR_H 18 | #define JAEGERTRACING_PROPAGATION_EXTRACTOR_H 19 | 20 | #include 21 | 22 | #include "jaegertracing/SpanContext.h" 23 | 24 | namespace jaegertracing { 25 | namespace propagation { 26 | 27 | template 28 | class Extractor { 29 | public: 30 | virtual ~Extractor() = default; 31 | 32 | virtual SpanContext extract(Reader reader) const = 0; 33 | }; 34 | 35 | } // namespace propagation 36 | } // namespace jaegertracing 37 | 38 | #endif // JAEGERTRACING_PROPAGATION_EXTRACTOR_H 39 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/propagation/Format.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (c) 2020 The Jaeger Authors 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "jaegertracing/propagation/Format.h" 19 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/propagation/Format.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Jaeger Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_PROPAGATION_FORMAT_H 18 | #define JAEGERTRACING_PROPAGATION_FORMAT_H 19 | 20 | namespace jaegertracing { 21 | namespace propagation { 22 | 23 | enum Format { JAEGER, W3C }; 24 | 25 | } // namespace propagation 26 | } // namespace jaegertracing 27 | 28 | #endif // JAEGERTRACING_PROPAGATION_FORMAT_H -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/propagation/HeadersConfig.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/propagation/HeadersConfig.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/propagation/Injector.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/propagation/Injector.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/propagation/Injector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_PROPAGATION_INJECTOR_H 18 | #define JAEGERTRACING_PROPAGATION_INJECTOR_H 19 | 20 | #include 21 | 22 | namespace jaegertracing { 23 | 24 | class SpanContext; 25 | 26 | namespace propagation { 27 | 28 | template 29 | class Injector { 30 | public: 31 | virtual ~Injector() = default; 32 | 33 | virtual void inject(const SpanContext& ctx, Writer writer) const = 0; 34 | }; 35 | 36 | } // namespace propagation 37 | } // namespace jaegertracing 38 | 39 | #endif // JAEGERTRACING_PROPAGATION_INJECTOR_H 40 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/propagation/JaegerPropagator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Jaeger Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/propagation/JaegerPropagator.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/propagation/Propagator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/propagation/Propagator.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/propagation/W3CPropagator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The Jaeger Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/propagation/W3CPropagator.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/reporters/CompositeReporter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/reporters/CompositeReporter.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/reporters/InMemoryReporter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/reporters/InMemoryReporter.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/reporters/LoggingReporter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/reporters/LoggingReporter.h" 18 | #include "jaegertracing/Logging.h" 19 | #include "jaegertracing/Span.h" 20 | #include 21 | 22 | namespace jaegertracing { 23 | namespace reporters { 24 | 25 | void LoggingReporter::report(const Span& span) noexcept 26 | { 27 | std::ostringstream oss; 28 | oss << "Reporting span " << span; 29 | _logger.info(oss.str()); 30 | } 31 | 32 | } // namespace reporters 33 | } // namespace jaegertracing 34 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/reporters/NullReporter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/reporters/NullReporter.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/reporters/NullReporter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_REPORTERS_NULLREPORTER_H 18 | #define JAEGERTRACING_REPORTERS_NULLREPORTER_H 19 | 20 | #include "jaegertracing/reporters/Reporter.h" 21 | 22 | namespace jaegertracing { 23 | class Span; 24 | } // namespace jaegertracing 25 | 26 | namespace jaegertracing { 27 | namespace reporters { 28 | 29 | class NullReporter : public Reporter { 30 | public: 31 | void report(const Span&) noexcept override {} 32 | 33 | void close() noexcept override {} 34 | }; 35 | 36 | } // namespace reporters 37 | } // namespace jaegertracing 38 | 39 | #endif // JAEGERTRACING_REPORTERS_NULLREPORTER_H 40 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/reporters/Reporter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/reporters/Reporter.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/reporters/Reporter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_REPORTERS_REPORTER_H 18 | #define JAEGERTRACING_REPORTERS_REPORTER_H 19 | 20 | #include "jaegertracing/Compilers.h" 21 | 22 | namespace jaegertracing { 23 | 24 | class Span; 25 | 26 | namespace reporters { 27 | 28 | class Reporter { 29 | public: 30 | virtual ~Reporter() = default; 31 | 32 | virtual void report(const Span& span) noexcept = 0; 33 | 34 | virtual void close() noexcept = 0; 35 | }; 36 | 37 | } // namespace reporters 38 | } // namespace jaegertracing 39 | 40 | #endif // JAEGERTRACING_REPORTERS_REPORTER_H 41 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/samplers/ConstSampler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/samplers/ConstSampler.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/samplers/ProbabilisticSampler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/samplers/ProbabilisticSampler.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/samplers/RateLimitingSampler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/samplers/RateLimitingSampler.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/samplers/RemoteSamplingJSON.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/samplers/RemoteSamplingJSON.h" -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/samplers/Sampler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/samplers/Sampler.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/samplers/SamplingStatus.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/samplers/SamplingStatus.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/testutils/EnvVariable.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 The Jaeger Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/testutils/EnvVariable.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/testutils/EnvVariable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 The Jaeger Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JAEGERTRACING_TESTUTILS_ENVVARIABLE_H 18 | #define JAEGERTRACING_TESTUTILS_ENVVARIABLE_H 19 | 20 | #include 21 | 22 | namespace jaegertracing { 23 | namespace testutils { 24 | namespace EnvVariable { 25 | 26 | inline void setEnv(const char *variable, const char *value) { 27 | #ifdef WIN32 28 | _putenv_s(variable, value); 29 | #else 30 | setenv(variable, value, true); 31 | #endif 32 | } 33 | 34 | } // namespace EnvVariable 35 | } // namespace testutils 36 | } // namespace jaegertracing 37 | 38 | #endif // JAEGERTRACING_TESTUTILS_ENVVARIABLE_H 39 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/testutils/SamplingManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/testutils/SamplingManager.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/testutils/TUDPTransport.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/testutils/TUDPTransport.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/agent_constants.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #include "agent_constants.h" 8 | 9 | namespace jaegertracing { namespace agent { namespace thrift { 10 | 11 | const agentConstants g_agent_constants; 12 | 13 | agentConstants::agentConstants() { 14 | } 15 | 16 | }}} // namespace 17 | 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/agent_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef agent_CONSTANTS_H 8 | #define agent_CONSTANTS_H 9 | 10 | #include "agent_types.h" 11 | 12 | namespace jaegertracing { namespace agent { namespace thrift { 13 | 14 | class agentConstants { 15 | public: 16 | agentConstants(); 17 | 18 | }; 19 | 20 | extern const agentConstants g_agent_constants; 21 | 22 | }}} // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/agent_types.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #include "agent_types.h" 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | namespace jaegertracing { namespace agent { namespace thrift { 15 | 16 | }}} // namespace 17 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/agent_types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef agent_TYPES_H 8 | #define agent_TYPES_H 9 | 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include "jaeger_types.h" 20 | #include "zipkincore_types.h" 21 | 22 | 23 | namespace jaegertracing { namespace agent { namespace thrift { 24 | 25 | }}} // namespace 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/aggregation_validator_constants.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #include "aggregation_validator_constants.h" 8 | 9 | namespace jaegertracing { namespace thrift { 10 | 11 | const aggregation_validatorConstants g_aggregation_validator_constants; 12 | 13 | aggregation_validatorConstants::aggregation_validatorConstants() { 14 | } 15 | 16 | }} // namespace 17 | 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/aggregation_validator_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef aggregation_validator_CONSTANTS_H 8 | #define aggregation_validator_CONSTANTS_H 9 | 10 | #include "aggregation_validator_types.h" 11 | 12 | namespace jaegertracing { namespace thrift { 13 | 14 | class aggregation_validatorConstants { 15 | public: 16 | aggregation_validatorConstants(); 17 | 18 | }; 19 | 20 | extern const aggregation_validatorConstants g_aggregation_validator_constants; 21 | 22 | }} // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/baggage_constants.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #include "baggage_constants.h" 8 | 9 | namespace jaegertracing { namespace thrift { 10 | 11 | const baggageConstants g_baggage_constants; 12 | 13 | baggageConstants::baggageConstants() { 14 | } 15 | 16 | }} // namespace 17 | 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/baggage_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef baggage_CONSTANTS_H 8 | #define baggage_CONSTANTS_H 9 | 10 | #include "baggage_types.h" 11 | 12 | namespace jaegertracing { namespace thrift { 13 | 14 | class baggageConstants { 15 | public: 16 | baggageConstants(); 17 | 18 | }; 19 | 20 | extern const baggageConstants g_baggage_constants; 21 | 22 | }} // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/dependency_constants.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #include "dependency_constants.h" 8 | 9 | namespace jaegertracing { namespace thrift { 10 | 11 | const dependencyConstants g_dependency_constants; 12 | 13 | dependencyConstants::dependencyConstants() { 14 | } 15 | 16 | }} // namespace 17 | 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/dependency_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef dependency_CONSTANTS_H 8 | #define dependency_CONSTANTS_H 9 | 10 | #include "dependency_types.h" 11 | 12 | namespace jaegertracing { namespace thrift { 13 | 14 | class dependencyConstants { 15 | public: 16 | dependencyConstants(); 17 | 18 | }; 19 | 20 | extern const dependencyConstants g_dependency_constants; 21 | 22 | }} // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/jaeger_constants.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #include "jaeger_constants.h" 8 | 9 | namespace jaegertracing { namespace thrift { 10 | 11 | const jaegerConstants g_jaeger_constants; 12 | 13 | jaegerConstants::jaegerConstants() { 14 | } 15 | 16 | }} // namespace 17 | 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/jaeger_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef jaeger_CONSTANTS_H 8 | #define jaeger_CONSTANTS_H 9 | 10 | #include "jaeger_types.h" 11 | 12 | namespace jaegertracing { namespace thrift { 13 | 14 | class jaegerConstants { 15 | public: 16 | jaegerConstants(); 17 | 18 | }; 19 | 20 | extern const jaegerConstants g_jaeger_constants; 21 | 22 | }} // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/sampling_constants.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #include "sampling_constants.h" 8 | 9 | namespace jaegertracing { namespace sampling_manager { namespace thrift { 10 | 11 | const samplingConstants g_sampling_constants; 12 | 13 | samplingConstants::samplingConstants() { 14 | } 15 | 16 | }}} // namespace 17 | 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/sampling_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef sampling_CONSTANTS_H 8 | #define sampling_CONSTANTS_H 9 | 10 | #include "sampling_types.h" 11 | 12 | namespace jaegertracing { namespace sampling_manager { namespace thrift { 13 | 14 | class samplingConstants { 15 | public: 16 | samplingConstants(); 17 | 18 | }; 19 | 20 | extern const samplingConstants g_sampling_constants; 21 | 22 | }}} // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/tracetest_constants.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #include "tracetest_constants.h" 8 | 9 | namespace jaegertracing { namespace crossdock { namespace thrift { 10 | 11 | const tracetestConstants g_tracetest_constants; 12 | 13 | tracetestConstants::tracetestConstants() { 14 | } 15 | 16 | }}} // namespace 17 | 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/tracetest_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef tracetest_CONSTANTS_H 8 | #define tracetest_CONSTANTS_H 9 | 10 | #include "tracetest_types.h" 11 | 12 | namespace jaegertracing { namespace crossdock { namespace thrift { 13 | 14 | class tracetestConstants { 15 | public: 16 | tracetestConstants(); 17 | 18 | }; 19 | 20 | extern const tracetestConstants g_tracetest_constants; 21 | 22 | }}} // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/zipkincore_constants.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #include "zipkincore_constants.h" 8 | 9 | namespace twitter { namespace zipkin { namespace thrift { 10 | 11 | const zipkincoreConstants g_zipkincore_constants; 12 | 13 | zipkincoreConstants::zipkincoreConstants() { 14 | CLIENT_SEND = "cs"; 15 | 16 | CLIENT_RECV = "cr"; 17 | 18 | SERVER_SEND = "ss"; 19 | 20 | SERVER_RECV = "sr"; 21 | 22 | MESSAGE_SEND = "ms"; 23 | 24 | MESSAGE_RECV = "mr"; 25 | 26 | WIRE_SEND = "ws"; 27 | 28 | WIRE_RECV = "wr"; 29 | 30 | CLIENT_SEND_FRAGMENT = "csf"; 31 | 32 | CLIENT_RECV_FRAGMENT = "crf"; 33 | 34 | SERVER_SEND_FRAGMENT = "ssf"; 35 | 36 | SERVER_RECV_FRAGMENT = "srf"; 37 | 38 | LOCAL_COMPONENT = "lc"; 39 | 40 | CLIENT_ADDR = "ca"; 41 | 42 | SERVER_ADDR = "sa"; 43 | 44 | MESSAGE_ADDR = "ma"; 45 | 46 | } 47 | 48 | }}} // namespace 49 | 50 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/thrift-gen/zipkincore_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.11.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef zipkincore_CONSTANTS_H 8 | #define zipkincore_CONSTANTS_H 9 | 10 | #include "zipkincore_types.h" 11 | 12 | namespace twitter { namespace zipkin { namespace thrift { 13 | 14 | class zipkincoreConstants { 15 | public: 16 | zipkincoreConstants(); 17 | 18 | std::string CLIENT_SEND; 19 | std::string CLIENT_RECV; 20 | std::string SERVER_SEND; 21 | std::string SERVER_RECV; 22 | std::string MESSAGE_SEND; 23 | std::string MESSAGE_RECV; 24 | std::string WIRE_SEND; 25 | std::string WIRE_RECV; 26 | std::string CLIENT_SEND_FRAGMENT; 27 | std::string CLIENT_RECV_FRAGMENT; 28 | std::string SERVER_SEND_FRAGMENT; 29 | std::string SERVER_RECV_FRAGMENT; 30 | std::string LOCAL_COMPONENT; 31 | std::string CLIENT_ADDR; 32 | std::string SERVER_ADDR; 33 | std::string MESSAGE_ADDR; 34 | }; 35 | 36 | extern const zipkincoreConstants g_zipkincore_constants; 37 | 38 | }}} // namespace 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/utils/EnvVariable.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/utils/EnvVariable.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/utils/ErrorUtil.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/utils/ErrorUtil.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/utils/HexParsing.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/utils/HexParsing.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/utils/RateLimiter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/utils/RateLimiter.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/jaeger-client-cpp-0.7.0/src/jaegertracing/utils/YAML.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Uber Technologies, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "jaegertracing/utils/YAML.h" 18 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/.gitignore: -------------------------------------------------------------------------------- 1 | *external/ 2 | build/ 3 | lib 4 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Dmitry Tkachenko (tkachenkodmitryv@gmail.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/cmake/redis-cpp-config.cmake.in: -------------------------------------------------------------------------------- 1 | set(@PROJECT_NAME@_VERSION @PROJECT_VERSION@) 2 | @PACKAGE_INIT@ 3 | 4 | set_and_check(@PROJECT_NAME@_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include") 5 | 6 | if(NOT REDISCPP_PURE_CORE) 7 | include(CMakeFindDependencyMacro) 8 | find_dependency(Boost 1.67.0 COMPONENTS thread system iostreams) 9 | endif() 10 | 11 | include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake) 12 | 13 | check_required_components(@PROJECT_NAME@) 14 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/examples/ping/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12.0) 2 | set(PROJECT ping) 3 | string(TOLOWER "${PROJECT}" PROJECT_LC) 4 | 5 | set (REDISCPP_FLAGS "-DREDISCPP_HEADER_ONLY=ON") 6 | 7 | set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/MyCMakeScripts) 8 | set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin) 9 | 10 | set (STD_CXX "c++17") 11 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -std=${STD_CXX} ${REDISCPP_FLAGS}") 12 | 13 | #--------------------------------------------------------- 14 | 15 | #---------------------- Dependencies --------------------- 16 | 17 | find_package(Boost 1.67.0 REQUIRED COMPONENTS thread system iostreams) 18 | include_directories(${Boost_INCLUDE_DIRS}) 19 | link_directories(${Boost_LIBRARY_DIRS}) 20 | 21 | set (LIBRARIES 22 | ${LIBRARIES} 23 | ${Boost_LIBRARIES} 24 | ) 25 | 26 | 27 | include_directories(../../include/) 28 | 29 | #--------------------------------------------------------- 30 | 31 | include_directories (include) 32 | 33 | add_executable(${PROJECT_LC} src/main.cpp) 34 | target_link_libraries(${PROJECT_LC} ${LIBRARIES}) 35 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/examples/ping/src/main.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------- 2 | // redis-cpp 3 | // https://github.com/tdv/redis-cpp 4 | // Created: 03.2020 5 | // Copyright 2020 Dmitry Tkachenko (tkachenkodmitryv@gmail.com) 6 | // Distributed under the MIT License 7 | // (See accompanying file LICENSE) 8 | //------------------------------------------------------------------- 9 | 10 | // STD 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | int main() 18 | { 19 | try 20 | { 21 | auto stream = rediscpp::make_stream("localhost", "6379"); 22 | auto response = rediscpp::execute(*stream, "ping"); 23 | std::cout << response.as() << std::endl; 24 | } 25 | catch (std::exception const &e) 26 | { 27 | std::cerr << "Error: " << e.what() << std::endl; 28 | return EXIT_FAILURE; 29 | } 30 | return EXIT_SUCCESS; 31 | } 32 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/examples/pipeline/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12.0) 2 | set(PROJECT pipeline) 3 | string(TOLOWER "${PROJECT}" PROJECT_LC) 4 | 5 | set (STD_CXX "c++17") 6 | set (REDISCPP_FLAGS "-DREDISCPP_HEADER_ONLY=ON") 7 | 8 | set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/MyCMakeScripts) 9 | set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin) 10 | 11 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -std=${STD_CXX} ${REDISCPP_FLAGS}") 12 | set (CMAKE_CXX_FLAGS_RELEASE "-O3 -g0 -std=${STD_CXX} -Wall -DNDEBUG ${REDISCPP_FLAGS}") 13 | set (CMAKE_POSITION_INDEPENDENT_CODE ON) 14 | 15 | #--------------------------------------------------------- 16 | 17 | #---------------------- Dependencies --------------------- 18 | 19 | find_package(Boost 1.67.0 REQUIRED COMPONENTS thread system iostreams) 20 | include_directories(${Boost_INCLUDE_DIRS}) 21 | link_directories(${Boost_LIBRARY_DIRS}) 22 | 23 | set (LIBRARIES 24 | ${LIBRARIES} 25 | ${Boost_LIBRARIES} 26 | ) 27 | 28 | 29 | include_directories(../../include/) 30 | 31 | #--------------------------------------------------------- 32 | 33 | include_directories (include) 34 | 35 | add_executable(${PROJECT_LC} src/main.cpp) 36 | target_link_libraries(${PROJECT_LC} ${LIBRARIES}) -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/examples/pubsub/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12.0) 2 | set(PROJECT pubsub) 3 | string(TOLOWER "${PROJECT}" PROJECT_LC) 4 | 5 | set (STD_CXX "c++17") 6 | set (REDISCPP_FLAGS "-DREDISCPP_HEADER_ONLY=ON") 7 | 8 | set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/MyCMakeScripts) 9 | set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin) 10 | 11 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -std=${STD_CXX} ${REDISCPP_FLAGS}") 12 | set (CMAKE_CXX_FLAGS_RELEASE "-O3 -g0 -std=${STD_CXX} -Wall -DNDEBUG ${REDISCPP_FLAGS}") 13 | set (CMAKE_POSITION_INDEPENDENT_CODE ON) 14 | 15 | #--------------------------------------------------------- 16 | 17 | #---------------------- Dependencies --------------------- 18 | 19 | find_package(Boost 1.67.0 REQUIRED COMPONENTS thread system iostreams) 20 | include_directories(${Boost_INCLUDE_DIRS}) 21 | link_directories(${Boost_LIBRARY_DIRS}) 22 | 23 | set (LIBRARIES 24 | ${LIBRARIES} 25 | ${Boost_LIBRARIES} 26 | ) 27 | 28 | 29 | include_directories(../../include/) 30 | 31 | #--------------------------------------------------------- 32 | 33 | include_directories (include) 34 | 35 | add_executable(${PROJECT_LC} src/main.cpp) 36 | target_link_libraries(${PROJECT_LC} ${LIBRARIES}) -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/examples/resp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12.0) 2 | set(PROJECT resp) 3 | string(TOLOWER "${PROJECT}" PROJECT_LC) 4 | 5 | set (STD_CXX "c++17") 6 | set (REDISCPP_FLAGS "-DREDISCPP_HEADER_ONLY=ON -DREDISCPP_PURE_CORE=ON") 7 | 8 | set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/MyCMakeScripts) 9 | set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin) 10 | 11 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -std=${STD_CXX} ${REDISCPP_FLAGS}") 12 | set (CMAKE_CXX_FLAGS_RELEASE "-O3 -g0 -std=${STD_CXX} -Wall -DNDEBUG ${REDISCPP_FLAGS}") 13 | set (CMAKE_POSITION_INDEPENDENT_CODE ON) 14 | 15 | #--------------------------------------------------------- 16 | 17 | #---------------------- Dependencies --------------------- 18 | 19 | find_package(Boost 1.67.0 REQUIRED COMPONENTS thread system iostreams) 20 | include_directories(${Boost_INCLUDE_DIRS}) 21 | link_directories(${Boost_LIBRARY_DIRS}) 22 | 23 | set (LIBRARIES 24 | ${LIBRARIES} 25 | ${Boost_LIBRARIES} 26 | ) 27 | 28 | 29 | include_directories(../../include/) 30 | 31 | #--------------------------------------------------------- 32 | 33 | include_directories (include) 34 | 35 | add_executable(${PROJECT_LC} src/main.cpp) 36 | target_link_libraries(${PROJECT_LC} ${LIBRARIES}) -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/examples/setget/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12.0) 2 | set(PROJECT setget) 3 | string(TOLOWER "${PROJECT}" PROJECT_LC) 4 | 5 | set (STD_CXX "c++17") 6 | set (REDISCPP_FLAGS "-DREDISCPP_HEADER_ONLY=ON") 7 | 8 | set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/MyCMakeScripts) 9 | set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin) 10 | 11 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -std=${STD_CXX} ${REDISCPP_FLAGS}") 12 | set (CMAKE_CXX_FLAGS_RELEASE "-O3 -g0 -std=${STD_CXX} -Wall -DNDEBUG ${REDISCPP_FLAGS}") 13 | set (CMAKE_POSITION_INDEPENDENT_CODE ON) 14 | 15 | #--------------------------------------------------------- 16 | 17 | #---------------------- Dependencies --------------------- 18 | 19 | find_package(Boost 1.67.0 REQUIRED COMPONENTS thread system iostreams) 20 | include_directories(${Boost_INCLUDE_DIRS}) 21 | link_directories(${Boost_LIBRARY_DIRS}) 22 | 23 | set (LIBRARIES 24 | ${LIBRARIES} 25 | ${Boost_LIBRARIES} 26 | ) 27 | 28 | 29 | include_directories(../../include/) 30 | 31 | #--------------------------------------------------------- 32 | 33 | include_directories (include) 34 | 35 | add_executable(${PROJECT_LC} src/main.cpp) 36 | target_link_libraries(${PROJECT_LC} ${LIBRARIES}) -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/examples/setget/src/main.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------- 2 | // redis-cpp 3 | // https://github.com/tdv/redis-cpp 4 | // Created: 03.2020 5 | // Copyright 2020 Dmitry Tkachenko (tkachenkodmitryv@gmail.com) 6 | // Distributed under the MIT License 7 | // (See accompanying file LICENSE) 8 | //------------------------------------------------------------------- 9 | 10 | // STD 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | int main() 18 | { 19 | try 20 | { 21 | auto stream = rediscpp::make_stream("localhost", "6379"); 22 | 23 | auto const key = "my_key"; 24 | 25 | auto response = rediscpp::execute(*stream, "set", 26 | key, "Some value for 'my_key'", "ex", "60"); 27 | 28 | std::cout << "Set key '" << key << "': " << response.as() << std::endl; 29 | 30 | response = rediscpp::execute(*stream, "get", key); 31 | std::cout << "Get key '" << key << "': " << response.as() << std::endl; 32 | } 33 | catch (std::exception const &e) 34 | { 35 | std::cerr << "Error: " << e.what() << std::endl; 36 | return EXIT_FAILURE; 37 | } 38 | return EXIT_SUCCESS; 39 | } 40 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/include/redis-cpp/detail/config.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------- 2 | // redis-cpp 3 | // https://github.com/tdv/redis-cpp 4 | // Created: 03.2020 5 | // Copyright 2020 Dmitry Tkachenko (tkachenkodmitryv@gmail.com) 6 | // Distributed under the MIT License 7 | // (See accompanying file LICENSE) 8 | //------------------------------------------------------------------- 9 | 10 | #ifndef REDISCPP_DETAIL_CONFIG_H_ 11 | #define REDISCPP_DETAIL_CONFIG_H_ 12 | 13 | #if __cplusplus < 201703L 14 | #error "RedisCpp. Requires C++ 17 or higher." 15 | #endif 16 | 17 | #endif // !REDISCPP_DETAIL_CONFIG_H_ 18 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/include/redis-cpp/resp/detail/marker.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------- 2 | // redis-cpp 3 | // https://github.com/tdv/redis-cpp 4 | // Created: 03.2020 5 | // Copyright 2020 Dmitry Tkachenko (tkachenkodmitryv@gmail.com) 6 | // Distributed under the MIT License 7 | // (See accompanying file LICENSE) 8 | //------------------------------------------------------------------- 9 | 10 | #ifndef REDISCPP_RESP_DETAIL_MARKER_H_ 11 | #define REDISCPP_RESP_DETAIL_MARKER_H_ 12 | 13 | // REDIS-CPP 14 | #include 15 | 16 | namespace rediscpp 17 | { 18 | inline namespace resp 19 | { 20 | namespace detail::marker 21 | { 22 | 23 | constexpr auto simple_string = '+'; 24 | constexpr auto error_message = '-'; 25 | constexpr auto integer = ':'; 26 | constexpr auto bulk_string = '$'; 27 | constexpr auto array = '*'; 28 | 29 | constexpr auto cr = '\r'; 30 | constexpr auto lf = '\n'; 31 | 32 | } // namespace detail::marker 33 | } // namespace resp 34 | } // namespace rediscpp 35 | 36 | #endif // !REDISCPP_RESP_DETAIL_MARKER_H_ 37 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/include/redis-cpp/resp/detail/overloaded.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------- 2 | // redis-cpp 3 | // https://github.com/tdv/redis-cpp 4 | // Created: 03.2020 5 | // Copyright 2020 Dmitry Tkachenko (tkachenkodmitryv@gmail.com) 6 | // Distributed under the MIT License 7 | // (See accompanying file LICENSE) 8 | //------------------------------------------------------------------- 9 | 10 | #ifndef REDISCPP_RESP_DETAIL_OVERLOADED_H_ 11 | #define REDISCPP_RESP_DETAIL_OVERLOADED_H_ 12 | 13 | // REDIS-CPP 14 | #include 15 | 16 | namespace rediscpp 17 | { 18 | inline namespace resp 19 | { 20 | namespace detail 21 | { 22 | 23 | template 24 | struct overloaded 25 | : public T ... 26 | { 27 | using T::operator() ... ; 28 | }; 29 | 30 | template 31 | overloaded(T ... ) -> overloaded; 32 | 33 | } // namespace detail 34 | } // namespace resp 35 | } // namespace rediscpp 36 | 37 | #endif // !REDISCPP_RESP_DETAIL_MARKER_H_ 38 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/include/redis-cpp/stream.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------- 2 | // redis-cpp 3 | // https://github.com/tdv/redis-cpp 4 | // Created: 03.2020 5 | // Copyright 2020 Dmitry Tkachenko (tkachenkodmitryv@gmail.com) 6 | // Distributed under the MIT License 7 | // (See accompanying file LICENSE) 8 | //------------------------------------------------------------------- 9 | 10 | #ifndef REDISCPP_STREAM_H_ 11 | #define REDISCPP_STREAM_H_ 12 | 13 | #ifndef REDISCPP_PURE_CORE 14 | 15 | // STD 16 | #include 17 | #include 18 | #include 19 | 20 | // REDIS-CPP 21 | #include 22 | 23 | namespace rediscpp 24 | { 25 | 26 | [[nodiscard]] 27 | std::shared_ptr make_stream( 28 | std::string_view host, std::string_view port); 29 | 30 | } // namespace rediscpp 31 | 32 | #ifdef REDISCPP_HEADER_ONLY 33 | #include 34 | #endif // !REDISCPP_HEADER_ONLY 35 | 36 | #endif // !REDISCPP_PURE_CORE 37 | 38 | #endif // !REDISCPP_STREAM_H_ 39 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/redis-docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y redis-server 5 | RUN sed -i 's/^bind 127\.0\.0\.1 \:\:1$/bind 0\.0\.0\.0/g' /etc/redis/redis.conf 6 | RUN sed -i 's/^daemonize yes$/daemonize no/g' /etc/redis/redis.conf 7 | 8 | CMD /usr/bin/redis-server /etc/redis/redis.conf 9 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/redis-docker/build.sh: -------------------------------------------------------------------------------- 1 | docker build -t ubuntu-redis-server:latest . 2 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/redis-docker/run.sh: -------------------------------------------------------------------------------- 1 | docker run -it -p 6379:6379 ubuntu-redis-server 2 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/src/redis-cpp/stream.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------- 2 | // redis-cpp 3 | // https://github.com/tdv/redis-cpp 4 | // Created: 03.2020 5 | // Copyright 2020 Dmitry Tkachenko (tkachenkodmitryv@gmail.com) 6 | // Distributed under the MIT License 7 | // (See accompanying file LICENSE) 8 | //------------------------------------------------------------------- 9 | 10 | #ifndef REDISCPP_HEADER_ONLY 11 | #include 12 | #include 13 | #endif // !REDISCPP_HEADER_ONLY 14 | -------------------------------------------------------------------------------- /3rd-parties/redis-cpp/test/package/This.cmake.in: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.2) 2 | 3 | project(@PROJECT@-package-test NONE) 4 | 5 | include(ExternalProject) 6 | ExternalProject_Add(@PROJECT@ 7 | SOURCE_DIR "@CMAKE_SOURCE_DIR@" # we're testing 'this' project, so use the ROOT 8 | BINARY_DIR "@REDISCPP_EXTERNAL_DIR@/@PROJECT@-build" 9 | TEST_COMMAND "" 10 | BUILD_ALWAYS 0 11 | CMAKE_CACHE_ARGS 12 | -DREDISCPP_HEADER_ONLY:BOOL=@REDISCPP_TEST_HEADER_ONLY@ 13 | -DCMAKE_INSTALL_PREFIX:PATH=@REDISCPP_EXTERNAL_DIR@/@PROJECT@-install 14 | -DCMAKE_BUILD_TYPE:STRING=@CMAKE_BUILD_TYPE@ 15 | ) -------------------------------------------------------------------------------- /Chapter01/README.md: -------------------------------------------------------------------------------- 1 | # Software Architecture with C++ 2 | Software Architecture with C++ by Packt Publishing 3 | 4 | ## Chapter 1: Importance of Software Architecture and Principles of Great Design 5 | 6 | ### Prerequisites 7 | 8 | Install the following software: 9 | - CMake 3.15 10 | - GCC 13 11 | 12 | ### Building 13 | 14 | To build the project using your default compiler run: 15 | 16 | ```bash 17 | mkdir build 18 | cd build 19 | cmake .. -DCMAKE_BUILD_TYPE=Release 20 | cmake --build . 21 | ``` 22 | 23 | If GCC 13 is not your default compiler, you can tell CMake to use it with the `CMAKE_CXX_COMPILER` flag. 24 | Replace the first invocation above with: 25 | 26 | ```bash 27 | cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=`which g++-13` 28 | ``` 29 | -------------------------------------------------------------------------------- /Chapter01/cc/cohesion/high.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using Result = int; 4 | using Results = std::vector; 5 | using WorkItem = int; 6 | using WorkBatch = std::vector; 7 | struct Listener; 8 | 9 | class WorkResultsCache { 10 | public: 11 | void addToCache(const WorkItem &work, const Result &result) {} 12 | void findInCache(const WorkItem &work) {} 13 | void limitCacheSize(std::size_t size) {} 14 | 15 | private: 16 | // ... 17 | }; 18 | 19 | class ResultNotifier { 20 | public: 21 | void addListener(const Listener &listener) {} 22 | void removeListener(const Listener &listener) {} 23 | void notify(const Result &result) {} 24 | 25 | private: 26 | // ... 27 | }; 28 | 29 | class CachingProcessor { 30 | public: 31 | explicit CachingProcessor(ResultNotifier ¬ifier) {} 32 | Result process(WorkItem work) { return {}; } 33 | Results processBatch(WorkBatch batch) { return {}; } 34 | 35 | private: 36 | WorkResultsCache cache_; 37 | ResultNotifier notifier_; 38 | // ... 39 | }; 40 | -------------------------------------------------------------------------------- /Chapter01/cc/cohesion/low.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using Result = int; 4 | using Results = std::vector; 5 | using WorkItem = int; 6 | using WorkBatch = std::vector; 7 | struct Listener; 8 | 9 | class CachingProcessor { 10 | public: 11 | Result process(WorkItem work) { return {}; } 12 | Results processBatch(WorkBatch batch) { return {}; } 13 | void addListener(const Listener &listener) {} 14 | void removeListener(const Listener &listener) {} 15 | 16 | private: 17 | void addToCache(const WorkItem &work, const Result &result) {} 18 | void findInCache(const WorkItem &work) {} 19 | void limitCacheSize(std::size_t size) {} 20 | void notifyListeners(const Result &result) {} 21 | // ... 22 | }; 23 | -------------------------------------------------------------------------------- /Chapter01/cc/coupling/tight.cpp: -------------------------------------------------------------------------------- 1 | class FrontEndDeveloper { 2 | public: 3 | void developFrontEnd() {} 4 | }; 5 | 6 | class BackEndDeveloper { 7 | public: 8 | void developBackEnd() {} 9 | }; 10 | 11 | class MiddlewareDeveloper { 12 | public: 13 | void developMiddleware() {} 14 | }; 15 | 16 | class Project { 17 | public: 18 | void deliver() { 19 | fed_.developFrontEnd(); 20 | med_.developMiddleware(); 21 | bed_.developBackEnd(); 22 | } 23 | 24 | private: 25 | FrontEndDeveloper fed_; 26 | MiddlewareDeveloper med_; 27 | BackEndDeveloper bed_; 28 | }; 29 | 30 | int main() { 31 | Project p{}; 32 | p.deliver(); 33 | } 34 | 35 | // TEST(Project, UsesAllDevelopers) { 36 | // // impossible to implement 37 | // } 38 | -------------------------------------------------------------------------------- /Chapter01/philosophy/algorithms/bad_dots.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int count_dots(const char *str, std::size_t len) { 4 | int count = 0; 5 | for (std::size_t i = 0; i < len; ++i) { 6 | if (str[i] == '.') count++; 7 | } 8 | return count; 9 | } 10 | -------------------------------------------------------------------------------- /Chapter01/philosophy/algorithms/good_dots.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int count_dots(std::string_view str) { 5 | return std::count(std::begin(str), std::end(str), '.'); 6 | } 7 | -------------------------------------------------------------------------------- /Chapter01/philosophy/time/bad_time.cpp: -------------------------------------------------------------------------------- 1 | struct Duration { 2 | int millis_; 3 | }; 4 | 5 | void example() { 6 | auto d = Duration{}; 7 | d.millis_ = 100; 8 | 9 | auto timeout = 1; // second 10 | d.millis_ = timeout; // ouch, we meant 1000 millis but assigned just 1 11 | } 12 | -------------------------------------------------------------------------------- /Chapter01/philosophy/time/good_time.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std::literals::chrono_literals; 4 | 5 | struct Duration { 6 | std::chrono::milliseconds millis_; 7 | }; 8 | 9 | void example() { 10 | auto d = Duration{}; 11 | // d.millis_ = 100; // compilation error, as 100 could mean anything 12 | d.millis_ = 100ms; // okay 13 | 14 | auto timeout = 1s; // or std::chrono::seconds(1); 15 | d.millis_ = 16 | timeout; // okay, seconds will be converted automatically to milliseconds 17 | } 18 | -------------------------------------------------------------------------------- /Chapter01/solid/dip/bad.cpp: -------------------------------------------------------------------------------- 1 | class FrontEndDeveloper { 2 | public: 3 | void developFrontEnd() {} 4 | }; 5 | 6 | class BackEndDeveloper { 7 | public: 8 | void developBackEnd() {} 9 | }; 10 | 11 | class Project { 12 | public: 13 | void deliver() { 14 | fed_.developFrontEnd(); 15 | bed_.developBackEnd(); 16 | } 17 | 18 | private: 19 | FrontEndDeveloper fed_; 20 | BackEndDeveloper bed_; 21 | }; 22 | 23 | int main() { 24 | auto project = Project{}; 25 | project.deliver(); 26 | } 27 | -------------------------------------------------------------------------------- /Chapter01/solid/dip/dynamic_di.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | class Developer { 6 | public: 7 | virtual ~Developer() = default; 8 | virtual void develop() = 0; 9 | }; 10 | 11 | class FrontEndDeveloper : public Developer { 12 | public: 13 | void develop() override { developFrontEnd(); } 14 | 15 | private: 16 | void developFrontEnd() {} 17 | }; 18 | 19 | class BackEndDeveloper : public Developer { 20 | public: 21 | void develop() override { developBackEnd(); } 22 | 23 | private: 24 | void developBackEnd() {} 25 | }; 26 | 27 | class Project { 28 | public: 29 | using Developers = std::vector>; 30 | 31 | explicit Project(Developers developers) 32 | : developers_{std::move(developers)} {} 33 | 34 | void deliver() { 35 | for (auto &developer : developers_) { 36 | developer->develop(); 37 | } 38 | } 39 | 40 | private: 41 | Developers developers_; 42 | }; 43 | 44 | int main() { 45 | auto developers = Project::Developers{}; 46 | developers.emplace_back(std::make_unique()); 47 | developers.emplace_back(std::make_unique()); 48 | auto project = Project{std::move(developers)}; 49 | project.deliver(); 50 | } 51 | -------------------------------------------------------------------------------- /Chapter01/solid/dip/static_dip.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | class FrontEndDeveloper { 7 | public: 8 | void develop() { developFrontEnd(); } 9 | 10 | private: 11 | void developFrontEnd() {} 12 | }; 13 | 14 | class BackEndDeveloper { 15 | public: 16 | void develop() { developBackEnd(); } 17 | 18 | private: 19 | void developBackEnd() {} 20 | }; 21 | 22 | template 23 | class Project { 24 | public: 25 | using Developers = std::vector>; 26 | 27 | explicit Project(Developers developers) 28 | : developers_{std::move(developers)} {} 29 | 30 | void deliver() { 31 | for (auto &developer : developers_) { 32 | std::visit([](auto &dev) { dev.develop(); }, developer); 33 | } 34 | } 35 | 36 | private: 37 | Developers developers_; 38 | }; 39 | 40 | using MyProject = Project; 41 | 42 | int main() { 43 | auto alice = FrontEndDeveloper{}; 44 | auto bob = BackEndDeveloper{}; 45 | auto new_project = MyProject{{alice, bob}}; 46 | new_project.deliver(); 47 | } 48 | -------------------------------------------------------------------------------- /Chapter01/solid/isp/bad.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class IFoodProcessor { 4 | public: 5 | virtual ~IFoodProcessor() = default; 6 | virtual void blend() = 0; 7 | virtual void slice() = 0; 8 | virtual void dice() = 0; 9 | }; 10 | 11 | class AnotherFoodProcessor : public IFoodProcessor { 12 | public: 13 | void blend() override {} 14 | void slice() override {} 15 | void dice() override {} 16 | }; 17 | 18 | class Blender : public IFoodProcessor { 19 | public: 20 | void blend() override {} 21 | void slice() override { throw std::logic_error{"I can't do that"}; } 22 | void dice() override { throw std::logic_error{"Oh no!"}; } 23 | }; 24 | -------------------------------------------------------------------------------- /Chapter01/solid/isp/base.cpp: -------------------------------------------------------------------------------- 1 | class IFoodProcessor { 2 | public: 3 | virtual ~IFoodProcessor() = default; 4 | virtual void blend() = 0; 5 | }; 6 | 7 | class Blender : public IFoodProcessor { 8 | public: 9 | void blend() override {} 10 | }; 11 | -------------------------------------------------------------------------------- /Chapter01/solid/isp/good.cpp: -------------------------------------------------------------------------------- 1 | class IBlender { 2 | public: 3 | virtual ~IBlender() = default; 4 | virtual void blend() = 0; 5 | }; 6 | 7 | class ICutter { 8 | public: 9 | virtual ~ICutter() = default; 10 | virtual void slice() = 0; 11 | virtual void dice() = 0; 12 | }; 13 | 14 | class Blender : public IBlender { 15 | public: 16 | void blend() override {} 17 | }; 18 | 19 | class AnotherFoodProcessor : public IBlender, public ICutter { 20 | public: 21 | void blend() override {} 22 | void slice() override {} 23 | void dice() override {} 24 | }; 25 | -------------------------------------------------------------------------------- /Chapter01/solid/lsp/bad_substitution.cpp: -------------------------------------------------------------------------------- 1 | class Rectangle { 2 | public: 3 | virtual ~Rectangle() = default; 4 | virtual double area() { return width_ * height_; } 5 | virtual void setWidth(double width) { width_ = width; } 6 | virtual void setHeight(double height) { height_ = height; } 7 | 8 | private: 9 | double width_; 10 | double height_; 11 | }; 12 | 13 | class Square : public Rectangle { 14 | public: 15 | double area() override { return Rectangle::area(); } 16 | void setWidth(double width) override { 17 | Rectangle::setWidth(width); 18 | Rectangle::setHeight(width); 19 | } 20 | void setHeight(double height) override { setWidth(height); } 21 | }; 22 | -------------------------------------------------------------------------------- /Chapter01/solid/ocp/ostream_op_preferred.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | class MyPair { 6 | public: 7 | T &firstMember() { return first_; } 8 | const T &firstMember() const { return first_; } 9 | U &secondMember() { return second_; } 10 | const U &secondMember() const { return second_; } 11 | 12 | private: 13 | T first_; 14 | U second_; 15 | int secretThirdMember_; 16 | }; 17 | 18 | std::ostream &operator<<(std::ostream &stream, const MyPair &mp) { 19 | stream << mp.firstMember() << ", "; 20 | stream << mp.secondMember(); 21 | return stream; 22 | } 23 | 24 | int main() { 25 | auto mp = MyPair{}; 26 | std::cout << mp << '\n'; 27 | } 28 | -------------------------------------------------------------------------------- /Chapter01/solid/ocp/ostream_op_private_access_needed.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | class MyPair { 6 | public: 7 | T &firstMember() { return first_; } 8 | const T &firstMember() const { return first_; } 9 | U &secondMember() { return second_; } 10 | const U &secondMember() const { return second_; } 11 | 12 | private: 13 | template 14 | friend std::ostream &operator<<(std::ostream &stream, const MyPair &mp); 15 | 16 | T first_; 17 | U second_; 18 | int secretThirdMember_; 19 | }; 20 | 21 | template 22 | std::ostream &operator<<(std::ostream &stream, const MyPair &mp) { 23 | stream << mp.first_ << ", "; 24 | stream << mp.second_ << ", "; 25 | stream << mp.secretThirdMember_; 26 | return stream; 27 | } 28 | 29 | int main() { 30 | auto mp = MyPair{}; 31 | std::cout << mp << '\n'; 32 | } 33 | -------------------------------------------------------------------------------- /Chapter02/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | 3 | project( 4 | ch02 5 | VERSION 0.0.1 6 | LANGUAGES CXX) 7 | 8 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) 9 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 10 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 11 | 12 | list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}") 13 | 14 | find_package(Microsoft.GSL CONFIG REQUIRED) 15 | 16 | add_library(state INTERFACE) 17 | target_include_directories(state INTERFACE state/) 18 | target_link_libraries(state INTERFACE Microsoft.GSL::GSL) 19 | -------------------------------------------------------------------------------- /Chapter02/conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | ms-gsl/4.0.0 3 | 4 | [generators] 5 | CMakeDeps 6 | -------------------------------------------------------------------------------- /Chapter02/state/PaymentCalculatorV1.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class PaymentCalculator; 4 | { 5 | public: 6 | double calculate() const { return {/* here be accounting wizardry */}; } 7 | 8 | void setHours(double hours) { hours_ = hours; } 9 | 10 | void setHourlyRate(double rate) { netHourlyRate_ = rate; } 11 | 12 | void setTaxPercentage(double tax) { taxPercentage_ = tax; } 13 | 14 | private: 15 | double hours_; 16 | double netHourlyRate_; 17 | double taxPercentage_; 18 | }; 19 | -------------------------------------------------------------------------------- /Chapter02/state/PaymentCalculatorV2.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // contains gsl::not_null 4 | 5 | class Consultant; 6 | 7 | class PaymentCalculator { 8 | public: 9 | double calculate() const { return {}; } 10 | 11 | void setConsultant(const Consultant &c) { consultant_ = &consultant_; } 12 | 13 | void setTaxPercentage(double tax) { taxPercentage_ = tax; } 14 | 15 | private: 16 | gsl::not_null consultant_; 17 | double taxPercentage_; 18 | }; 19 | -------------------------------------------------------------------------------- /Chapter02/state/PaymentCalculatorV3.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class Consultant; 4 | 5 | class PaymentCalculator { 6 | public: 7 | static double calculate(const Consultant &c, double taxPercentage) { 8 | return {}; 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /Chapter03/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | project( 4 | "Breathe Demo" 5 | VERSION 0.0.1 6 | LANGUAGES CXX) 7 | 8 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) 9 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 10 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 11 | 12 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") 13 | add_subdirectory(src) 14 | add_subdirectory(doc) 15 | -------------------------------------------------------------------------------- /Chapter03/README.md: -------------------------------------------------------------------------------- 1 | # Software Architecture with C++ 2 | Software Architecture with C++ by Packt Publishing 3 | 4 | ## Chapter 3: Functional and Nonfunctional Requirements 5 | 6 | ### Autogenerated Documentation Demo 7 | 8 | This is a demo application which shows how to automatically generate 9 | documentation using Doxygen, Breathe and Sphinx. 10 | 11 | This README file should be included in the docs as the main page. 12 | 13 | ### Prerequisites 14 | 15 | Install the following software: 16 | - CMake 17 | - A C++ compiler 18 | - Sphinx 19 | - ReadTheDocs Sphinx theme 20 | - Breathe 21 | - Doxygen 22 | - m2r2 23 | 24 | ### Building 25 | 26 | To build the project, first cd to its directory, and then run: 27 | 28 | ```bash 29 | mkdir build 30 | cd build 31 | cmake .. -DCMAKE_BUILD_TYPE=Release 32 | cmake --build . 33 | ``` 34 | -------------------------------------------------------------------------------- /Chapter03/cmake/FindSphinx.cmake: -------------------------------------------------------------------------------- 1 | find_program( 2 | SPHINX_EXECUTABLE 3 | NAMES sphinx-build 4 | DOC "Path to sphinx-build executable") 5 | 6 | # handle REQUIRED and QUIET arguments, set SPHINX_FOUND variable 7 | include(FindPackageHandleStandardArgs) 8 | find_package_handle_standard_args( 9 | Sphinx "Unable to locate sphinx-build executable" SPHINX_EXECUTABLE) 10 | -------------------------------------------------------------------------------- /Chapter03/doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(Doxygen) 2 | 3 | if(NOT DOXYGEN_FOUND) 4 | return() 5 | endif() 6 | 7 | # just output XML since this is what Breathe consumes 8 | set(DOXYGEN_GENERATE_HTML NO) 9 | set(DOXYGEN_GENERATE_XML YES) 10 | 11 | # don't generate documentation from implementation details 12 | set(DOXYGEN_EXCLUDE_PATTERNS "*/detail/*") 13 | 14 | # print paths relative to include directory 15 | set(DOXYGEN_STRIP_FROM_PATH ${PROJECT_SOURCE_DIR}/include) 16 | 17 | # Note: use doxygen_add_docs(doxygen-doc ALL ...) if you want your documentation 18 | # to be created by default each time you build. Without the keyword you need to 19 | # explicitly invoke building of the 'doc' target. 20 | doxygen_add_docs(doxygen-doc ${PROJECT_SOURCE_DIR}/include COMMENT 21 | "Generating API documentation with Doxygen") 22 | 23 | find_package(Sphinx REQUIRED) 24 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in 25 | ${CMAKE_CURRENT_BINARY_DIR}/conf.py @ONLY) 26 | add_custom_target( 27 | sphinx-doc ALL 28 | COMMAND ${SPHINX_EXECUTABLE} -b html -c ${CMAKE_CURRENT_BINARY_DIR} 29 | ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} 30 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 31 | COMMENT "Generating API documentation with Sphinx" 32 | VERBATIM) 33 | 34 | add_dependencies(sphinx-doc doxygen-doc) 35 | -------------------------------------------------------------------------------- /Chapter03/doc/api_reference.rst: -------------------------------------------------------------------------------- 1 | API Reference 2 | ============= 3 | 4 | .. doxygenindex:: 5 | -------------------------------------------------------------------------------- /Chapter03/doc/conf.py.in: -------------------------------------------------------------------------------- 1 | extensions = [ "breathe", "m2r2" ] 2 | breathe_projects = { "BreatheDemo": "@CMAKE_CURRENT_BINARY_DIR@/xml" } 3 | breathe_default_project = "BreatheDemo" 4 | 5 | project = "Breathe Demo" 6 | author = "Breathe Demo Authors" 7 | copyright = "2019, Breathe Demo Authors" 8 | version = "@PROJECT_VERSION@" 9 | release = "@PROJECT_VERSION@" 10 | 11 | html_theme = 'sphinx_rtd_theme' 12 | -------------------------------------------------------------------------------- /Chapter03/doc/index.rst: -------------------------------------------------------------------------------- 1 | Breathe Demo 2 | ============ 3 | 4 | Welcome to the Breathe Demo documentation! 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | :caption: Contents: 9 | 10 | Introduction 11 | readme 12 | api_reference 13 | -------------------------------------------------------------------------------- /Chapter03/doc/readme.rst: -------------------------------------------------------------------------------- 1 | .. mdinclude:: ../README.md 2 | -------------------------------------------------------------------------------- /Chapter03/include/breathe_demo/demo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // the @file annotation is needed for Doxygen to document the free 4 | // functions in this file 5 | /** 6 | * @file 7 | * @brief The main entry points of our demo 8 | */ 9 | 10 | /** 11 | * A unit of performable work 12 | */ 13 | struct Payload { 14 | /** 15 | * The actual amount of work to perform 16 | */ 17 | int amount; 18 | }; 19 | 20 | /** 21 | @brief Performs really important work 22 | @param payload the descriptor of work to be performed 23 | */ 24 | void perform_work(struct Payload payload); 25 | -------------------------------------------------------------------------------- /Chapter03/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(BreatheDemo demo.cpp) 2 | target_include_directories(BreatheDemo PUBLIC ${PROJECT_SOURCE_DIR}/include) 3 | target_compile_features(BreatheDemo PUBLIC cxx_std_11) 4 | -------------------------------------------------------------------------------- /Chapter03/src/demo.cpp: -------------------------------------------------------------------------------- 1 | #include "breathe_demo/demo.h" 2 | 3 | #include 4 | #include 5 | 6 | void perform_work(Payload payload) { 7 | std::this_thread::sleep_for(std::chrono::seconds(payload.amount)); 8 | } 9 | -------------------------------------------------------------------------------- /Chapter04/README.md: -------------------------------------------------------------------------------- 1 | # Software Architecture with C++ 2 | 3 | Software Architecture with C++ by Packt Publishing 4 | 5 | ## Chapter 4: Architectural and System Design Patterns 6 | 7 | ### Technical requirements 8 | 9 | You'll need Docker to run the examples from this chapter. 10 | 11 | For the tracing and reverse proxy, and the canary releases example you'll 12 | also need Docker Compose. 13 | 14 | ### Running the examples 15 | 16 | To run the examples, please go to the appropriate directory and run: 17 | 18 | ``` 19 | ./build.sh 20 | ./run.sh 21 | ``` 22 | 23 | To stop the examples, execute: 24 | 25 | ``` 26 | ./stop.sh 27 | ``` 28 | -------------------------------------------------------------------------------- /Chapter04/canary_releases/Dockerfile-front_proxy: -------------------------------------------------------------------------------- 1 | FROM envoyproxy/envoy:v1.17-latest 2 | COPY envoy-front_proxy.yaml /etc/envoy/envoy.yaml 3 | -------------------------------------------------------------------------------- /Chapter04/canary_releases/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | docker-compose build 3 | -------------------------------------------------------------------------------- /Chapter04/canary_releases/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3.7" 2 | 3 | services: 4 | front_proxy: 5 | build: 6 | context: . 7 | dockerfile: Dockerfile-front_proxy 8 | networks: 9 | - example_network 10 | ports: 11 | - 12345:12345 12 | - 9901:9901 13 | 14 | old_version: 15 | image: hashicorp/http-echo 16 | networks: 17 | - example_network 18 | command: -text "This is the old version of the app" 19 | 20 | new_version: 21 | image: hashicorp/http-echo 22 | networks: 23 | - example_network 24 | command: -text "This is the new version of the app" 25 | 26 | networks: 27 | example_network: {} 28 | -------------------------------------------------------------------------------- /Chapter04/canary_releases/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | $(dirname $0)/stop.sh 4 | 5 | echo "Running example containers" 6 | docker-compose up --build -d 7 | -------------------------------------------------------------------------------- /Chapter04/canary_releases/stop.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [[ $(docker-compose ps -q | wc -l) -gt 0 ]]; then 3 | echo "Example containers detected -- stopping and removing" 4 | docker-compose down 5 | fi 6 | -------------------------------------------------------------------------------- /Chapter04/circuit_breaker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM envoyproxy/envoy:v1.17-latest 2 | COPY envoy-proxy.yaml /etc/envoy/envoy.yaml 3 | -------------------------------------------------------------------------------- /Chapter04/circuit_breaker/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | $(dirname $0)/stop.sh 3 | if docker images | grep -q example; then 4 | echo "Example image detected -- removing" 5 | docker rmi example 6 | fi 7 | echo "Building example image" 8 | docker build -t example . 9 | -------------------------------------------------------------------------------- /Chapter04/circuit_breaker/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | $(dirname $0)/stop.sh 4 | 5 | echo "Running example container" 6 | docker run --name example -d -p 10000:10000 example 7 | -------------------------------------------------------------------------------- /Chapter04/circuit_breaker/stop.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if docker ps -a | grep -q example; then 3 | echo "Example container detected -- stopping and removing" 4 | docker stop example 5 | docker rm example 6 | fi 7 | -------------------------------------------------------------------------------- /Chapter04/retrying_the_call/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM envoyproxy/envoy:v1.17-latest 2 | COPY envoy-proxy.yaml /etc/envoy/envoy.yaml 3 | -------------------------------------------------------------------------------- /Chapter04/retrying_the_call/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | $(dirname $0)/stop.sh 3 | if docker images | grep -q example; then 4 | echo "Example image detected -- removing" 5 | docker rmi example 6 | fi 7 | echo "Building example image" 8 | docker build -t example . 9 | -------------------------------------------------------------------------------- /Chapter04/retrying_the_call/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | $(dirname $0)/stop.sh 4 | 5 | echo "Running example container" 6 | docker run --name example -d -p 10000:10000 example 7 | -------------------------------------------------------------------------------- /Chapter04/retrying_the_call/stop.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if docker ps -a | grep -q example; then 3 | echo "Example container detected -- stopping and removing" 4 | docker stop example 5 | docker rm example 6 | fi 7 | -------------------------------------------------------------------------------- /Chapter04/tracing_and_reverse_proxy/Dockerfile-front_proxy: -------------------------------------------------------------------------------- 1 | FROM envoyproxy/envoy:v1.17-latest 2 | 3 | RUN apt-get update && \ 4 | apt-get install -y curl && \ 5 | rm -rf /var/lib/apt/lists/* 6 | RUN curl -Lo - https://github.com/tetratelabs/getenvoy-package/files/3518103/getenvoy-centos-jaegertracing-plugin.tar.gz | tar -xz && mv libjaegertracing.so.0.4.2 /usr/local/lib/libjaegertracing_plugin.so 7 | 8 | COPY envoy-front_proxy.yaml /etc/envoy/envoy.yaml 9 | -------------------------------------------------------------------------------- /Chapter04/tracing_and_reverse_proxy/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | docker-compose build 3 | -------------------------------------------------------------------------------- /Chapter04/tracing_and_reverse_proxy/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3.7" 2 | 3 | services: 4 | front_proxy: 5 | build: 6 | context: . 7 | dockerfile: Dockerfile-front_proxy 8 | networks: 9 | - example_network 10 | ports: 11 | - 12345:12345 12 | - 9901:9901 13 | 14 | example_service: 15 | image: hashicorp/http-echo 16 | networks: 17 | - example_network 18 | command: -text "It works!" 19 | 20 | jaeger: 21 | image: jaegertracing/all-in-one 22 | environment: 23 | - COLLECTOR_ZIPKIN_HTTP_PORT=9411 24 | networks: 25 | - example_network 26 | ports: 27 | - 16686:16686 28 | 29 | networks: 30 | example_network: {} 31 | -------------------------------------------------------------------------------- /Chapter04/tracing_and_reverse_proxy/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | $(dirname $0)/stop.sh 4 | 5 | echo "Running example containers" 6 | docker-compose up --build -d 7 | -------------------------------------------------------------------------------- /Chapter04/tracing_and_reverse_proxy/stop.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [[ $(docker-compose ps -q | wc -l) -gt 0 ]]; then 3 | echo "Example containers detected -- stopping and removing" 4 | docker-compose down 5 | fi 6 | -------------------------------------------------------------------------------- /Chapter05/cmake/CommonCompileFlags.cmake: -------------------------------------------------------------------------------- 1 | list( 2 | APPEND 3 | BASE_COMPILE_FLAGS 4 | "$<$,$,$>:-Wall;-Wextra;-pedantic;-Werror>" 5 | "$<$:/W4;/WX>") 6 | -------------------------------------------------------------------------------- /Chapter05/conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | ms-gsl/4.0.0 3 | 4 | [generators] 5 | CMakeDeps 6 | -------------------------------------------------------------------------------- /Chapter05/src/5_modules/customer.cpp: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | export module customer; 4 | 5 | export using CustomerId = int; 6 | 7 | export CustomerId get_current_customer_id() { return 42; } 8 | -------------------------------------------------------------------------------- /Chapter05/src/5_modules/merchant.cpp: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | // next line must come before the exported contents (functions, types) 4 | export module merchant; 5 | 6 | export struct Merchant { 7 | int id; 8 | }; 9 | -------------------------------------------------------------------------------- /Chapter05/src/apis/inline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef NDEBUG 4 | inline namespace release { 5 | #else 6 | inline namespace debug { 7 | #endif 8 | 9 | struct EasilyDebuggable { 10 | // ... 11 | #ifndef NDEBUG 12 | // fields helping with debugging 13 | #endif 14 | }; 15 | 16 | } // end namespace 17 | -------------------------------------------------------------------------------- /Chapter05/src/apis/optional.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | // bad optional function parameters 6 | void calculate_v1(int param) {} // if param equals -1 it means "no value" 7 | void calculate_v2(int param = -1) {} 8 | 9 | // good optional function parameter 10 | void calculate_v3(std::optional param) {} 11 | 12 | // bad optional return values 13 | int try_parse_v1(std::string_view maybe_number) { return {}; } 14 | bool try_parse_v2(std::string_view maybe_number, int &parsed_number) { 15 | return {}; 16 | } 17 | int *try_parse_v3(std::string_view maybe_number) { return {}; } 18 | 19 | // good optional return value 20 | std::optional try_parse_v4(std::string_view maybe_number) { return {}; } 21 | 22 | using PhoneNumber = long long; 23 | 24 | // good optional fields 25 | struct UserProfile { 26 | std::string nickname; 27 | std::optional full_name; 28 | std::optional address; 29 | std::optional phone; 30 | }; 31 | -------------------------------------------------------------------------------- /Chapter05/src/apis/raii.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct Resource; 4 | 5 | // C API 6 | Resource *acquireResource() {} 7 | void releaseResource(Resource *resource) {} 8 | 9 | // C++ API 10 | using ResourceRaii = std::unique_ptr; 11 | ResourceRaii acquireResourceRaii() {} 12 | -------------------------------------------------------------------------------- /Chapter05/src/constexpr.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct Merchant { 5 | int id; 6 | }; 7 | 8 | constexpr bool has_merchant(const Merchant &selected) { 9 | auto merchants = std::array{Merchant{1}, Merchant{2}, Merchant{3}, 10 | Merchant{4}, Merchant{5}}; 11 | return std::binary_search(merchants.begin(), merchants.end(), selected, 12 | [](auto a, auto b) { return a.id < b.id; }); 13 | } 14 | 15 | int main() { return has_merchant({999}); } 16 | -------------------------------------------------------------------------------- /Chapter06/01_raii_guards.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std::chrono; 7 | 8 | void self_measuring_function() { 9 | auto timestamp_begin = high_resolution_clock::now(); 10 | 11 | auto cleanup = gsl::finally([timestamp_begin] { 12 | auto timestamp_end = high_resolution_clock::now(); 13 | std::cout 14 | << "Execution took: " 15 | << duration_cast(timestamp_end - timestamp_begin).count() 16 | << " us"; 17 | }); 18 | 19 | // perform work 20 | // throw std::runtime_error{"Unexpected fault"}; 21 | } 22 | 23 | int main() try { self_measuring_function(); } catch (...) { 24 | } 25 | -------------------------------------------------------------------------------- /Chapter06/02_copy_move.cpp: -------------------------------------------------------------------------------- 1 | struct NonCopyable { 2 | NonCopyable() = default; 3 | NonCopyable(const NonCopyable &) = delete; 4 | NonCopyable &operator=(const NonCopyable &) = delete; 5 | // NOTE: also non-movable 6 | }; 7 | 8 | class MyType : NonCopyable {}; 9 | 10 | struct MyTypeV2 { 11 | MyTypeV2() = default; 12 | MyTypeV2(const MyTypeV2 &) = delete; 13 | MyTypeV2 &operator=(const MyTypeV2 &) = delete; 14 | MyTypeV2(MyTypeV2 &&) = delete; 15 | MyTypeV2 &operator=(MyTypeV2 &&) = delete; 16 | }; 17 | 18 | int main() { 19 | // in C++17+ this works despite non-copyablility due to mandatory copy elision 20 | auto my_object = MyType{}; 21 | auto my_better_object = MyTypeV2{}; 22 | } 23 | -------------------------------------------------------------------------------- /Chapter06/03_rules_of_5_and_0.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class PotentiallyMisleading { 4 | public: 5 | PotentiallyMisleading() = default; 6 | PotentiallyMisleading(const PotentiallyMisleading &) = default; 7 | PotentiallyMisleading &operator=(const PotentiallyMisleading &) = default; 8 | PotentiallyMisleading(PotentiallyMisleading &&) = default; 9 | PotentiallyMisleading &operator=(PotentiallyMisleading &&) = default; 10 | ~PotentiallyMisleading() = default; 11 | 12 | private: 13 | std::unique_ptr int_; 14 | }; 15 | 16 | class RuleOfZero { 17 | std::unique_ptr int_; 18 | }; 19 | 20 | int main() { 21 | auto pm = PotentiallyMisleading{}; 22 | auto pm2 = std::move(pm); 23 | // below line won't compile, but that's not always obvious 24 | // auto pm2_copy = pm2; 25 | 26 | auto roz = RuleOfZero{}; 27 | auto roz2 = std::move(roz); 28 | // below line also won't compile, but that's not surprising 29 | // auto roz2_copy = roz2; 30 | } 31 | -------------------------------------------------------------------------------- /Chapter06/09_factory_functions.cpp: -------------------------------------------------------------------------------- 1 | namespace factory_method { 2 | 3 | class Pixel { 4 | public: 5 | static Pixel fromRgba(char r, char g, char b, char a) { 6 | return Pixel{r, g, b, a}; 7 | } 8 | static Pixel fromBgra(char b, char g, char r, char a) { 9 | return Pixel{r, g, b, a}; 10 | } 11 | 12 | // other members 13 | 14 | private: 15 | Pixel(char r, char g, char b, char a) : r_(r), g_(g), b_(b), a_(a) {} 16 | char r_, g_, b_, a_; 17 | }; 18 | 19 | } // namespace factory_method 20 | 21 | namespace factory_function { 22 | 23 | struct Pixel { 24 | char r, g, b, a; 25 | 26 | private: 27 | Pixel(char r, char g, char b, char a) : r(r), g(g), b(b), a(a) {} 28 | friend Pixel makePixelFromRgba(char r, char g, char b, char a); 29 | friend Pixel makePixelFromBgra(char b, char g, char r, char a); 30 | }; 31 | 32 | Pixel makePixelFromRgba(char r, char g, char b, char a) { 33 | return Pixel{r, g, b, a}; 34 | } 35 | 36 | Pixel makePixelFromBgra(char b, char g, char r, char a) { 37 | return Pixel{r, g, b, a}; 38 | } 39 | 40 | } // namespace factory_function 41 | 42 | int main() { 43 | auto black_pixel = factory_method::Pixel::fromRgba(0, 0, 0, 0); 44 | auto white_pixel = factory_function::makePixelFromRgba(255, 255, 255, 0); 45 | } 46 | -------------------------------------------------------------------------------- /Chapter06/conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | ms-gsl/4.0.0 3 | 4 | [generators] 5 | CMakeDeps 6 | -------------------------------------------------------------------------------- /Chapter07/customer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15...3.19) 2 | 3 | project( 4 | Customer 5 | VERSION 0.0.1 6 | LANGUAGES CXX) 7 | 8 | # TODO: make sure this works for Xcode and MSVC 9 | find_program(CCACHE_PROGRAM ccache) 10 | if(CCACHE_PROGRAM) 11 | set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") 12 | endif() 13 | 14 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") 15 | list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}") 16 | 17 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) 18 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 19 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 20 | 21 | find_package(cpprestsdk CONFIG REQUIRED) 22 | 23 | include(CommonCompileFlags) 24 | 25 | add_subdirectory(src/customer) 26 | 27 | if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) 28 | include(CTest) 29 | if(BUILD_TESTING) 30 | add_subdirectory(test) 31 | endif() 32 | endif() 33 | -------------------------------------------------------------------------------- /Chapter07/customer/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Packt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Chapter07/customer/README.md: -------------------------------------------------------------------------------- 1 | # Software Architecture with C++ 2 | Software Architecture with C++ by Packt Publishing 3 | 4 | For building instructions, refer to the README file in the root of this chapter's code. 5 | 6 | This file should be packed by CPack. 7 | -------------------------------------------------------------------------------- /Chapter07/customer/cmake/CommonCompileFlags.cmake: -------------------------------------------------------------------------------- 1 | list( 2 | APPEND 3 | BASE_COMPILE_FLAGS 4 | "$<$,$,$>:-Wall;-Wextra;-pedantic;-Werror>" 5 | "$<$:/W4;/WX>") 6 | -------------------------------------------------------------------------------- /Chapter07/customer/cmake/CustomerConfig.cmake.in: -------------------------------------------------------------------------------- 1 | include(CMakeFindDependencyMacro) 2 | 3 | find_dependency(cpprestsdk 2.10.18) 4 | 5 | if(NOT TARGET domifair::@PROJECT_NAME@) 6 | include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") 7 | endif() 8 | -------------------------------------------------------------------------------- /Chapter07/customer/cmake/FetchGTest.cmake: -------------------------------------------------------------------------------- 1 | include(FetchContent) 2 | 3 | FetchContent_Declare( 4 | googletest 5 | GIT_REPOSITORY https://github.com/google/googletest.git 6 | GIT_TAG dcc92d0ab6c4ce022162a23566d44f673251eee4) 7 | 8 | FetchContent_GetProperties(googletest) 9 | if(NOT googletest_POPULATED) 10 | FetchContent_Populate(googletest) 11 | add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} 12 | EXCLUDE_FROM_ALL) 13 | endif() 14 | 15 | message(STATUS "GTest binaries are present at ${googletest_BINARY_DIR}") 16 | -------------------------------------------------------------------------------- /Chapter07/customer/conan/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | project(PackageTest CXX) 3 | 4 | list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}") 5 | 6 | find_package(customer CONFIG REQUIRED) 7 | 8 | add_executable(example example.cpp) 9 | target_link_libraries(example customer::customer) 10 | 11 | # CTest tests can be added here 12 | -------------------------------------------------------------------------------- /Chapter07/customer/conan/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from conans import ConanFile, CMake, tools 4 | 5 | 6 | class CustomerTestConan(ConanFile): 7 | settings = "os", "compiler", "build_type", "arch" 8 | generators = "CMakeDeps" 9 | 10 | def imports(self): 11 | self.copy("*.dll", dst="bin", src="bin") 12 | self.copy("*.dylib*", dst="bin", src="lib") 13 | self.copy('*.so*', dst='bin', src='lib') 14 | 15 | def build(self): 16 | cmake = CMake(self) 17 | # Current dir is "test_package/build/" and CMakeLists.txt is 18 | # in "test_package" 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if not tools.cross_building(self.settings): 24 | self.run(".%sexample" % os.sep) 25 | -------------------------------------------------------------------------------- /Chapter07/customer/conan/test_package/example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { responder{}.prepare_response("Conan"); } 4 | -------------------------------------------------------------------------------- /Chapter07/customer/conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | cpprestsdk/2.10.18 3 | 4 | [generators] 5 | CMakeDeps 6 | -------------------------------------------------------------------------------- /Chapter07/customer/include/customer/customer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | class responder { 10 | public: 11 | auto prepare_response(const std::string &name) 12 | -> std::pair<::web::http::status_code, ::web::json::value>; 13 | 14 | auto respond(const ::web::http::http_request &request, 15 | ::web::http::status_code status, 16 | const ::web::json::value &response) -> void; 17 | }; 18 | 19 | template 20 | void handle_get(const ::web::http::http_request &req, Responder &responder) { 21 | using namespace ::web; 22 | using namespace ::web::http; 23 | using namespace ::utility; 24 | 25 | auto parameters = uri::split_query(req.request_uri().query()); 26 | auto key_value_it = parameters.find(string_t("name")); 27 | 28 | if (key_value_it == end(parameters)) { 29 | auto err = string_t("Missing value for 'name'"); 30 | responder.respond(req, status_codes::BadRequest, 31 | json::value::string(std::move(err))); 32 | return; 33 | } 34 | 35 | const auto &name = key_value_it->second; 36 | const auto [code, response] = responder.prepare_response(name); 37 | responder.respond(req, code, response); 38 | } 39 | -------------------------------------------------------------------------------- /Chapter07/customer/src/customer/lib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "customer/customer.h" 6 | 7 | using namespace ::web; 8 | using namespace ::web::http; 9 | using ::utility::string_t; 10 | 11 | auto responder::respond(const http_request &request, status_code status, 12 | const json::value &response) -> void { 13 | json::value resp; 14 | resp[string_t("status")] = json::value::number(status); 15 | resp[string_t("response")] = response; 16 | request.reply(status, resp); 17 | } 18 | 19 | auto responder::prepare_response(const std::string &name) 20 | -> std::pair { 21 | return {status_codes::OK, 22 | json::value::string(string_t("Hello, ") + name + "!")}; 23 | } 24 | -------------------------------------------------------------------------------- /Chapter07/customer/src/customer/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "customer/customer.h" 7 | 8 | using namespace ::web; 9 | using namespace ::web::http; 10 | using namespace std::literals; 11 | using ::utility::string_t; 12 | 13 | int main() { 14 | using ::web::http::experimental::listener::http_listener; 15 | auto listener = http_listener{string_t("http://0.0.0.0:8080/customer")}; 16 | 17 | auto get_responder = responder{}; 18 | listener.support( 19 | methods::GET, // other verbs coming soon! 20 | [&](const auto &request) { handle_get(request, get_responder); }); 21 | 22 | listener.open().wait(); 23 | 24 | std::this_thread::sleep_for(60s); 25 | listener.close().wait(); 26 | } 27 | -------------------------------------------------------------------------------- /Chapter07/customer/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(FetchGTest) 2 | include(GoogleTest) 3 | 4 | add_subdirectory(customer) 5 | -------------------------------------------------------------------------------- /Chapter07/customer/test/customer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(unittests unit.cpp) 2 | target_compile_options(unittests PRIVATE ${BASE_COMPILE_FLAGS}) 3 | target_link_libraries(unittests PRIVATE domifair::libcustomer gtest_main) 4 | gtest_discover_tests(unittests) 5 | -------------------------------------------------------------------------------- /Chapter07/customer/test/customer/unit.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "customer/customer.h" 4 | 5 | TEST(basic_responses, given_name_when_prepare_responses_then_greets_friendly) { 6 | auto name = "Bob"; 7 | auto code_and_string = responder{}.prepare_response(name); 8 | ASSERT_EQ(code_and_string.first, web::http::status_codes::OK); 9 | ASSERT_EQ(code_and_string.second, web::json::value("Hello, Bob!")); 10 | } 11 | -------------------------------------------------------------------------------- /Chapter08/customer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15...3.19) 2 | 3 | project( 4 | Customer 5 | VERSION 0.0.1 6 | LANGUAGES CXX) 7 | 8 | # TODO: make sure this works for Xcode and MSVC 9 | find_program(CCACHE_PROGRAM ccache) 10 | if(CCACHE_PROGRAM) 11 | set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") 12 | endif() 13 | 14 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") 15 | list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}") 16 | 17 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) 18 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 19 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 20 | 21 | find_package(cpprestsdk CONFIG REQUIRED) 22 | find_package(Catch2 CONFIG REQUIRED) 23 | find_package(doctest CONFIG REQUIRED) 24 | 25 | include(CommonCompileFlags) 26 | 27 | add_subdirectory(src/customer) 28 | 29 | if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) 30 | include(CTest) 31 | if(BUILD_TESTING) 32 | add_subdirectory(test) 33 | endif() 34 | endif() 35 | -------------------------------------------------------------------------------- /Chapter08/customer/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Packt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Chapter08/customer/README.md: -------------------------------------------------------------------------------- 1 | # Software Architecture with C++ 2 | Software Architecture with C++ by Packt Publishing 3 | 4 | For building instructions, refer to the README file in the root of this chapter's code. 5 | 6 | This file should be packed by CPack. 7 | -------------------------------------------------------------------------------- /Chapter08/customer/cmake/CommonCompileFlags.cmake: -------------------------------------------------------------------------------- 1 | list( 2 | APPEND 3 | BASE_COMPILE_FLAGS 4 | "$<$,$,$>:-Wall;-Wextra;-pedantic;-Werror>" 5 | "$<$:/W4;/WX>") 6 | -------------------------------------------------------------------------------- /Chapter08/customer/cmake/CustomerConfig.cmake.in: -------------------------------------------------------------------------------- 1 | include(CMakeFindDependencyMacro) 2 | 3 | find_dependency(cpprestsdk 2.10.18) 4 | 5 | if(NOT TARGET domifair::@PROJECT_NAME@) 6 | include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") 7 | endif() 8 | -------------------------------------------------------------------------------- /Chapter08/customer/cmake/FetchCppUnit.cmake: -------------------------------------------------------------------------------- 1 | include(FetchContent) 2 | 3 | FetchContent_Declare( 4 | cppunit 5 | GIT_REPOSITORY https://github.com/aostrowski/CppUnit.git 6 | GIT_TAG master 7 | GIT_SHALLOW ON) 8 | FetchContent_MakeAvailable(cppunit) 9 | message(STATUS "CppUnit fetched successfully") 10 | -------------------------------------------------------------------------------- /Chapter08/customer/cmake/FetchGTest.cmake: -------------------------------------------------------------------------------- 1 | include(FetchContent) 2 | 3 | FetchContent_Declare( 4 | googletest 5 | GIT_REPOSITORY https://github.com/google/googletest.git 6 | GIT_TAG dcc92d0ab6c4ce022162a23566d44f673251eee4) 7 | 8 | FetchContent_GetProperties(googletest) 9 | if(NOT googletest_POPULATED) 10 | FetchContent_Populate(googletest) 11 | add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} 12 | EXCLUDE_FROM_ALL) 13 | endif() 14 | 15 | message(STATUS "GTest binaries are present at ${googletest_BINARY_DIR}") 16 | -------------------------------------------------------------------------------- /Chapter08/customer/conan/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | project(PackageTest CXX) 3 | 4 | list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}") 5 | 6 | find_package(customer CONFIG REQUIRED) 7 | 8 | add_executable(example example.cpp) 9 | target_link_libraries(example customer::customer) 10 | 11 | # CTest tests can be added here 12 | -------------------------------------------------------------------------------- /Chapter08/customer/conan/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from conans import ConanFile, CMake, tools 4 | 5 | 6 | class CustomerTestConan(ConanFile): 7 | settings = "os", "compiler", "build_type", "arch" 8 | generators = "CMakeDeps" 9 | 10 | def imports(self): 11 | self.copy("*.dll", dst="bin", src="bin") 12 | self.copy("*.dylib*", dst="bin", src="lib") 13 | self.copy('*.so*', dst='bin', src='lib') 14 | 15 | def build(self): 16 | cmake = CMake(self) 17 | # Current dir is "test_package/build/" and CMakeLists.txt is 18 | # in "test_package" 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if not tools.cross_building(self.settings): 24 | self.run(".%sexample" % os.sep) 25 | -------------------------------------------------------------------------------- /Chapter08/customer/conan/test_package/example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { responder{}.prepare_response("Conan"); } 4 | -------------------------------------------------------------------------------- /Chapter08/customer/conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | cpprestsdk/2.10.18 3 | catch2/2.13.10 4 | doctest/2.3.7 5 | 6 | [generators] 7 | CMakeDeps 8 | -------------------------------------------------------------------------------- /Chapter08/customer/include/customer/customer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | class responder { 10 | public: 11 | auto prepare_response(const std::string &name) 12 | -> std::pair<::web::http::status_code, ::web::json::value>; 13 | 14 | auto respond(const ::web::http::http_request &request, 15 | ::web::http::status_code status, 16 | const ::web::json::value &response) -> void; 17 | }; 18 | 19 | template 20 | void handle_get(const ::web::http::http_request &req, Responder &responder) { 21 | using namespace ::web; 22 | using namespace ::web::http; 23 | using namespace ::utility; 24 | 25 | auto parameters = uri::split_query(req.request_uri().query()); 26 | auto key_value_it = parameters.find(string_t("name")); 27 | 28 | if (key_value_it == end(parameters)) { 29 | auto err = string_t("Missing value for 'name'"); 30 | responder.respond(req, status_codes::BadRequest, 31 | json::value::string(std::move(err))); 32 | return; 33 | } 34 | 35 | const auto &name = key_value_it->second; 36 | const auto [code, response] = responder.prepare_response(name); 37 | responder.respond(req, code, response); 38 | } 39 | -------------------------------------------------------------------------------- /Chapter08/customer/src/customer/lib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "customer/customer.h" 6 | 7 | using namespace ::web; 8 | using namespace ::web::http; 9 | using ::utility::string_t; 10 | 11 | auto responder::respond(const http_request &request, status_code status, 12 | const json::value &response) -> void { 13 | json::value resp; 14 | resp[string_t("status")] = json::value::number(status); 15 | resp[string_t("response")] = response; 16 | request.reply(status, resp); 17 | } 18 | 19 | auto responder::prepare_response(const std::string &name) 20 | -> std::pair { 21 | return {status_codes::OK, 22 | json::value::string(string_t("Hello, ") + name + "!")}; 23 | } 24 | -------------------------------------------------------------------------------- /Chapter08/customer/src/customer/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "customer/customer.h" 7 | 8 | using namespace ::web; 9 | using namespace ::web::http; 10 | using namespace std::literals; 11 | using ::utility::string_t; 12 | 13 | int main() { 14 | using ::web::http::experimental::listener::http_listener; 15 | auto listener = http_listener{string_t("http://0.0.0.0:8080/customer")}; 16 | 17 | auto get_responder = responder{}; 18 | listener.support( 19 | methods::GET, // other verbs coming soon! 20 | [&](const auto &request) { handle_get(request, get_responder); }); 21 | 22 | listener.open().wait(); 23 | 24 | std::this_thread::sleep_for(60s); 25 | listener.close().wait(); 26 | } 27 | -------------------------------------------------------------------------------- /Chapter08/customer/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(Catch) 2 | 3 | include(FetchGTest) 4 | include(GoogleTest) 5 | 6 | include(FetchCppUnit) 7 | 8 | add_subdirectory(customer) 9 | -------------------------------------------------------------------------------- /Chapter08/customer/test/customer/catch.cpp: -------------------------------------------------------------------------------- 1 | #include "customer/customer.h" 2 | 3 | #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do 4 | // this in one cpp file 5 | #include "catch2/catch.hpp" 6 | 7 | TEST_CASE("Basic responses", 8 | "Given Name When Prepare Responses Then Greets Friendly") { 9 | auto name = "Bob"; 10 | auto code_and_string = responder{}.prepare_response(name); 11 | REQUIRE(code_and_string.first == web::http::status_codes::OK); 12 | REQUIRE(code_and_string.second == web::json::value("Hello, Bob!")); 13 | } 14 | -------------------------------------------------------------------------------- /Chapter08/customer/test/customer/compiletime.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | constexpr int generate_lucky_number(std::string_view name) { 4 | if (name == "Bob") { 5 | return 808; 6 | } 7 | 8 | int number = 1; 9 | for (auto letter : name) { 10 | number = number * 7 + static_cast(letter); 11 | } 12 | return number; 13 | } 14 | 15 | static_assert(generate_lucky_number("Bob") == 808); 16 | -------------------------------------------------------------------------------- /Chapter08/customer/test/customer/doctest.cpp: -------------------------------------------------------------------------------- 1 | #include "customer/customer.h" 2 | 3 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 4 | #include 5 | 6 | TEST_CASE("Basic responses") { 7 | auto name = "Bob"; 8 | auto code_and_string = responder{}.prepare_response(name); 9 | REQUIRE(code_and_string.first == web::http::status_codes::OK); 10 | REQUIRE(code_and_string.second == web::json::value("Hello, Bob!")); 11 | } 12 | -------------------------------------------------------------------------------- /Chapter08/customer/test/customer/gtest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "customer/customer.h" 4 | 5 | TEST(basic_responses, given_name_when_prepare_responses_then_greets_friendly) { 6 | auto name = "Bob"; 7 | auto code_and_string = responder{}.prepare_response(name); 8 | ASSERT_EQ(code_and_string.first, web::http::status_codes::OK); 9 | ASSERT_EQ(code_and_string.second, web::json::value("Hello, Bob!")); 10 | } 11 | -------------------------------------------------------------------------------- /Chapter08/mobile_app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | 3 | project( 4 | MobileApp 5 | VERSION 0.0.1 6 | LANGUAGES CXX) 7 | 8 | # TODO: make sure this works for Xcode and MSVC 9 | find_program(CCACHE_PROGRAM ccache) 10 | if(CCACHE_PROGRAM) 11 | set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") 12 | endif() 13 | 14 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") 15 | list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}") 16 | 17 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) 18 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 19 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 20 | 21 | find_package(Catch2 CONFIG REQUIRED) 22 | find_package(trompeloeil CONFIG REQUIRED) 23 | find_package(Microsoft.GSL CONFIG REQUIRED) 24 | 25 | include(CommonCompileFlags) 26 | 27 | list(APPEND CMAKE_MODULE_PATH "${CONAN_LIB_DIRS_CATCH2}/cmake/Catch2") 28 | 29 | add_subdirectory(src) 30 | 31 | if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) 32 | include(CTest) 33 | if(BUILD_TESTING) 34 | add_subdirectory(test) 35 | endif() 36 | endif() 37 | -------------------------------------------------------------------------------- /Chapter08/mobile_app/cmake/CommonCompileFlags.cmake: -------------------------------------------------------------------------------- 1 | list(APPEND BASE_COMPILE_FLAGS_CLANG_GNU -Wall -Wextra -pedantic -Werror) 2 | list(APPEND BASE_COMPILE_FLAGS_MSVC /W4 /WX) 3 | list( 4 | APPEND 5 | BASE_COMPILE_FLAGS 6 | "$<$,$,$>:${BASE_COMPILE_FLAGS_CLANG_GNU}>" 7 | "$<$:${BASE_COMPILE_FLAGS_MSVC}>") 8 | -------------------------------------------------------------------------------- /Chapter08/mobile_app/cmake/FetchGTest.cmake: -------------------------------------------------------------------------------- 1 | include(FetchContent) 2 | 3 | FetchContent_Declare( 4 | googletest 5 | GIT_REPOSITORY https://github.com/google/googletest.git 6 | GIT_TAG dcc92d0ab6c4ce022162a23566d44f673251eee4) 7 | 8 | FetchContent_GetProperties(googletest) 9 | if(NOT googletest_POPULATED) 10 | FetchContent_Populate(googletest) 11 | add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} 12 | EXCLUDE_FROM_ALL) 13 | endif() 14 | 15 | message(STATUS "GTest binaries are present at ${googletest_BINARY_DIR}") 16 | -------------------------------------------------------------------------------- /Chapter08/mobile_app/conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | catch2/2.13.10 3 | trompeloeil/46 4 | ms-gsl/4.0.0 5 | 6 | [generators] 7 | CMakeDeps 8 | -------------------------------------------------------------------------------- /Chapter08/mobile_app/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(merchants) 2 | -------------------------------------------------------------------------------- /Chapter08/mobile_app/src/merchants/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(merchants STATIC visited_merchant_history.cpp reviews.cpp) 2 | target_compile_features(merchants PUBLIC cxx_std_20) 3 | target_include_directories(merchants PUBLIC "${PROJECT_SOURCE_DIR}/include") 4 | target_link_libraries(merchants PRIVATE Microsoft.GSL::GSL) 5 | -------------------------------------------------------------------------------- /Chapter08/mobile_app/src/merchants/visited_merchant_history.cpp: -------------------------------------------------------------------------------- 1 | #include "merchants/visited_merchant_history.h" 2 | 3 | std::size_t history_of_visited_merchants::add( 4 | std::unique_ptr merchant) { 5 | merchants_.push_back(std::move(merchant)); 6 | return merchants_.size() - 1; 7 | } 8 | 9 | void history_of_visited_merchants::rate(std::size_t merchant_index, 10 | stars new_rating) { 11 | auto &merchant = *merchants_[merchant_index]; 12 | if (merchant.get_rating() != new_rating) { 13 | merchant.post_rating(new_rating); 14 | } 15 | } 16 | 17 | const i_visited_merchant &history_of_visited_merchants::get_merchant( 18 | std::size_t merchant_index) { 19 | return *merchants_[merchant_index]; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter08/mobile_app/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(FetchGTest) 2 | include(GoogleTest) 3 | include(Catch) 4 | add_subdirectory(merchants) 5 | -------------------------------------------------------------------------------- /Chapter08/mobile_app/test/merchants/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(merchanttests_gmock reviewtests_gmock.cpp) 2 | target_link_libraries(merchanttests_gmock PRIVATE merchants gmock gmock_main) 3 | gtest_discover_tests(merchanttests_gmock) 4 | 5 | add_executable(merchanttests_trompeloeil reviewtests_trompeloeil.cpp) 6 | target_compile_features(merchanttests_trompeloeil PRIVATE cxx_std_17) 7 | target_link_libraries(merchanttests_trompeloeil 8 | PRIVATE merchants trompeloeil::trompeloeil Catch2::Catch2) 9 | catch_discover_tests(merchanttests_trompeloeil) 10 | -------------------------------------------------------------------------------- /Chapter08/mobile_app/test/merchants/fake_customer_review_store.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "merchants/reviews.h" 7 | 8 | class fake_customer_review_store : public i_customer_review_store { 9 | public: 10 | explicit fake_customer_review_store(review::customer_id_t customer_id) 11 | : customer_id_(customer_id) {} 12 | 13 | std::optional get_review_for_merchant( 14 | review::merchant_id_t merchant_id) final { 15 | if (auto it = reviews_.find(merchant_id); it != std::end(reviews_)) { 16 | return it->second; 17 | } 18 | return {}; 19 | } 20 | 21 | void post_review(review r) final { 22 | if (r.customer != customer_id_) { 23 | throw std::invalid_argument{ 24 | "Trying to post a review under a different customer ID"}; 25 | } 26 | reviews_[r.merchant] = std::move(r); 27 | } 28 | 29 | private: 30 | review::customer_id_t customer_id_; 31 | std::unordered_map reviews_; 32 | }; 33 | -------------------------------------------------------------------------------- /Chapter09/.envrc: -------------------------------------------------------------------------------- 1 | dotenv 2 | use_nix 3 | -------------------------------------------------------------------------------- /Chapter09/bdd/step_definitions.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | using cucumber::ScenarioScope; 7 | 8 | struct SumCtx { 9 | Sum sum; 10 | int a; 11 | int b; 12 | int result; 13 | }; 14 | 15 | GIVEN("^I have entered (\\d+) and (\\d+) as parameters$", 16 | (const int a, const int b)) { 17 | ScenarioScope context; 18 | 19 | context->a = a; 20 | context->b = b; 21 | } 22 | 23 | WHEN("^I add them") { 24 | ScenarioScope context; 25 | 26 | context->result = context->sum.sum(context->a, context->b); 27 | } 28 | 29 | THEN("^the result should be (.*)$", (const int expected)) { 30 | ScenarioScope context; 31 | 32 | EXPECT_EQ(expected, context->result); 33 | } 34 | -------------------------------------------------------------------------------- /Chapter09/bdd/sum.features: -------------------------------------------------------------------------------- 1 | # language: en 2 | Feature: Summing 3 | In order to see how much we earn, 4 | Sum must be able to add two numbers together 5 | 6 | Scenario: Regular numbers 7 | Given I have entered 3 and 2 as parameters 8 | When I add them 9 | Then the result should be 5 10 | -------------------------------------------------------------------------------- /Chapter09/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import ( 2 | builtins.fetchTarball { 3 | url = "https://github.com/NixOS/nixpkgs/archive/21.11-pre.tar.gz"; 4 | sha256 = "0ww19c7n4fj9zn770aw8zaqld742bi9sa9s8hqb3vrgp3mpihil0"; 5 | } 6 | ) {} }: 7 | 8 | let 9 | additionalInputs = if pkgs.system == "x86_64-linux" then pkgs.lsb-release else ""; 10 | in 11 | with pkgs; { 12 | gcc11Env = stdenvNoCC.mkDerivation { 13 | name = "gcc11-environment"; 14 | buildInputs = [ 15 | ansible 16 | autoconf 17 | automake 18 | awscli 19 | clang 20 | conan 21 | cmake 22 | docker 23 | docker-compose 24 | doxygen 25 | gcc 26 | libtool 27 | lsb-release 28 | packer 29 | pkg-config 30 | pre-commit 31 | python3Packages.setuptools 32 | python3Packages.pip 33 | python3Packages.virtualenv 34 | terraform 35 | ]; 36 | shellHook = '' 37 | virtualenv venv 38 | source venv/bin/activate 39 | pip install sphinx sphinx-rtd-theme breathe m2r2 40 | ''; 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /Chapter09/env.example: -------------------------------------------------------------------------------- 1 | AWS_ACCESS_KEY_ID=access_key_id 2 | AWS_SECRET_ACCESS_KEY=secret_key 3 | -------------------------------------------------------------------------------- /Chapter09/packer/packer_ami.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "aws_access_key": "", 4 | "aws_secret_key": "" 5 | }, 6 | "builders": [ 7 | { 8 | "type": "amazon-ebs", 9 | "access_key": "{{user `aws_access_key`}}", 10 | "secret_key": "{{user `aws_secret_key`}}", 11 | "region": "eu-central-1", 12 | "source_ami": "ami-0f1026b68319bad6c", 13 | "instance_type": "t2.micro", 14 | "ssh_username": "admin", 15 | "ami_name": "Project's Base Image {{timestamp}}" 16 | } 17 | ], 18 | "provisioners": [ 19 | { 20 | "type": "shell", 21 | "inline": [ 22 | "sudo apt-get update", 23 | "sudo apt-get install -y nginx" 24 | ] 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /Chapter09/packer/packer_ami_provisioner.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "aws_access_key": "", 4 | "aws_secret_key": "" 5 | }, 6 | "builders": [ 7 | { 8 | "type": "amazon-ebs", 9 | "access_key": "{{user `aws_access_key`}}", 10 | "secret_key": "{{user `aws_secret_key`}}", 11 | "region": "eu-central-1", 12 | "source_ami": "ami-0f1026b68319bad6c", 13 | "instance_type": "t2.micro", 14 | "ssh_username": "admin", 15 | "ami_name": "Project's Base Image {{timestamp}}" 16 | } 17 | ], 18 | "provisioners": [ 19 | { 20 | "type": "ansible", 21 | "playbook_file": "./provision.yml", 22 | "user": "admin", 23 | "host_alias": "baseimage" 24 | } 25 | ], 26 | "post-processors": [ 27 | { 28 | "type": "manifest", 29 | "output": "manifest.json", 30 | "strip_path": true 31 | } 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /Chapter09/packer/provision.yml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | become: yes 3 | tasks: 4 | - name: "apt-get update" 5 | apt: 6 | update_cache: yes 7 | cache_valid_time: 3600 8 | 9 | - name: "install nginx" 10 | apt: 11 | name: ['nginx'] 12 | state: latest 13 | -------------------------------------------------------------------------------- /Chapter10/mobile_app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | 3 | project( 4 | MobileApp 5 | VERSION 0.0.1 6 | LANGUAGES CXX) 7 | 8 | find_program(CCACHE_PROGRAM ccache) 9 | if(CCACHE_PROGRAM) 10 | set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") 11 | endif() 12 | 13 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") 14 | list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}") 15 | 16 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) 17 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 18 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 19 | 20 | find_package(Microsoft.GSL CONFIG REQUIRED) 21 | 22 | include(CommonCompileFlags) 23 | 24 | add_subdirectory(src) 25 | -------------------------------------------------------------------------------- /Chapter10/mobile_app/cmake/CommonCompileFlags.cmake: -------------------------------------------------------------------------------- 1 | list(APPEND BASE_COMPILE_FLAGS_CLANG_GNU -Wall -Wextra -pedantic -Werror) 2 | list(APPEND BASE_COMPILE_FLAGS_MSVC /W4 /WX) 3 | list( 4 | APPEND 5 | BASE_COMPILE_FLAGS 6 | "$<$,$,$>:${BASE_COMPILE_FLAGS_CLANG_GNU}>" 7 | "$<$:${BASE_COMPILE_FLAGS_MSVC}>") 8 | -------------------------------------------------------------------------------- /Chapter10/mobile_app/conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | Catch2/2.13.10 3 | trompeloeil/46 4 | ms-gsl/4.0.0 5 | 6 | [generators] 7 | CMakeDeps 8 | -------------------------------------------------------------------------------- /Chapter10/mobile_app/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(merchants) 2 | -------------------------------------------------------------------------------- /Chapter10/mobile_app/src/merchants/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(merchants STATIC visited_merchant_history.cpp reviews.cpp) 2 | target_compile_features(merchants PUBLIC cxx_std_20) 3 | target_include_directories(merchants PUBLIC "${PROJECT_SOURCE_DIR}/include") 4 | target_include_directories( 5 | merchants PUBLIC "${PROJECT_SOURCE_DIR}/../../3rd-parties/SaferCPlusPlus") 6 | target_link_libraries(merchants PRIVATE Microsoft.GSL::GSL) 7 | -------------------------------------------------------------------------------- /Chapter10/mobile_app/src/merchants/visited_merchant_history.cpp: -------------------------------------------------------------------------------- 1 | #include "merchants/visited_merchant_history.h" 2 | 3 | std::size_t history_of_visited_merchants::add( 4 | std::unique_ptr merchant) { 5 | merchants_.push_back(std::move(merchant)); 6 | return merchants_.size() - 1; 7 | } 8 | 9 | void history_of_visited_merchants::rate(std::size_t merchant_index, 10 | stars new_rating) { 11 | auto &merchant = *merchants_[merchant_index]; 12 | if (merchant.get_rating() != new_rating) { 13 | merchant.post_rating(new_rating); 14 | } 15 | } 16 | 17 | const i_visited_merchant &history_of_visited_merchants::get_merchant( 18 | std::size_t merchant_index) { 19 | return *merchants_[merchant_index]; 20 | } 21 | -------------------------------------------------------------------------------- /Chapter11/conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | fmt/10.1.1 3 | benchmark/1.8.3 4 | 5 | [generators] 6 | CMakeDeps 7 | -------------------------------------------------------------------------------- /Chapter11/microbenchmarking/main_1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | using namespace std::ranges; 7 | 8 | namespace { 9 | 10 | template 11 | auto make_sorted_vector(std::size_t size) { 12 | auto sorted = std::vector{}; 13 | sorted.reserve(size); 14 | 15 | auto sorted_view = views::iota(T{0}) | views::take(size); 16 | std::ranges::copy(sorted_view, std::back_inserter(sorted)); 17 | return sorted; 18 | } 19 | 20 | constexpr auto MAX_HAYSTACK_SIZE = std::size_t{10'000'000}; 21 | constexpr auto NEEDLE = 2137; 22 | 23 | void binary_search_in_sorted_vector(benchmark::State &state) { 24 | auto haystack = make_sorted_vector(MAX_HAYSTACK_SIZE); 25 | for (auto _ : state) { 26 | benchmark::DoNotOptimize(lower_bound(haystack, NEEDLE)); 27 | } 28 | } 29 | 30 | void linear_search_in_sorted_vector(benchmark::State &state) { 31 | auto haystack = make_sorted_vector(MAX_HAYSTACK_SIZE); 32 | for (auto _ : state) { 33 | benchmark::DoNotOptimize(find(haystack, NEEDLE)); 34 | } 35 | } 36 | 37 | BENCHMARK(linear_search_in_sorted_vector); 38 | BENCHMARK(binary_search_in_sorted_vector); 39 | 40 | } // namespace 41 | 42 | BENCHMARK_MAIN(); 43 | -------------------------------------------------------------------------------- /Chapter11/microbenchmarking/main_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | using namespace std::ranges; 7 | 8 | namespace { 9 | 10 | template 11 | auto make_sorted_vector(std::size_t size) { 12 | auto sorted = std::vector{}; 13 | sorted.reserve(size); 14 | 15 | auto sorted_view = views::iota(T{0}) | views::take(size); 16 | std::ranges::copy(sorted_view, std::back_inserter(sorted)); 17 | return sorted; 18 | } 19 | 20 | constexpr auto MAX_HAYSTACK_SIZE = std::size_t{10'000'000}; 21 | constexpr auto NEEDLE = 2137; 22 | 23 | void search_in_sorted_vector(benchmark::State &state, auto finder) { 24 | auto haystack = make_sorted_vector(MAX_HAYSTACK_SIZE); 25 | for (auto _ : state) { 26 | benchmark::DoNotOptimize(finder(haystack, NEEDLE)); 27 | } 28 | } 29 | 30 | BENCHMARK_CAPTURE(search_in_sorted_vector, binary, lower_bound); 31 | BENCHMARK_CAPTURE(search_in_sorted_vector, linear, find); 32 | 33 | } // namespace 34 | 35 | BENCHMARK_MAIN(); 36 | -------------------------------------------------------------------------------- /Chapter11/microbenchmarking/main_3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | using namespace std::ranges; 7 | 8 | namespace { 9 | 10 | template 11 | auto make_sorted_vector(std::size_t size) { 12 | auto sorted = std::vector{}; 13 | sorted.reserve(size); 14 | 15 | auto sorted_view = views::iota(T{0}) | views::take(size); 16 | std::ranges::copy(sorted_view, std::back_inserter(sorted)); 17 | return sorted; 18 | } 19 | 20 | constexpr auto MIN_HAYSTACK_SIZE = std::size_t{1'000}; 21 | constexpr auto MAX_HAYSTACK_SIZE = std::size_t{10'000'000}; 22 | 23 | void search_in_sorted_vector(benchmark::State &state, auto finder) { 24 | const auto haystack = make_sorted_vector(state.range(0)); 25 | const auto needle = 2137; 26 | for (auto _ : state) { 27 | benchmark::DoNotOptimize(finder(haystack, needle)); 28 | } 29 | } 30 | 31 | BENCHMARK_CAPTURE(search_in_sorted_vector, binary, lower_bound) 32 | ->RangeMultiplier(10) 33 | ->Range(MIN_HAYSTACK_SIZE, MAX_HAYSTACK_SIZE); 34 | BENCHMARK_CAPTURE(search_in_sorted_vector, linear, find) 35 | ->RangeMultiplier(10) 36 | ->Range(MIN_HAYSTACK_SIZE, MAX_HAYSTACK_SIZE); 37 | 38 | } // namespace 39 | 40 | BENCHMARK_MAIN(); 41 | -------------------------------------------------------------------------------- /Chapter12/.envrc: -------------------------------------------------------------------------------- 1 | dotenv 2 | use_nix 3 | -------------------------------------------------------------------------------- /Chapter12/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import ( 2 | builtins.fetchTarball { 3 | url = "https://github.com/NixOS/nixpkgs/archive/21.11-pre.tar.gz"; 4 | sha256 = "0ww19c7n4fj9zn770aw8zaqld742bi9sa9s8hqb3vrgp3mpihil0"; 5 | } 6 | ) {} }: 7 | 8 | let 9 | additionalInputs = if pkgs.system == "x86_64-linux" then pkgs.lsb-release else ""; 10 | in 11 | with pkgs; { 12 | gcc11Env = stdenvNoCC.mkDerivation { 13 | name = "gcc11-environment"; 14 | buildInputs = [ 15 | ansible 16 | autoconf 17 | automake 18 | awscli 19 | clang 20 | cmake 21 | conan 22 | docker 23 | docker-compose 24 | doxygen 25 | gcc 26 | libtool 27 | lsb-release 28 | packer 29 | pkg-config 30 | pre-commit 31 | python3Packages.setuptools 32 | python3Packages.pip 33 | python3Packages.virtualenv 34 | terraform 35 | ]; 36 | shellHook = '' 37 | virtualenv venv 38 | source venv/bin/activate 39 | pip install sphinx sphinx-rtd-theme breathe m2r2 40 | ''; 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /Chapter12/env.example: -------------------------------------------------------------------------------- 1 | AWS_ACCESS_KEY_ID=access_key_id 2 | AWS_SECRET_ACCESS_KEY=secret_key 3 | DIGITALOCEAN_ACCESS_TOKEN=digitalocean_api_key 4 | -------------------------------------------------------------------------------- /Chapter12/kubernetes/merchant-manifest.yml: -------------------------------------------------------------------------------- 1 | image: sacpp/merchant:v2.0.3 2 | manifests: 3 | - image: sacpp/merchant:v2.0.3-amd64 4 | platform: 5 | architecture: amd64 6 | os: linux 7 | - image: sacpp/merchant:v2.0.3-arm32 8 | platform: 9 | architecture: arm 10 | os: linux 11 | - image: sacpp/merchant:v2.0.3-arm64 12 | platform: 13 | architecture: arm64 14 | os: linux 15 | -------------------------------------------------------------------------------- /Chapter12/packer/packer-digitalocean.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "do_api_token": "{{env `DIGITALOCEAN_ACCESS_TOKEN`}}", 4 | "region": "fra1", 5 | "package": "customer", 6 | "version": "1.0.3" 7 | }, 8 | "builders": [ 9 | { 10 | "type": "digitalocean", 11 | "api_token": "{{user `do_api_token`}}", 12 | "image": "ubuntu-20-04-x64", 13 | "region": "{{user `region`}}", 14 | "size": "s-1vcpu-1gb", 15 | "ssh_username": "root" 16 | } 17 | ], 18 | "provisioners": [ 19 | { 20 | "type": "file", 21 | "source": "./{{user `package`}}-{{user `version`}}.deb", 22 | "destination": "/tmp/{{user `package`}}-{{user `version`}}.deb" 23 | }, 24 | { 25 | "type": "shell", 26 | "inline": [ 27 | "dpkg -i /tmp/{{user `package`}}-{{user `version`}}.deb" 28 | ] 29 | } 30 | 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /Chapter12/rest/api-blueprint.md: -------------------------------------------------------------------------------- 1 | FORMAT: 1A 2 | 3 | # Items API overview 4 | 5 | # /item/{itemId} 6 | 7 | ## GET 8 | 9 | + Response 200 (application/json) 10 | 11 | { 12 | "itemId": 8, 13 | "name": "Kürtőskalács", 14 | "locationId": 5 15 | } 16 | -------------------------------------------------------------------------------- /Chapter12/rest/openapi.json: -------------------------------------------------------------------------------- 1 | { 2 | "openapi": "3.0.0", 3 | "info": { 4 | "title": "Items API overview", 5 | "version": "2.0.0" 6 | }, 7 | "paths": { 8 | "/item/{itemId}": { 9 | "get": { 10 | "operationId": "getItem", 11 | "summary": "get item details", 12 | "parameters": [ 13 | "name": "itemId", 14 | "description": "Item ID", 15 | "required": true, 16 | "schema": { 17 | "type": "string" 18 | } 19 | ], 20 | "responses": { 21 | "200": { 22 | "description": "200 response", 23 | "content": { 24 | "application/json": { 25 | "example": { 26 | "itemId": 8, 27 | "name": 28 | "Kürtőskalács", 29 | "locationId": 5 30 | } 31 | } 32 | } 33 | } 34 | } 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Chapter12/rest/raml.yaml: -------------------------------------------------------------------------------- 1 | #%RAML 1.0 2 | 3 | title: Items API overview 4 | version: 2.0.0 5 | 6 | annotationTypes: 7 | oas-summary: 8 | type: string 9 | allowedTargets: Method 10 | 11 | /item: 12 | get: 13 | displayName: getItem 14 | queryParameters: 15 | itemId: 16 | type: string 17 | responses: 18 | '200': 19 | body: 20 | application/json: 21 | example: | 22 | { 23 | "itemId": 8, 24 | "name", "Kürtőskalács", 25 | "locationId": 5 26 | } 27 | description: 200 response 28 | (oas-summary): get item details 29 | -------------------------------------------------------------------------------- /Chapter12/rpc/jsonrpc.json: -------------------------------------------------------------------------------- 1 | { 2 | "jsonrpc": "2.0", 3 | "method": "FindMerchants", 4 | "params": { 5 | "lat": "54.350989", 6 | "long": "18.6548168", 7 | "distance": 200 8 | }, 9 | "id": 1 10 | } 11 | -------------------------------------------------------------------------------- /Chapter12/rpc/soap.txt: -------------------------------------------------------------------------------- 1 | POST /FindMerchants HTTP/1.1 2 | Host: www.domifair.org 3 | Content-Type: application/soap+xml; charset=utf-8 4 | Content-Length: 345 5 | SOAPAction: "http://www.w3.org/2003/05/soap-envelope" 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 54.350989 14 | 18.6548168 15 | 200 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Chapter12/s3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | 3 | project( 4 | ch12 5 | VERSION 0.0.1 6 | LANGUAGES CXX) 7 | 8 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) 9 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 10 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 11 | 12 | find_program(CCACHE_PROGRAM ccache) 13 | if(CCACHE_PROGRAM) 14 | set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") 15 | endif() 16 | 17 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") 18 | list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}") 19 | 20 | find_package(aws-sdk-cpp REQUIRED) 21 | find_package(spdlog REQUIRED) 22 | 23 | add_executable(s3 s3.cpp) 24 | target_link_libraries(s3 PRIVATE aws-sdk-cpp::aws-sdk-cpp spdlog::spdlog) 25 | -------------------------------------------------------------------------------- /Chapter12/s3/conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | aws-sdk-cpp/1.7.212@kmaragon/stable 3 | spdlog/1.8.2 4 | 5 | [generators] 6 | CMakeDeps 7 | 8 | [options] 9 | aws-sdk-cpp:shared=True 10 | aws-sdk-cpp:build_s3=True 11 | -------------------------------------------------------------------------------- /Chapter13/cmake/CommonCompileFlags.cmake: -------------------------------------------------------------------------------- 1 | list( 2 | APPEND 3 | BASE_COMPILE_FLAGS 4 | "$<$,$,$>:-Wall;-Wextra;-pedantic;-Werror>" 5 | "$<$:/W4;/WX>") 6 | -------------------------------------------------------------------------------- /Chapter13/conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | boost/1.83.0 3 | grpc/1.54.3 4 | protobuf/3.21.12 5 | zlib/1.3 6 | 7 | [generators] 8 | CMakeDeps 9 | -------------------------------------------------------------------------------- /Chapter13/grpc/AsyncClient.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "grpc/service.grpc.pb.h" 6 | 7 | using grpc::ClientContext; 8 | using grpc::Status; 9 | 10 | int main() { 11 | std::string address("localhost:50000"); 12 | auto channel = 13 | grpc::CreateChannel(address, grpc::InsecureChannelCredentials()); 14 | auto stub = Greeter::NewStub(channel); 15 | 16 | GreetRequest request; 17 | request.set_name("World"); 18 | 19 | GreetResponse reply; 20 | ClientContext context; 21 | Status status = stub->Greet(&context, request, &reply); 22 | 23 | if (status.ok()) { 24 | std::cout << reply.reply() << '\n'; 25 | } else { 26 | std::cerr << "Error: " << status.error_code() << '\n'; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Chapter13/grpc/AsyncServer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "grpc/service.grpc.pb.h" 6 | 7 | using grpc::ServerBuilder; 8 | using grpc::ServerContext; 9 | using grpc::Status; 10 | using grpc::StatusCode; 11 | 12 | class GreeterImpl : public Greeter::Service { 13 | Status Greet(ServerContext *context, const GreetRequest *request, 14 | GreetResponse *reply) override { 15 | auto name = request->name(); 16 | if (name.empty()) { 17 | return Status(StatusCode::INVALID_ARGUMENT, "name is empty"); 18 | } 19 | reply->set_reply("Hello " + name); 20 | return Status::OK; 21 | } 22 | }; 23 | 24 | int main() { 25 | std::string address("localhost:50000"); 26 | GreeterImpl service; 27 | ServerBuilder builder; 28 | 29 | builder.AddListeningPort(address, grpc::InsecureServerCredentials()); 30 | builder.RegisterService(&service); 31 | 32 | auto server(builder.BuildAndStart()); 33 | server->Wait(); 34 | } 35 | -------------------------------------------------------------------------------- /Chapter13/grpc/service.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | service Greeter { 4 | rpc Greet(GreetRequest) returns (GreetResponse); 5 | } 6 | 7 | message GreetRequest { 8 | string name = 1; 9 | } 10 | 11 | message GreetResponse { 12 | string reply = 1; 13 | } 14 | -------------------------------------------------------------------------------- /Chapter13/redis/redis.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | int main() { 8 | try { 9 | auto stream = rediscpp::make_stream("localhost", "6379"); 10 | 11 | auto const key = "my_key"; 12 | 13 | auto response = rediscpp::execute(*stream, "set", key, 14 | "Some value for 'my_key'", "ex", "60"); 15 | 16 | std::cout << "Set key '" << key << "': " << response.as() 17 | << std::endl; 18 | 19 | response = rediscpp::execute(*stream, "get", key); 20 | std::cout << "Get key '" << key << "': " << response.as() 21 | << std::endl; 22 | } catch (std::exception const &e) { 23 | std::cerr << "Error: " << e.what() << std::endl; 24 | return EXIT_FAILURE; 25 | } 26 | return EXIT_SUCCESS; 27 | } 28 | -------------------------------------------------------------------------------- /Chapter14/.envrc: -------------------------------------------------------------------------------- 1 | dotenv 2 | use_nix 3 | -------------------------------------------------------------------------------- /Chapter14/containers/ansible-bender/bender.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Container image with ansible-bender 3 | hosts: all 4 | vars: 5 | ansible_bender: 6 | base_image: docker.io/python:3-buster 7 | 8 | target_image: 9 | name: dominican-compiler 10 | cmd: /usr/bin/gcc 11 | tasks: 12 | - name: Install Apt packages 13 | apt: 14 | pkg: 15 | - build-essential 16 | - gcc 17 | -------------------------------------------------------------------------------- /Chapter14/containers/buildah/buildah.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -x 4 | 5 | ctr=$(buildah from ubuntu:bionic) 6 | 7 | buildah run $ctr -- /bin/sh -c 'apt-get update && apt-get install -y build-essential gcc' 8 | 9 | buildah config --cmd '/usr/bin/gcc' "$ctr" 10 | 11 | buildah commit "$ctr" dominican-gcc 12 | 13 | buildah rm "$ctr" 14 | -------------------------------------------------------------------------------- /Chapter14/containers/docker/basic.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | 3 | RUN apt-get update && apt-get -y install build-essential gcc 4 | 5 | CMD /usr/bin/gcc 6 | -------------------------------------------------------------------------------- /Chapter14/containers/docker/compile.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | 3 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential gcc cmake git googletest python3-pip && \ 4 | pip3 install conan && conan profile new sacpp --detect && \ 5 | conan profile update settings.compiler.libcxx=libstdc++11 sacpp 6 | 7 | ADD . /usr/src 8 | 9 | WORKDIR /usr/src 10 | 11 | RUN mkdir build && \ 12 | cd build && \ 13 | conan install .. --build=missing -s build_type=Release -pr=sacpp && \ 14 | cmake .. -DCMAKE_BUILD_TYPE=Release && \ 15 | cmake --build . && \ 16 | cmake --install . 17 | 18 | CMD /usr/local/bin/customer 19 | -------------------------------------------------------------------------------- /Chapter14/containers/docker/multi-stage.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest AS builder 2 | 3 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential gcc cmake git googletest python3-pip && \ 4 | pip3 install conan && conan profile new sacpp --detect && \ 5 | conan profile update settings.compiler.libcxx=libstdc++11 sacpp 6 | 7 | ADD . /usr/src 8 | 9 | WORKDIR /usr/src 10 | 11 | RUN mkdir build && \ 12 | cd build && \ 13 | conan install .. --build=missing -s build_type=Release -pr=sacpp && \ 14 | cmake .. -DCMAKE_BUILD_TYPE=Release && \ 15 | cmake --build . 16 | 17 | FROM ubuntu:latest 18 | 19 | COPY --from=builder /usr/src/build/bin/customer /bin/customer 20 | 21 | CMD /bin/customer 22 | -------------------------------------------------------------------------------- /Chapter14/containers/docker/scratch.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | 3 | COPY customer /bin/customer 4 | VOLUME /tmp 5 | CMD ["/bin/customer"] 6 | -------------------------------------------------------------------------------- /Chapter14/orchestration/docker-compose/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | services: 3 | web: 4 | image: nginx 5 | ports: 6 | - "80:80" 7 | depends_on: 8 | - merchant 9 | merchant: 10 | image: sacpp/merchant:v2.0.3 11 | deploy: 12 | replicas: 3 13 | ports: 14 | - "8000" 15 | -------------------------------------------------------------------------------- /Chapter14/orchestration/nomad/merchant.nomad: -------------------------------------------------------------------------------- 1 | job "merchant" { 2 | datacenters = ["dc1"] 3 | type = "service" 4 | group "merchant" { 5 | count = 3 6 | task "merchant" { 7 | driver = "docker" 8 | config { 9 | image = "sacpp/merchant:v2.0.3" 10 | port_map { 11 | http = 8000 12 | } 13 | } 14 | resources { 15 | network { 16 | port "http" { 17 | static = 8000 18 | } 19 | } 20 | } 21 | service { 22 | name = "merchant" 23 | tags = ["dominican-front", "merchant"] 24 | port = "http" 25 | check { 26 | type = "tcp" 27 | interval = "10s" 28 | timeout = "2s" 29 | } 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Chapter14/orchestration/nomad/nginx.nomad: -------------------------------------------------------------------------------- 1 | job "web" { 2 | datacenters = ["dc1"] 3 | type = "service" 4 | group "nginx" { 5 | task "nginx" { 6 | driver = "docker" 7 | config { 8 | image = "nginx" 9 | port_map { 10 | http = 80 11 | } 12 | } 13 | resources { 14 | network { 15 | port "http" { 16 | static = 80 17 | } 18 | } 19 | } 20 | service { 21 | name = "nginx" 22 | tags = ["dominican-front", "web", "nginx"] 23 | port = "http" 24 | check { 25 | type = "tcp" 26 | interval = "10s" 27 | timeout = "2s" 28 | } 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Chapter15/customer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15...3.19) 2 | 3 | include(FetchContent) 4 | 5 | option(BUILD_TESTING OFF) 6 | 7 | FetchContent_Declare( 8 | jaeger-client-cpp 9 | GIT_REPOSITORY https://github.com/jaegertracing/jaeger-client-cpp.git 10 | GIT_TAG v0.7.0) 11 | 12 | FetchContent_MakeAvailable(jaeger-client-cpp) 13 | 14 | project( 15 | Customer 16 | VERSION 0.0.2 17 | LANGUAGES CXX) 18 | 19 | find_program(CCACHE_PROGRAM ccache) 20 | if(CCACHE_PROGRAM) 21 | set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") 22 | endif() 23 | 24 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") 25 | list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}") 26 | 27 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) 28 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 29 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 30 | 31 | find_package(Boost CONFIG REQUIRED EXACT 1.75.0) 32 | find_package(cpprestsdk CONFIG REQUIRED) 33 | 34 | add_subdirectory(src/customer) 35 | -------------------------------------------------------------------------------- /Chapter15/customer/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Packt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Chapter15/customer/README.md: -------------------------------------------------------------------------------- 1 | # Software Architecture with C++ 2 | Software Architecture with C++ by Packt Publishing 3 | 4 | For building instructions, refer to the README file in the root of this chapter's code. 5 | 6 | This file should be packed by CPack. 7 | -------------------------------------------------------------------------------- /Chapter15/customer/conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | cpprestsdk/2.10.18 3 | 4 | [generators] 5 | CMakeDeps 6 | -------------------------------------------------------------------------------- /Chapter15/customer/src/customer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(libcustomer lib.cpp) 2 | add_library(domifair::libcustomer ALIAS libcustomer) 3 | set_target_properties(libcustomer PROPERTIES OUTPUT_NAME customer) 4 | target_compile_features(libcustomer PUBLIC cxx_std_17) 5 | target_include_directories( 6 | libcustomer PUBLIC $ 7 | $) 8 | target_compile_definitions(libcustomer PUBLIC _TURN_OFF_PLATFORM_STRING 9 | )# see https://github.com/Microsoft/cpprestsdk/issues/230 10 | target_link_libraries(libcustomer PUBLIC cpprestsdk::cpprest) 11 | set_target_properties(libcustomer PROPERTIES CXX_EXTENSIONS OFF) 12 | target_link_libraries(libcustomer PRIVATE jaegertracing-static) 13 | 14 | add_executable(customer main.cpp) 15 | target_compile_features(customer PRIVATE cxx_std_17) 16 | target_link_libraries(customer PRIVATE libcustomer jaegertracing-static) 17 | set_target_properties(customer PROPERTIES CXX_EXTENSIONS OFF) 18 | -------------------------------------------------------------------------------- /Chapter15/customer/src/customer/lib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "customer/customer.h" 7 | 8 | using namespace ::web; 9 | using namespace ::web::http; 10 | using ::utility::string_t; 11 | 12 | auto responder::respond(const http_request &request, status_code status, 13 | const json::value &response) -> void { 14 | auto span = opentracing::Tracer::Global()->StartSpan("respond"); 15 | 16 | json::value resp; 17 | resp[string_t("status")] = json::value::number(status); 18 | resp[string_t("response")] = response; 19 | request.reply(status, resp); 20 | } 21 | 22 | auto responder::prepare_response( 23 | const std::string &name, 24 | const std::unique_ptr &parentSpan) 25 | -> std::pair { 26 | auto span = opentracing::Tracer::Global()->StartSpan( 27 | "prepare_response", {opentracing::ChildOf(&parentSpan->context())}); 28 | return {status_codes::OK, 29 | json::value::string(string_t("Hello, ") + name + "!")}; 30 | } 31 | -------------------------------------------------------------------------------- /Chapter15/customer/src/customer/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "customer/customer.h" 8 | 9 | using namespace ::web; 10 | using namespace ::web::http; 11 | using namespace std::literals; 12 | using ::utility::string_t; 13 | 14 | void setUpTracer() { 15 | // We want to read the sampling server configuration from the 16 | // environment variables 17 | auto config = jaegertracing::Config(); 18 | config.fromEnv(); 19 | // Jaeger provides us with ConsoleLogger and NullLogger 20 | auto tracer = jaegertracing::Tracer::make( 21 | "customer", config, jaegertracing::logging::consoleLogger()); 22 | opentracing::Tracer::InitGlobal( 23 | std::static_pointer_cast(tracer)); 24 | } 25 | 26 | int main() { 27 | using ::web::http::experimental::listener::http_listener; 28 | auto listener = http_listener{string_t("http://0.0.0.0:8080/customer")}; 29 | 30 | setUpTracer(); 31 | 32 | auto get_responder = responder{}; 33 | listener.support( 34 | methods::GET, // other verbs coming soon! 35 | [&](const auto &request) { handle_get(request, get_responder); }); 36 | 37 | listener.open().wait(); 38 | 39 | std::this_thread::sleep_for(60s); 40 | listener.close().wait(); 41 | } 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Packt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import ( 2 | builtins.fetchTarball { 3 | url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/24.05-pre.tar.gz"; 4 | sha256 = "1cfbkahcfj1hgh4v5nfqwivg69zks8d72n11m5513i0phkqwqcgh"; 5 | } 6 | ) {} }: 7 | 8 | let 9 | additionalInputs = if pkgs.system == "x86_64-linux" then pkgs.lsb-release else ""; 10 | in 11 | with pkgs; { 12 | gcc13Env = stdenvNoCC.mkDerivation { 13 | name = "gcc13-environment"; 14 | buildInputs = [ 15 | autoconf 16 | automake 17 | clang 18 | cmake 19 | conan 20 | docker 21 | docker-compose 22 | doxygen 23 | gcc13 24 | libtool 25 | pkg-config 26 | pre-commit 27 | additionalInputs 28 | ]; 29 | shellHook = '' 30 | pre-commit install -f --hook-type pre-commit 31 | ''; 32 | }; 33 | } 34 | --------------------------------------------------------------------------------