From 357357ad7864dd78ac5132bbe7eac904b75d5be1 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 26 Feb 2014 10:12:25 +0100 Subject: [PATCH] Initialise string to type map --- src/ifcexpressparser/templates.py | 1 + src/ifcparse/Ifc2x3.cpp | 1 + src/ifcparse/Ifc4.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/ifcexpressparser/templates.py b/src/ifcexpressparser/templates.py index f9279d41f6..1f79263cbe 100644 --- a/src/ifcexpressparser/templates.py +++ b/src/ifcexpressparser/templates.py @@ -125,6 +125,7 @@ void %(schema_name)s::InitStringMap() { } Type::Enum Type::FromString(const std::string& s) { + if (string_map.empty()) InitStringMap(); std::map::const_iterator it = string_map.find(s); if ( it == string_map.end() ) throw IfcException("Unable to find find keyword in schema"); else return it->second; diff --git a/src/ifcparse/Ifc2x3.cpp b/src/ifcparse/Ifc2x3.cpp index b5e8b63ac2..8f9ca41b5f 100644 --- a/src/ifcparse/Ifc2x3.cpp +++ b/src/ifcparse/Ifc2x3.cpp @@ -1791,6 +1791,7 @@ void Ifc2x3::InitStringMap() { } Type::Enum Type::FromString(const std::string& s) { + if (string_map.empty()) InitStringMap(); std::map::const_iterator it = string_map.find(s); if ( it == string_map.end() ) throw IfcException("Unable to find find keyword in schema"); else return it->second; diff --git a/src/ifcparse/Ifc4.cpp b/src/ifcparse/Ifc4.cpp index 90e41e9fba..7cd2b98de8 100644 --- a/src/ifcparse/Ifc4.cpp +++ b/src/ifcparse/Ifc4.cpp @@ -2091,6 +2091,7 @@ void Ifc4::InitStringMap() { } Type::Enum Type::FromString(const std::string& s) { + if (string_map.empty()) InitStringMap(); std::map::const_iterator it = string_map.find(s); if ( it == string_map.end() ) throw IfcException("Unable to find find keyword in schema"); else return it->second;