diff --git a/src/db/db/dbLayoutToNetlistFormatDefs.cc b/src/db/db/dbLayoutToNetlistFormatDefs.cc index 82f202af8..eabcaa83a 100644 --- a/src/db/db/dbLayoutToNetlistFormatDefs.cc +++ b/src/db/db/dbLayoutToNetlistFormatDefs.cc @@ -28,55 +28,56 @@ namespace db namespace l2n_std_format { const char *l2n_magic_string_cstr = "#%l2n-klayout"; - template<> DB_PUBLIC const std::string keys::l2n_magic_string (l2n_magic_string_cstr); - template<> DB_PUBLIC const std::string keys::l2n_magic_string (l2n_magic_string_cstr); - template<> DB_PUBLIC const std::string keys::version_key ("version"); - template<> DB_PUBLIC const std::string keys::description_key ("description"); - template<> DB_PUBLIC const std::string keys::top_key ("top"); - template<> DB_PUBLIC const std::string keys::unit_key ("unit"); - template<> DB_PUBLIC const std::string keys::layer_key ("layer"); - template<> DB_PUBLIC const std::string keys::class_key ("class"); - template<> DB_PUBLIC const std::string keys::connect_key ("connect"); - template<> DB_PUBLIC const std::string keys::global_key ("global"); - template<> DB_PUBLIC const std::string keys::circuit_key ("circuit"); - template<> DB_PUBLIC const std::string keys::net_key ("net"); - template<> DB_PUBLIC const std::string keys::name_key ("name"); - template<> DB_PUBLIC const std::string keys::device_key ("device"); - template<> DB_PUBLIC const std::string keys::polygon_key ("polygon"); - template<> DB_PUBLIC const std::string keys::rect_key ("rect"); - template<> DB_PUBLIC const std::string keys::terminal_key ("terminal"); - template<> DB_PUBLIC const std::string keys::abstract_key ("abstract"); - template<> DB_PUBLIC const std::string keys::param_key ("param"); - template<> DB_PUBLIC const std::string keys::location_key ("location"); - template<> DB_PUBLIC const std::string keys::rotation_key ("rotation"); - template<> DB_PUBLIC const std::string keys::mirror_key ("mirror"); - template<> DB_PUBLIC const std::string keys::scale_key ("scale"); - template<> DB_PUBLIC const std::string keys::pin_key ("pin"); + DB_PUBLIC std::string LongKeys::l2n_magic_string (l2n_magic_string_cstr); + DB_PUBLIC std::string ShortKeys::l2n_magic_string (l2n_magic_string_cstr); + + DB_PUBLIC std::string LongKeys::version_key ("version"); + DB_PUBLIC std::string LongKeys::description_key ("description"); + DB_PUBLIC std::string LongKeys::top_key ("top"); + DB_PUBLIC std::string LongKeys::unit_key ("unit"); + DB_PUBLIC std::string LongKeys::layer_key ("layer"); + DB_PUBLIC std::string LongKeys::class_key ("class"); + DB_PUBLIC std::string LongKeys::connect_key ("connect"); + DB_PUBLIC std::string LongKeys::global_key ("global"); + DB_PUBLIC std::string LongKeys::circuit_key ("circuit"); + DB_PUBLIC std::string LongKeys::net_key ("net"); + DB_PUBLIC std::string LongKeys::name_key ("name"); + DB_PUBLIC std::string LongKeys::device_key ("device"); + DB_PUBLIC std::string LongKeys::polygon_key ("polygon"); + DB_PUBLIC std::string LongKeys::rect_key ("rect"); + DB_PUBLIC std::string LongKeys::terminal_key ("terminal"); + DB_PUBLIC std::string LongKeys::abstract_key ("abstract"); + DB_PUBLIC std::string LongKeys::param_key ("param"); + DB_PUBLIC std::string LongKeys::location_key ("location"); + DB_PUBLIC std::string LongKeys::rotation_key ("rotation"); + DB_PUBLIC std::string LongKeys::mirror_key ("mirror"); + DB_PUBLIC std::string LongKeys::scale_key ("scale"); + DB_PUBLIC std::string LongKeys::pin_key ("pin"); // A, B, C, D, E, G, I, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y - template<> DB_PUBLIC const std::string keys::version_key ("V"); - template<> DB_PUBLIC const std::string keys::description_key ("B"); - template<> DB_PUBLIC const std::string keys::top_key ("W"); - template<> DB_PUBLIC const std::string keys::unit_key ("U"); - template<> DB_PUBLIC const std::string keys::layer_key ("L"); - template<> DB_PUBLIC const std::string keys::class_key ("K"); - template<> DB_PUBLIC const std::string keys::connect_key ("C"); - template<> DB_PUBLIC const std::string keys::global_key ("G"); - template<> DB_PUBLIC const std::string keys::circuit_key ("X"); - template<> DB_PUBLIC const std::string keys::net_key ("N"); - template<> DB_PUBLIC const std::string keys::name_key ("I"); - template<> DB_PUBLIC const std::string keys::device_key ("D"); - template<> DB_PUBLIC const std::string keys::polygon_key ("Q"); - template<> DB_PUBLIC const std::string keys::rect_key ("R"); - template<> DB_PUBLIC const std::string keys::terminal_key ("T"); - template<> DB_PUBLIC const std::string keys::abstract_key ("A"); - template<> DB_PUBLIC const std::string keys::param_key ("E"); - template<> DB_PUBLIC const std::string keys::location_key ("Y"); - template<> DB_PUBLIC const std::string keys::rotation_key ("O"); - template<> DB_PUBLIC const std::string keys::mirror_key ("M"); - template<> DB_PUBLIC const std::string keys::scale_key ("S"); - template<> DB_PUBLIC const std::string keys::pin_key ("P"); + DB_PUBLIC std::string ShortKeys::version_key ("V"); + DB_PUBLIC std::string ShortKeys::description_key ("B"); + DB_PUBLIC std::string ShortKeys::top_key ("W"); + DB_PUBLIC std::string ShortKeys::unit_key ("U"); + DB_PUBLIC std::string ShortKeys::layer_key ("L"); + DB_PUBLIC std::string ShortKeys::class_key ("K"); + DB_PUBLIC std::string ShortKeys::connect_key ("C"); + DB_PUBLIC std::string ShortKeys::global_key ("G"); + DB_PUBLIC std::string ShortKeys::circuit_key ("X"); + DB_PUBLIC std::string ShortKeys::net_key ("N"); + DB_PUBLIC std::string ShortKeys::name_key ("I"); + DB_PUBLIC std::string ShortKeys::device_key ("D"); + DB_PUBLIC std::string ShortKeys::polygon_key ("Q"); + DB_PUBLIC std::string ShortKeys::rect_key ("R"); + DB_PUBLIC std::string ShortKeys::terminal_key ("T"); + DB_PUBLIC std::string ShortKeys::abstract_key ("A"); + DB_PUBLIC std::string ShortKeys::param_key ("E"); + DB_PUBLIC std::string ShortKeys::location_key ("Y"); + DB_PUBLIC std::string ShortKeys::rotation_key ("O"); + DB_PUBLIC std::string ShortKeys::mirror_key ("M"); + DB_PUBLIC std::string ShortKeys::scale_key ("S"); + DB_PUBLIC std::string ShortKeys::pin_key ("P"); } } diff --git a/src/db/db/dbLayoutToNetlistFormatDefs.h b/src/db/db/dbLayoutToNetlistFormatDefs.h index 19fd221c5..aa54014f1 100644 --- a/src/db/db/dbLayoutToNetlistFormatDefs.h +++ b/src/db/db/dbLayoutToNetlistFormatDefs.h @@ -136,38 +136,78 @@ namespace db namespace l2n_std_format { - template - struct DB_PUBLIC keys + struct DB_PUBLIC ShortKeys { - static const std::string l2n_magic_string; + static std::string l2n_magic_string; - static const std::string version_key; - static const std::string description_key; - static const std::string top_key; - static const std::string unit_key; - static const std::string layer_key; - static const std::string class_key; - static const std::string connect_key; - static const std::string global_key; - static const std::string circuit_key; - static const std::string net_key; - static const std::string name_key; - static const std::string device_key; - static const std::string subcircuit_key; - static const std::string polygon_key; - static const std::string rect_key; - static const std::string terminal_key; - static const std::string abstract_key; - static const std::string param_key; - static const std::string location_key; - static const std::string rotation_key; - static const std::string mirror_key; - static const std::string scale_key; - static const std::string pin_key; - static const std::string indent1; - static const std::string indent2; + static std::string version_key; + static std::string description_key; + static std::string top_key; + static std::string unit_key; + static std::string layer_key; + static std::string class_key; + static std::string connect_key; + static std::string global_key; + static std::string circuit_key; + static std::string net_key; + static std::string name_key; + static std::string device_key; + static std::string subcircuit_key; + static std::string polygon_key; + static std::string rect_key; + static std::string terminal_key; + static std::string abstract_key; + static std::string param_key; + static std::string location_key; + static std::string rotation_key; + static std::string mirror_key; + static std::string scale_key; + static std::string pin_key; + static std::string indent1; + static std::string indent2; + }; - inline static bool is_short () { return Short; } + struct DB_PUBLIC LongKeys + { + static std::string l2n_magic_string; + + static std::string version_key; + static std::string description_key; + static std::string top_key; + static std::string unit_key; + static std::string layer_key; + static std::string class_key; + static std::string connect_key; + static std::string global_key; + static std::string circuit_key; + static std::string net_key; + static std::string name_key; + static std::string device_key; + static std::string subcircuit_key; + static std::string polygon_key; + static std::string rect_key; + static std::string terminal_key; + static std::string abstract_key; + static std::string param_key; + static std::string location_key; + static std::string rotation_key; + static std::string mirror_key; + static std::string scale_key; + static std::string pin_key; + static std::string indent1; + static std::string indent2; + }; + + template struct DB_PUBLIC keys; + + template <> struct DB_PUBLIC keys : public ShortKeys + { + inline static bool is_short () { return true; } + }; + + template <> struct DB_PUBLIC keys : public LongKeys + { + inline static bool is_short () { return false; } }; } diff --git a/src/db/db/dbLayoutVsSchematicFormatDefs.cc b/src/db/db/dbLayoutVsSchematicFormatDefs.cc index b58a53100..e61162fce 100644 --- a/src/db/db/dbLayoutVsSchematicFormatDefs.cc +++ b/src/db/db/dbLayoutVsSchematicFormatDefs.cc @@ -28,28 +28,28 @@ namespace db namespace lvs_std_format { const char *lvs_magic_string_cstr = "#%lvsdb-klayout"; - template<> DB_PUBLIC const std::string keys::lvs_magic_string (lvs_magic_string_cstr); - template<> DB_PUBLIC const std::string keys::lvs_magic_string (lvs_magic_string_cstr); + DB_PUBLIC std::string ShortKeys::lvs_magic_string (lvs_magic_string_cstr); + DB_PUBLIC std::string LongKeys::lvs_magic_string (lvs_magic_string_cstr); - template<> DB_PUBLIC const std::string keys::reference_key ("reference"); - template<> DB_PUBLIC const std::string keys::layout_key ("layout"); - template<> DB_PUBLIC const std::string keys::xref_key ("xref"); + DB_PUBLIC std::string ShortKeys::reference_key ("reference"); + DB_PUBLIC std::string ShortKeys::layout_key ("layout"); + DB_PUBLIC std::string ShortKeys::xref_key ("xref"); - template<> DB_PUBLIC const std::string keys::mismatch_key ("mismatch"); - template<> DB_PUBLIC const std::string keys::match_key ("match"); - template<> DB_PUBLIC const std::string keys::nomatch_key ("nomatch"); - template<> DB_PUBLIC const std::string keys::warning_key ("warning"); - template<> DB_PUBLIC const std::string keys::skipped_key ("skipped"); + DB_PUBLIC std::string ShortKeys::mismatch_key ("mismatch"); + DB_PUBLIC std::string ShortKeys::match_key ("match"); + DB_PUBLIC std::string ShortKeys::nomatch_key ("nomatch"); + DB_PUBLIC std::string ShortKeys::warning_key ("warning"); + DB_PUBLIC std::string ShortKeys::skipped_key ("skipped"); - template<> DB_PUBLIC const std::string keys::reference_key ("H"); - template<> DB_PUBLIC const std::string keys::layout_key ("J"); - template<> DB_PUBLIC const std::string keys::xref_key ("Z"); + DB_PUBLIC std::string LongKeys::reference_key ("H"); + DB_PUBLIC std::string LongKeys::layout_key ("J"); + DB_PUBLIC std::string LongKeys::xref_key ("Z"); - template<> DB_PUBLIC const std::string keys::mismatch_key ("0"); - template<> DB_PUBLIC const std::string keys::match_key ("1"); - template<> DB_PUBLIC const std::string keys::nomatch_key ("X"); - template<> DB_PUBLIC const std::string keys::warning_key ("W"); - template<> DB_PUBLIC const std::string keys::skipped_key ("S"); + DB_PUBLIC std::string LongKeys::mismatch_key ("0"); + DB_PUBLIC std::string LongKeys::match_key ("1"); + DB_PUBLIC std::string LongKeys::nomatch_key ("X"); + DB_PUBLIC std::string LongKeys::warning_key ("W"); + DB_PUBLIC std::string LongKeys::skipped_key ("S"); } } diff --git a/src/db/db/dbLayoutVsSchematicFormatDefs.h b/src/db/db/dbLayoutVsSchematicFormatDefs.h index d96c48015..1b69e0fe1 100644 --- a/src/db/db/dbLayoutVsSchematicFormatDefs.h +++ b/src/db/db/dbLayoutVsSchematicFormatDefs.h @@ -121,25 +121,48 @@ namespace db namespace lvs_std_format { - template - struct DB_PUBLIC keys - : public l2n_std_format::keys + struct DB_PUBLIC ShortKeys { - typedef l2n_std_format::keys l2n_keys; + static std::string lvs_magic_string; - static const std::string lvs_magic_string; + static std::string reference_key; + static std::string layout_key; + static std::string xref_key; - static const std::string reference_key; - static const std::string layout_key; - static const std::string xref_key; + static std::string mismatch_key; + static std::string match_key; + static std::string nomatch_key; + static std::string warning_key; + static std::string skipped_key; + }; - static const std::string mismatch_key; - static const std::string match_key; - static const std::string nomatch_key; - static const std::string warning_key; - static const std::string skipped_key; + struct DB_PUBLIC LongKeys + { + static std::string lvs_magic_string; - inline static bool is_short () { return Short; } + static std::string reference_key; + static std::string layout_key; + static std::string xref_key; + + static std::string mismatch_key; + static std::string match_key; + static std::string nomatch_key; + static std::string warning_key; + static std::string skipped_key; + }; + + template struct DB_PUBLIC keys; + + template <> struct DB_PUBLIC keys : public l2n_std_format::keys, public ShortKeys + { + typedef l2n_std_format::keys l2n_keys; + inline static bool is_short () { return true; } + }; + + template <> struct DB_PUBLIC keys : public l2n_std_format::keys, public LongKeys + { + typedef l2n_std_format::keys l2n_keys; + inline static bool is_short () { return false; } }; }