diff options
author | Andrew Geissler <andrewg@us.ibm.com> | 2016-11-15 09:30:09 -0600 |
---|---|---|
committer | Andrew Geissler <andrewg@us.ibm.com> | 2016-11-18 16:30:03 -0600 |
commit | efb31c454b311771fba97833be9747bf751759ab (patch) | |
tree | ada48f8bd2a0b5309160978441debf0696de5ab8 /tools/phosphor-logging | |
parent | 40cb653b00ce9ede294a7e2b4934c5716cdbf9cf (diff) | |
download | phosphor-logging-efb31c454b311771fba97833be9747bf751759ab.tar.gz phosphor-logging-efb31c454b311771fba97833be9747bf751759ab.zip |
Move header generation tool and templates to sub-directories
This is being done to prep for exporting the tools and
templates to be used by other repos
Change-Id: Ia93166ade2a0361eca86cde123875b95a44a1ef3
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
Diffstat (limited to 'tools/phosphor-logging')
-rw-r--r-- | tools/phosphor-logging/templates/elog-gen-template.mako.hpp | 61 | ||||
-rw-r--r-- | tools/phosphor-logging/templates/elog-lookup-template.mako.cpp | 25 |
2 files changed, 86 insertions, 0 deletions
diff --git a/tools/phosphor-logging/templates/elog-gen-template.mako.hpp b/tools/phosphor-logging/templates/elog-gen-template.mako.hpp new file mode 100644 index 0000000..cb7137d --- /dev/null +++ b/tools/phosphor-logging/templates/elog-gen-template.mako.hpp @@ -0,0 +1,61 @@ +## Note that this file is not auto generated, it is what generates the +## elog-gen.hpp file +// This file was autogenerated. Do not edit! +// See elog-gen.py for more details +#pragma once + +#include <tuple> +#include <type_traits> +#include "log.hpp" + +namespace phosphor +{ + +namespace logging +{ + + % for a in errors: +<% + namespaces = errors[a].split('.') + classname = namespaces.pop() +%>\ + % for s in namespaces: +namespace ${s} +{ + % endfor + +namespace _${classname} +{ + % for b in meta[a]: +struct ${b} +{ + static constexpr auto str = "${meta_data[b]['str']}"; + static constexpr auto str_short = "${meta_data[b]['str_short']}"; + using type = std::tuple<std::decay_t<decltype(str)>,${meta_data[b]['type']}>; + explicit constexpr ${b}(${meta_data[b]['type']} a) : _entry(entry(str, a)) {}; + type _entry; +}; + % endfor + +} // namespace _${classname} +<% meta_string = ', '.join(meta[a]) %> +struct ${classname} +{ + static constexpr auto err_code = "${errors[a]}"; + static constexpr auto err_msg = "${error_msg[errors[a]]}"; + static constexpr auto L = level::${error_lvl[errors[a]]}; + % for b in meta[a]: + using ${b} = _${classname}::${b}; + % endfor + using metadata_types = std::tuple<${meta_string}>; +}; + +% for s in reversed(namespaces): +} // namespace ${s} +% endfor + + % endfor + +} // namespace logging + +} // namespace phosphor diff --git a/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp b/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp new file mode 100644 index 0000000..a96760e --- /dev/null +++ b/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp @@ -0,0 +1,25 @@ +## Note that this file is not auto generated, it is what generates the +## elog-lookup.hpp file +// This file was autogenerated. Do not edit! +// See elog-gen.py for more details +#pragma once + +#include <map> +#include <vector> + +namespace phosphor +{ + +namespace logging +{ + +std::map<std::string,std::vector<std::string>> g_errMetaMap = { + % for a in errors: + <% meta_string = '\",\"'.join(meta[a]) %> \ + {"${errors[a]}",{"${meta_string}"}}, + % endfor +}; + +} // namespace logging + +} // namespace phosphor |