cpp-transport-catalogue
Loading...
Searching...
No Matches
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:

Preparation:

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 -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release --target doxygen

Example usage:

  • Input request (1), which adds some objects to database and asks to print corresponding map
  • Answer (1), containing SVG map as string
    # 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

Input request (2), which asks to find fastest path between stops

  • Answer (2), contains travel time and path description in items keys

Documentation

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