From 136f205fb3329fb976c029d7f1aecd7d37f47fe8 Mon Sep 17 00:00:00 2001 From: hbristow Date: Wed, 26 Jun 2013 17:41:35 -0700 Subject: [PATCH] added handling of constants equaling constants for C++ map --- modules/matlab/generator/gen_matlab.py | 1 - modules/matlab/generator/templates/template_map_base.cpp | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/matlab/generator/gen_matlab.py b/modules/matlab/generator/gen_matlab.py index 2b317a6782..b132a819db 100644 --- a/modules/matlab/generator/gen_matlab.py +++ b/modules/matlab/generator/gen_matlab.py @@ -33,7 +33,6 @@ class MatlabWrapperGenerator(object): jtemplate.filters['void'] = void jtemplate.filters['not'] = flip - # load the templates tfunction = jtemplate.get_template('template_function_base.cpp') tclassm = jtemplate.get_template('template_class_base.m') diff --git a/modules/matlab/generator/templates/template_map_base.cpp b/modules/matlab/generator/templates/template_map_base.cpp index 0d39d7165f..791b2c93a3 100644 --- a/modules/matlab/generator/templates/template_map_base.cpp +++ b/modules/matlab/generator/templates/template_map_base.cpp @@ -22,6 +22,10 @@ typedef std::unordered_map Map; */ Map constants = { {% for key, val in constants.items() %} + {% if val|convertibleToInt %} { "{{key}}", {{val}} }, + {% else %} + { "{{key}}", {{constants[val]}} }, + {% endif %} {% endfor %} };