Archetype: cpp_service_app_host.hpp.mustache

Table of Contents

Host 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_host.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_HOST_HPP
#define {{full_name_upper}}_APP_HOST_HPP

#include <vector>
#include <string>
#include <ostream>
#include <boost/asio/awaitable.hpp>
#include "ores.logging/make_logger.hpp"
#include "{{full_name}}/export.hpp"

namespace {{namespace}}::app {

/**
 * @brief Provides hosting services to the application.
 */
class {{full_name_upper}}_EXPORT host {
private:
    inline static std::string_view logger_name = "{{full_name}}.app.host";

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

public:
    /**
     * @brief Executes the console workflow.
     */
    static boost::asio::awaitable<int> execute(const std::vector<std::string>& args,
        std::ostream& std_output, std::ostream& error_output,
        boost::asio::io_context& io_ctx);
};

}

#endif
{{/component}}

See also

Emacs 29.1 (Org mode 9.6.6)