/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2019, Google Inc.
 *
 * {{mode}} ID list
 *
 * This file is auto-generated. Do not edit.
 */

#include <libcamera/{{filename}}.h>
#include <libcamera/controls.h>

/**
 * \file {{filename}}.h
 * \brief Camera {{mode}} identifiers
 */

namespace libcamera {

/**
 * \brief Namespace for libcamera {{mode}}
 */
namespace {{mode}} {

{%- for vendor, ctrls in controls -%}

{%- if vendor != 'libcamera' %}
/**
 * \brief Namespace for {{vendor}} {{mode}}
 */
namespace {{vendor}} {
{%- endif -%}

{% for ctrl in ctrls %}

{% if ctrl.is_enum -%}
/**
 * \enum {{ctrl.name}}Enum
 * \brief Supported {{ctrl.name}} values
{%- for enum in ctrl.enum_values %}
 *
 * \var {{enum.name}}
 * \brief {{enum.description|format_description}}
{%- endfor %}
 */

/**
 * \var {{ctrl.name}}Values
 * \brief List of all {{ctrl.name}} supported values
 */

/**
 * \var {{ctrl.name}}NameValueMap
 * \brief Map of all {{ctrl.name}} supported value names (in std::string format) to value
 */

{% endif -%}
/**
 * \var {{ctrl.name}}
 * \brief {{ctrl.description|format_description}}
 */
{%- endfor %}
{% if vendor != 'libcamera' %}
} /* namespace {{vendor}} */
{% endif -%}

{%- endfor %}

#ifndef __DOXYGEN__
/*
 * Keep the {{mode}} definitions hidden from doxygen as it incorrectly parses
 * them as functions.
 */
{% for vendor, ctrls in controls -%}

{% if vendor != 'libcamera' %}
namespace {{vendor}} {
{% endif %}

{%- for ctrl in ctrls %}
{% if ctrl.is_enum -%}
extern const std::array<const ControlValue, {{ctrl.enum_values_count}}> {{ctrl.name}}Values = {
{%- for enum in ctrl.enum_values %}
	static_cast<{{ctrl.type}}>({{enum.name}}),
{%- endfor %}
};
extern const std::map<std::string, {{ctrl.type}}> {{ctrl.name}}NameValueMap = {
{%- for enum in ctrl.enum_values %}
	{ "{{enum.name}}", {{enum.name}} },
{%- endfor %}
};
extern const Control<{{ctrl.type}}> {{ctrl.name}}({{ctrl.name|snake_case|upper}}, "{{ctrl.name}}", "{{vendor}}", {{ctrl.direction}}, {{ctrl.name}}NameValueMap);
{% else -%}
extern const Control<{{ctrl.type}}> {{ctrl.name}}({{ctrl.name|snake_case|upper}}, "{{ctrl.name}}", "{{vendor}}", {{ctrl.direction}});
{% endif -%}
{%- endfor %}

{% if vendor != 'libcamera' %}
} /* namespace {{vendor}} */
{% endif -%}

{%- endfor %}
#endif /* __DOXYGEN__ */

/**
 * \brief List of all supported libcamera {{mode}}
{%- if mode == 'controls' %}
 *
 * Unless otherwise stated, all controls are bi-directional, i.e. they can be
 * set through Request::controls() and returned out through Request::metadata().
{%- endif %}
 */
extern const ControlIdMap {{mode}} {
{%- for vendor, ctrls in controls -%}
{%- for ctrl in ctrls %}
	{ {{ctrl.namespace}}{{ctrl.name|snake_case|upper}}, &{{ctrl.namespace}}{{ctrl.name}} },
{%- endfor -%}
{%- endfor %}
};

} /* namespace {{mode}} */

} /* namespace libcamera */
