Skip to content

jys1670/cpp-transport-catalogue

Repository files navigation

Transport Catalogue

C++ version Building on Linux Building on Windows Linux CI

This repository is an implementation of simplistic public transport navigator. As of now, there is only JSON input/output interface which is briefly described here.

Structure

.
├── cmake
│   ├── CompileOptions.cmake
│   └── Docs.cmake
├── docs
│   ├── examples
│   ├── html
│   ├── latex
│   ├── Doxyfile
│   ├── index.html
│   └── json.md
├── proto
│   ├── graph.proto
│   ├── map_renderer.proto
│   ├── svg.proto
│   ├── transport_catalogue.proto
│   └── transport_router.proto
├── tests
│   ├── CMakeLists.txt
│   ├── test.cpp
│   ├── timetest_input.json
│   └── timetest_output.json
├── transport-catalogue
│   ├── CMakeLists.txt
│   ├── domain.cpp
│   ├── domain.h
│   ├── geo.cpp
│   ├── geo.h
│   ├── graph.h
│   ├── json_builder.cpp
│   ├── json_builder.h
│   ├── json.cpp
│   ├── json.h
│   ├── json_reader.cpp
│   ├── json_reader.h
│   ├── main.cpp
│   ├── map_renderer.cpp
│   ├── map_renderer.h
│   ├── request_handler.cpp
│   ├── request_handler.h
│   ├── router.h
│   ├── serialization.cpp
│   ├── serialization.h
│   ├── svg.cpp
│   ├── svg.h
│   ├── transport_catalogue.cpp
│   ├── transport_catalogue.h
│   ├── transport_router.cpp
│   └── transport_router.h
├── CMakeLists.txt
└── README.md

Building:

Requirements:

  • GCC or alternative (supporting C++17 or later)
  • Cmake (tested with 3.21)
  • Protobuf (static version by default) (tested with 3.21.7)
  • [optional] Boost (tested with 1.80.0)
  • [optional] Doxygen (tested with 1.9.5)

Preparations:

git clone https://github.com/jys1670/cpp-transport-catalogue.git
cd cpp-transport-catalogue
mkdir build && cd build

Building and running main executable:

cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release --target main
cd bin
./main [make_base|process_requests] ...

Building and running unit tests (requires Boost):

cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=ON ..
cmake --build . --config Release --target unit_tests
cd bin
./unit_tests

Updating documentation:

cmake --build . --config Release --target doxygen

Example usage:

# parse input, generate database and save it as file
# (to avoid regeneration of database stat_requests 
# are processed separately in "process_requests" mode)
./main make_base < map_input.json
# use existing database and process stat_requests
./main process_requests < map_input.json > map_output.json

example-map

Documentation

You can check it out here (incomplete): Transport-Catalogue-Documentation.