11#include <wx/filename.h>
97 static std::map<T, std::string>&
GetMap()
99 static_assert( std::is_enum_v<T>,
"Template parameter T must be an enum type" );
101 static std::map<T, std::string> map = []()
103 std::map<T, std::string> result;
105 if constexpr( std::is_same_v<T, ODB_POLARITY> )
107 result[ODB_POLARITY::POSITIVE] =
"POSITIVE";
108 result[ODB_POLARITY::NEGATIVE] =
"NEGATIVE";
111 if constexpr( std::is_same_v<T, ODB_CONTEXT> )
113 result[ODB_CONTEXT::BOARD] =
"BOARD";
114 result[ODB_CONTEXT::MISC] =
"MISC";
117 if constexpr( std::is_same_v<T, ODB_TYPE> )
120 result[ODB_TYPE::UNDEFINED] =
"";
122 result[ODB_TYPE::SIGNAL] =
"SIGNAL";
123 result[ODB_TYPE::POWER_GROUND] =
"POWER_GROUND";
124 result[ODB_TYPE::DIELECTRIC] =
"DIELECTRIC";
125 result[ODB_TYPE::MIXED] =
"MIXED";
126 result[ODB_TYPE::SOLDER_MASK] =
"SOLDER_MASK";
127 result[ODB_TYPE::SOLDER_PASTE] =
"SOLDER_PASTE";
128 result[ODB_TYPE::SILK_SCREEN] =
"SILK_SCREEN";
129 result[ODB_TYPE::DRILL] =
"DRILL";
130 result[ODB_TYPE::ROUT] =
"ROUT";
131 result[ODB_TYPE::DOCUMENT] =
"DOCUMENT";
132 result[ODB_TYPE::COMPONENT] =
"COMPONENT";
133 result[ODB_TYPE::MASK] =
"MASK";
134 result[ODB_TYPE::CONDUCTIVE_PASTE] =
"CONDUCTIVE_PASTE";
137 if constexpr( std::is_same_v<T, ODB_SUBTYPE> )
139 result[ODB_SUBTYPE::COVERLAY] =
"COVERLAY";
140 result[ODB_SUBTYPE::COVERCOAT] =
"COVERCOAT";
141 result[ODB_SUBTYPE::STIFFENER] =
"STIFFENER";
142 result[ODB_SUBTYPE::BEND_AREA] =
"BEND_AREA";
143 result[ODB_SUBTYPE::FLEX_AREA] =
"FLEX_AREA";
144 result[ODB_SUBTYPE::RIGID_AREA] =
"RIGID_AREA";
145 result[ODB_SUBTYPE::PSA] =
"PSA";
146 result[ODB_SUBTYPE::SILVER_MASK] =
"SILVER_MASK";
147 result[ODB_SUBTYPE::CARBON_MASK] =
"CARBON_MASK";
150 if constexpr( std::is_same_v<T, ODB_DIELECTRIC_TYPE> )
152 result[ODB_DIELECTRIC_TYPE::NONE] =
"NONE";
153 result[ODB_DIELECTRIC_TYPE::PREPREG] =
"PREPREG";
154 result[ODB_DIELECTRIC_TYPE::CORE] =
"CORE";
157 if constexpr( std::is_same_v<T, ODB_FID_TYPE> )
159 result[ODB_FID_TYPE::COPPER] =
"C";
160 result[ODB_FID_TYPE::LAMINATE] =
"L";
161 result[ODB_FID_TYPE::HOLE] =
"H";
175 auto it = map.find( value );
176 if( it != map.end() )
182 throw std::out_of_range(
"Enum value not found in map" );
272 template <
typename T>
333 ODB_DRILL_TOOLS(
const wxString& aUnits,
const wxString& aThickness =
"0",
334 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)
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)