aboutsummaryrefslogtreecommitdiffstats
path: root/common/settings.h
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-03-24 11:10:20 +0000
committerDavid Shah <dave@ds0.me>2019-03-24 11:10:20 +0000
commit02ae21d8fc3bc1375848f40702cd4bb7f6700595 (patch)
treedb9e1fc5f4329285c9c5c5a5eb1c615418530138 /common/settings.h
parent52e05f4a0706b1c108221e600ff11e654f6e85a5 (diff)
downloadnextpnr-02ae21d8fc3bc1375848f40702cd4bb7f6700595.tar.gz
nextpnr-02ae21d8fc3bc1375848f40702cd4bb7f6700595.tar.bz2
nextpnr-02ae21d8fc3bc1375848f40702cd4bb7f6700595.zip
Add --placer option and refactor placer selection
Signed-off-by: David Shah <dave@ds0.me>
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