This library (WIP) provides the logic for creating software to automate the task of managing reservations in a hotel business.
This software requires a Unix based OS to build and run, currently it’s being developed and tested under Gentoo GNU/Linux and OpenBSD.
- A c++20 compiler (GCC or LLVM)
- The GNU Readline
- The sqlite C/C++ interface (“sqlite” backend)
- yaml-cpp which is a YAML parser and emitter in C++
- spdlog for logging
- The Catch2 test framework (for running unit tests)
- The sqlite3 cli (running integration tests for the “sqlite” backend)
- pybind11 for building the Python bindings
The project contains 2 different “Makefiles”, one for BSDMake Makefile and
one for GNUMake GNUmakefile.
This software supports two different back-ends for storing information:
- memory: for volatile data, everything is flushed after the process terminates
- sqlite: handles data persistence using sqlite
The “memory” backend is the default, since it’s very convenient for development. To change the backend, set the “BACKEND” variable to any of the supported backend names.
To build the in-memory backend (default):
make hch
make BACKEND=memory hch # set the backend explicitlyTo build with the sqlite backend support:
make BACKEND=sqlite hchTo clean the compiled code and test data, use the clean target.
make cleanNote: Take into account that changing the “BACKEND” requires you to clean and
rebuild the whole project.
This library provides symbol bindings for creating clients using the Python
language. To build the bindings use the bindings target.
make bindingsCheck out the bindings test file to see an example on how to use the bindings.
In order to run the tests, use the make’s test target.
make clean test # in-memory backend
make BACKEND=sqlite clean testTo run the tests for the Python bindings use the test_py target.
make test_py # in-memory
make BACKEND=sqlite clean test_pyBuilding hch will create an hch executable in the top directory of the
project.
If the executable was built with the “memory” backend, then it’ll load
a “mock” hotel by default. To get an idea of this mock see the HotelData.hh file.
On the other hand, if the executable was built with the “sqlite” backend, then
the database needs to be built before running hch, the database can be
generated using the database target:
make databaseBut if you want to create a “mock” hotel, in your database call the mockhotel
target instead:
make mockhotelNow it should be possible to execute the hch:
- As a single command
./hch list-rate --room=102 --- date: 2025-11-20 days: 1 total: 78.99 details: Balcony: 15 Base: 58.99 Capacity: 0 Wifi: 5 - As a REPL
$ ./hch --repl hch> set-room 101 hch[room 101]> record-guest --email=john.bedney@mail.com --- Guest: john.bedney@mail.com hch[room 101]> reserve --guest=john.bedney@mail.com --during=2026-02-05+3d --- Reservation: W-0001 hch[room 101]> unset-room hch> help --- Available commands: - cancel-reservation - checkin - checkout - exit - help - list-amenities - list-rate - list-reservations - quit - record-guest - reserve - set-room - show-reservation - unset-room
Setting the HCH_LOG_LEVEL environment variable to any of the following values,
will enable the application logging:
- debug
- info
- warning
- error
By default all the logging information is sent to stdout, but it can otherwise
be sent to a given file by setting HCH_LOG_FILE environment variable.