11#include <wx/filename.h>
99 static std::map<T, std::string>&
GetMap()
101 static_assert( std::is_enum_v<T>,
"Template parameter T must be an enum type" );
103 static std::map<T, std::string> map = []()
105 std::map<T, std::string> result;
107 if constexpr( std::is_same_v<T, ODB_POLARITY> )
109 result[ODB_POLARITY::POSITIVE] =
"POSITIVE";
110 result[ODB_POLARITY::NEGATIVE] =
"NEGATIVE";
113 if constexpr( std::is_same_v<T, ODB_CONTEXT> )
115 result[ODB_CONTEXT::BOARD] =
"BOARD";
116 result[ODB_CONTEXT::MISC] =
"MISC";
119 if constexpr( std::is_same_v<T, ODB_TYPE> )
122 result[ODB_TYPE::UNDEFINED] =
"";
124 result[ODB_TYPE::SIGNAL] =
"SIGNAL";
125 result[ODB_TYPE::POWER_GROUND] =
"POWER_GROUND";
126 result[ODB_TYPE::DIELECTRIC] =
"DIELECTRIC";
127 result[ODB_TYPE::MIXED] =
"MIXED";
128 result[ODB_TYPE::SOLDER_MASK] =
"SOLDER_MASK";
129 result[ODB_TYPE::SOLDER_PASTE] =
"SOLDER_PASTE";
130 result[ODB_TYPE::SILK_SCREEN] =
"SILK_SCREEN";
131 result[ODB_TYPE::DRILL] =
"DRILL";
132 result[ODB_TYPE::ROUT] =
"ROUT";
133 result[ODB_TYPE::DOCUMENT] =
"DOCUMENT";
134 result[ODB_TYPE::COMPONENT] =
"COMPONENT";
135 result[ODB_TYPE::MASK] =
"MASK";
136 result[ODB_TYPE::CONDUCTIVE_PASTE] =
"CONDUCTIVE_PASTE";
139 if constexpr( std::is_same_v<T, ODB_SUBTYPE> )
141 result[ODB_SUBTYPE::COVERLAY] =
"COVERLAY";
142 result[ODB_SUBTYPE::COVERCOAT] =
"COVERCOAT";
143 result[ODB_SUBTYPE::STIFFENER] =
"STIFFENER";
144 result[ODB_SUBTYPE::BEND_AREA] =
"BEND_AREA";
145 result[ODB_SUBTYPE::FLEX_AREA] =
"FLEX_AREA";
146 result[ODB_SUBTYPE::RIGID_AREA] =
"RIGID_AREA";
147 result[ODB_SUBTYPE::PSA] =
"PSA";
148 result[ODB_SUBTYPE::SILVER_MASK] =
"SILVER_MASK";
149 result[ODB_SUBTYPE::CARBON_MASK] =
"CARBON_MASK";
152 if constexpr( std::is_same_v<T, ODB_DIELECTRIC_TYPE> )
154 result[ODB_DIELECTRIC_TYPE::NONE] =
"NONE";
155 result[ODB_DIELECTRIC_TYPE::PREPREG] =
"PREPREG";
156 result[ODB_DIELECTRIC_TYPE::CORE] =
"CORE";
159 if constexpr( std::is_same_v<T, ODB_FID_TYPE> )
161 result[ODB_FID_TYPE::COPPER] =
"C";
162 result[ODB_FID_TYPE::LAMINATE] =
"L";
163 result[ODB_FID_TYPE::HOLE] =
"H";
177 auto it = map.find( value );
178 if( it != map.end() )
184 throw std::out_of_range(
"Enum value not found in map" );
274 template <
typename T>
335 ODB_DRILL_TOOLS(
const wxString& aUnits,
const wxString& aThickness =
"0",
336 const wxString& aUserParams = wxEmptyString );
static std::map< T, std::string > & GetMap()
void CreateFile(const wxString &aFileName)
ODB_FILE_WRITER & operator=(ODB_FILE_WRITER const &)=delete
ODB_TREE_WRITER & m_treeWriter
ODB_FILE_WRITER(ODB_FILE_WRITER &&)=delete
virtual ~ODB_FILE_WRITER()
ODB_FILE_WRITER & operator=(ODB_FILE_WRITER &&)=delete
ODB_FILE_WRITER(ODB_FILE_WRITER const &)=delete
std::ostream & GetStream()
ARRAY_PROXY(ARRAY_PROXY &&)=delete
ARRAY_PROXY & operator=(ARRAY_PROXY const &)=delete
ARRAY_PROXY & operator=(ARRAY_PROXY &&)=delete
ARRAY_PROXY(ARRAY_PROXY const &)=delete
ODB_TEXT_WRITER & m_writer
void WriteEquationLine(const std::string &var, int value)
ARRAY_PROXY MakeArrayProxy(const std::string &aStr)
virtual ~ODB_TEXT_WRITER()
void write_line_enum(const std::string &var, const T &value)
ODB_TEXT_WRITER(std::ostream &aStream)
void BeginArray(const std::string &a)
const wxString GetRootPath() const
void CreateEntityDirectory(const wxString &aPareDir, const wxString &aSubDir=wxEmptyString)
ODB_FILE_WRITER CreateFileProxy(const wxString &aFileName)
void SetRootPath(const wxString &aDir)
ODB_TREE_WRITER(const wxString &aPareDir, const wxString &aSubDir)
virtual ~ODB_TREE_WRITER()
void SetCurrentPath(const wxString &aDir)
const wxString GetCurrentPath() const
ODB_TREE_WRITER(const wxString &aDir)
std::string Enum2String(T value)
wxString Data2String(double aVal)
void RemoveWhitespace(wxString &aStr)
wxString GenODBString(const wxString &aStr)
std::pair< wxString, wxString > AddXY(const VECTOR2I &aVec)
wxString GenLegalEntityName(const wxString &aStr)
wxString GenLegalNetName(const wxString &aStr)
wxString Double2String(double aVal)
wxString SymDouble2String(double aVal)
VECTOR2I GetShapePosition(const PCB_SHAPE &aShape)