aboutsummaryrefslogtreecommitdiffstats
path: root/common/settings.h
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2019-03-25 16:24:02 +0000
committerGitHub <noreply@github.com>2019-03-25 16:24:02 +0000
commitc67b8259bb8b31ba3f6aa30c431fef222e5f2f65 (patch)
tree6f427acacd9545150ad82465dda0e6c3d130c1e2 /common/settings.h
parent0d064c05f91b548638530e6e159ca9f8aa0fa352 (diff)
parent25e3350675c091c2fb54e51c9fcb7e79bbe6e279 (diff)
downloadnextpnr-c67b8259bb8b31ba3f6aa30c431fef222e5f2f65.tar.gz
nextpnr-c67b8259bb8b31ba3f6aa30c431fef222e5f2f65.tar.bz2
nextpnr-c67b8259bb8b31ba3f6aa30c431fef222e5f2f65.zip
Merge pull request #219 from daveshah1/placer_heap
HeAP-based analytical placer
Diffstat (limited to 'common/settings.h')
-rw-r--r--common/settings.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/common/settings.h b/common/settings.h
index 0c4a67db..b57947c9 100644
--- a/common/settings.h
+++ b/common/settings.h
@@ -45,19 +45,30 @@ class Settings
return defaultValue;
}
- template <typename T> void set(const char *name, T value)
- {
- IdString id = ctx->id(name);
- auto pair = ctx->settings.emplace(id, std::to_string(value));
- if (!pair.second) {
- ctx->settings[pair.first->first] = value;
- }
- }
+ template <typename T> void set(const char *name, T value);
private:
Context *ctx;
};
+template <typename T> inline void Settings::set(const char *name, T value)
+{
+ IdString id = ctx->id(name);
+ auto pair = ctx->settings.emplace(id, std::to_string(value));
+ if (!pair.second) {
+ ctx->settings[pair.first->first] = value;
+ }
+}
+
+template <> inline void Settings::set<std::string>(const char *name, std::string value)
+{
+ IdString id = ctx->id(name);
+ auto pair = ctx->settings.emplace(id, value);
+ if (!pair.second) {
+ ctx->settings[pair.first->first] = value;
+ }
+}
+
NEXTPNR_NAMESPACE_END
#endif // SETTINGS_H