Archetype: cpp_service_app_application.hpp.mustache

Table of Contents

Application class declarations. component-service profile.

See the Template variable reference for the complete list of available variables and their semantics.

Template

The full template source. Edit here and re-tangle with compass build --direct tangle_codegen_templates to regenerate library/templates/cpp_service_app_application.hpp.mustache.

{{! GENERATED FILE — tangled from projects/ores.codegen/library/templates/cpp_service_app.org. Edit the org source. }}
{{{cpp_license}}}
{{#component}}
#ifndef {{full_name_upper}}_APP_APPLICATION_HPP
#define {{full_name_upper}}_APP_APPLICATION_HPP

#include <boost/asio/awaitable.hpp>
#include "ores.logging/make_logger.hpp"
#include "ores.database/domain/context.hpp"
#include "ores.database/domain/database_options.hpp"
#include "{{full_name}}/config/options.hpp"

namespace {{namespace}}::app {

/**
 * @brief Entry point for the {{full_name}} service.
 */
class application final {
private:
    inline static std::string_view logger_name = "{{full_name}}.app.application";

    static auto& lg() {
        using namespace ores::logging;
        static auto instance = make_logger(logger_name);
        return instance;
    }

public:
    application();
    application(const application&) = delete;
    application& operator=(const application&) = delete;

private:
    static ores::database::context
    make_context(const ores::database::database_options& db_opts);

public:
    boost::asio::awaitable<void> run(boost::asio::io_context& io_ctx,
        const config::options& cfg) const;
};

}

#endif
{{/component}}

See also

Emacs 29.1 (Org mode 9.6.6)