\doxysection{Factory.\+hpp}
\hypertarget{Factory_8hpp_source}{}\label{Factory_8hpp_source}\index{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/Loaders/Factory.hpp@{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/Loaders/Factory.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#ifndef\ GYM\_PCB\_LOADERS\_FACTORY\_H}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#define\ GYM\_PCB\_LOADERS\_FACTORY\_H}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ "{}Py.hpp"{}}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ "{}Units.hpp"{}}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ "{}Math/Misc.hpp"{}}}
\DoxyCodeLine{00008\ \textcolor{preprocessor}{\#include\ "{}Loaders/Topology.hpp"{}}}
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <cstdint>}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ <map>}}
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#include\ <set>}}
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#include\ <string>}}
\DoxyCodeLine{00013\ }
\DoxyCodeLine{00014\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classPCBoard}{PCBoard}};}
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classNetOverrides}{NetOverrides}}}
\DoxyCodeLine{00017\ \{}
\DoxyCodeLine{00018\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00019\ \ \ \ \ \textcolor{keywordtype}{void}\ load(PyObject\ *);}
\DoxyCodeLine{00020\ \ \ \ \ Micrometers\ traceWidth(\textcolor{keyword}{const}\ std::string\ \&net,\ Micrometers)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00021\ \ \ \ \ Micrometers\ viaDiameter(\textcolor{keyword}{const}\ std::string\ \&net,\ Micrometers)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00022\ \ \ \ \ Micrometers\ clearance(\textcolor{keyword}{const}\ std::string\ \&net,\ Micrometers)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00023\ \ \ \ \ std::string\ str()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00024\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00025\ \ \ \ \ std::map<Micrometers,\ Micrometers>\ mTraceWidths;}
\DoxyCodeLine{00026\ \ \ \ \ std::map<Micrometers,\ Micrometers>\ mViaDiameters;}
\DoxyCodeLine{00027\ \ \ \ \ std::map<Micrometers,\ Micrometers>\ mClearances;}
\DoxyCodeLine{00028\ \ \ \ \ std::map<std::string,\ Micrometers>\ mNetTraceWidths;}
\DoxyCodeLine{00029\ \ \ \ \ std::map<std::string,\ Micrometers>\ mNetViaDiameters;}
\DoxyCodeLine{00030\ \ \ \ \ std::map<std::string,\ Micrometers>\ mNetClearances;}
\DoxyCodeLine{00031\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00032\ \ \ \ \ \textcolor{keywordtype}{void}\ set(std::map<std::string,\ Micrometers>\&,}
\DoxyCodeLine{00033\ \ \ \ \ \ \ \ \ \ \ \ \ \ std::map<Micrometers,\ Micrometers>\&,\ PyObject\ *);}
\DoxyCodeLine{00034\ \};}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ \textcolor{keyword}{class\ }PCBFactory}
\DoxyCodeLine{00037\ \{}
\DoxyCodeLine{00038\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00039\ \ \ \ \ PCBFactory();}
\DoxyCodeLine{00040\ \ \ \ \ \textcolor{keyword}{const}\ std::string\&\ getData()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mData;\ \}}
\DoxyCodeLine{00041\ \ \ \ \ \mbox{\hyperlink{classPCBoard}{PCBoard}}\ *create(\textcolor{keyword}{const}\ std::string\ \&data);}
\DoxyCodeLine{00042\ \ \ \ \ \mbox{\hyperlink{classPCBoard}{PCBoard}}\ *loadAndCreate(\textcolor{keyword}{const}\ std::string\ \&filePath);}
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keywordtype}{void}\ setUnitLength\_nm(Nanometers\ nm)\ \{\ mUnitLength\_nm\ =\ nm;\ \}}
\DoxyCodeLine{00044\ \ \ \ \ Nanometers\ getUnitLength\_nm(Nanometers\ Default)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ (mUnitLength\_nm.value()\ >\ 0.0)\ ?\ mUnitLength\_nm\ :\ Default;\ \}}
\DoxyCodeLine{00045\ \ \ \ \ \textcolor{keywordtype}{void}\ setForceDesignRes(\textcolor{keywordtype}{bool}\ b)\ \{\ mForceDesignRes\ =\ b;\ \}}
\DoxyCodeLine{00046\ \ \ \ \ \textcolor{keywordtype}{bool}\ designResForced()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mForceDesignRes;\ \}}
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keywordtype}{void}\ setFixedTrackParams(\textcolor{keywordtype}{bool}\ b)\ \{\ mFixedTrackParams\ =\ b;\ \}}
\DoxyCodeLine{00048\ \ \ \ \ Real\ hasFixedTrackParams()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mFixedTrackParams;\ \}}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keywordtype}{void}\ setNetOverrides(PyObject\ *over)\ \{\ mNetOverrides.load(over);\ \}}
\DoxyCodeLine{00050\ \ \ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{classNetOverrides}{NetOverrides}}\&\ getNetOverrides()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mNetOverrides;\ \}}
\DoxyCodeLine{00051\ \ \ \ \ \textcolor{keywordtype}{void}\ setTopologies(PyObject\ *);}
\DoxyCodeLine{00052\ \ \ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{structNetTopology}{NetTopology}}\ *getTopology(\textcolor{keyword}{const}\ std::string\ \&net)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00053\ \ \ \ \ \textcolor{keywordtype}{void}\ setAutocreateConnections(\textcolor{keywordtype}{bool}\ b)\ \{\ mAutocreateConnections\ =\ b;\ \}}
\DoxyCodeLine{00054\ \ \ \ \ \textcolor{keywordtype}{bool}\ autocreateConnections()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mAutocreateConnections;\ \}}
\DoxyCodeLine{00055\ \ \ \ \ \textcolor{keywordtype}{void}\ setLockRoutedConnections(\textcolor{keywordtype}{bool}\ b)\ \{\ mLockRoutedConnections\ =\ b;\ \}}
\DoxyCodeLine{00056\ \ \ \ \ \textcolor{keywordtype}{void}\ setLoadFanout(\textcolor{keywordtype}{bool}\ b)\ \{\ mLoadFanout\ =\ b;\ \}}
\DoxyCodeLine{00057\ \ \ \ \ \textcolor{keywordtype}{bool}\ getLoadFanout()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mLoadFanout;\ \}}
\DoxyCodeLine{00058\ \ \ \ \ \textcolor{keywordtype}{void}\ setLoadTracks(PyObject\ *);}
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{keywordtype}{bool}\ getLoadTracksForNet(\textcolor{keyword}{const}\ std::string\ \&name)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mLoadTracksAll\ ||\ mLoadTracksNets.contains(name);\ \}}
\DoxyCodeLine{00060\ \ \ \ \ \textcolor{keywordtype}{void}\ setRectifySegmentsDegrees(Real\ deg)\ \{\ mRectifySegmentsRadians\ =\ math::Radians(deg);\ \}}
\DoxyCodeLine{00061\ \ \ \ \ Real\ getRectifySegmentsRadians()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mRectifySegmentsRadians;\ \}}
\DoxyCodeLine{00062\ \ \ \ \ \textcolor{keywordtype}{void}\ setLoadPolygonsAsBoxes(\textcolor{keywordtype}{bool}\ b)\ \{\ mLoadPolygonsAsBoxes\ =\ b;\ \}}
\DoxyCodeLine{00063\ \ \ \ \ \textcolor{keywordtype}{bool}\ loadPolygonsAsBoxes()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mLoadPolygonsAsBoxes;\ \}}
\DoxyCodeLine{00064\ \ \ \ \ \textcolor{keywordtype}{void}\ setLayoutAreaMinMargin(\textcolor{keywordtype}{float}\ v)\ \{\ mLayoutAreaMinMargin\ =\ v;\ \}\ \textcolor{comment}{//\ relative\ if\ <\ 0,\ absolute\ if\ >=\ 0}}
\DoxyCodeLine{00065\ \ \ \ \ \textcolor{keywordtype}{void}\ setLayoutAreaMaxMargin(\textcolor{keywordtype}{float}\ v)\ \{\ mLayoutAreaMaxMargin\ =\ v;\ \}\ \textcolor{comment}{//\ relative\ if\ <\ 0,\ absolute\ if\ >=\ 0}}
\DoxyCodeLine{00066\ \ \ \ \ \textcolor{keywordtype}{float}\ getLayoutAreaMinMargin()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mLayoutAreaMinMargin;\ \}}
\DoxyCodeLine{00067\ \ \ \ \ \textcolor{keywordtype}{float}\ getLayoutAreaMaxMargin()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mLayoutAreaMaxMargin;\ \}}
\DoxyCodeLine{00068\ \ \ \ \ \textcolor{keywordtype}{void}\ setIgnoreLayoutBounds(\textcolor{keywordtype}{bool}\ b)\ \{\ mIgnoreLayoutBounds\ =\ b;\ \}}
\DoxyCodeLine{00069\ \ \ \ \ \textcolor{keywordtype}{bool}\ ignoreLayoutBounds()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mIgnoreLayoutBounds;\ \}}
\DoxyCodeLine{00070\ \ \ \ \ \textcolor{keywordtype}{bool}\ checkPinIntersections()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mCheckPinIntersections;\ \}}
\DoxyCodeLine{00071\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00072\ \ \ \ \ \textcolor{keywordtype}{void}\ loadOverrides();}
\DoxyCodeLine{00073\ \ \ \ \ \textcolor{keywordtype}{void}\ lockRoutedConnections(\mbox{\hyperlink{classPCBoard}{PCBoard}}\&);}
\DoxyCodeLine{00074\ \ \ \ \ Nanometers\ mUnitLength\_nm\{0.0\};}
\DoxyCodeLine{00075\ \ \ \ \ Real\ mRectifySegmentsRadians\{math::Radians(0.125)\};}
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{keywordtype}{bool}\ mForceDesignRes\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00077\ \ \ \ \ \textcolor{keywordtype}{bool}\ mFixedTrackParams\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{keywordtype}{bool}\ mLoadTracksAll\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00079\ \ \ \ \ \textcolor{keywordtype}{bool}\ mLoadFanout\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00080\ \ \ \ \ \textcolor{keywordtype}{bool}\ mLoadPolygonsAsBoxes\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00081\ \ \ \ \ \textcolor{keywordtype}{float}\ mLayoutAreaMinMargin\{0.0f\};}
\DoxyCodeLine{00082\ \ \ \ \ \textcolor{keywordtype}{float}\ mLayoutAreaMaxMargin\{std::numeric\_limits<float>::infinity()\};}
\DoxyCodeLine{00083\ \ \ \ \ \textcolor{keywordtype}{bool}\ mIgnoreLayoutBounds\{\textcolor{keyword}{true}\};}
\DoxyCodeLine{00084\ \ \ \ \ \textcolor{keywordtype}{bool}\ mCheckPinIntersections\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00085\ \ \ \ \ \textcolor{keywordtype}{bool}\ mAutocreateConnections\{\textcolor{keyword}{true}\};}
\DoxyCodeLine{00086\ \ \ \ \ \textcolor{keywordtype}{bool}\ mLockRoutedConnections\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00087\ \ \ \ \ \textcolor{keywordtype}{bool}\ loadFile(\textcolor{keyword}{const}\ std::string\ \&path);}
\DoxyCodeLine{00088\ \ \ \ \ std::string\ mData;}
\DoxyCodeLine{00089\ \ \ \ \ std::string\ mFormat\{\textcolor{stringliteral}{"{}dsn"{}}\};}
\DoxyCodeLine{00090\ \ \ \ \ std::set<std::string>\ mLoadTracksNets;}
\DoxyCodeLine{00091\ \ \ \ \ std::map<std::string,\ NetTopology>\ mTopologies;}
\DoxyCodeLine{00092\ \ \ \ \ \mbox{\hyperlink{classNetOverrides}{NetOverrides}}\ mNetOverrides;}
\DoxyCodeLine{00093\ \ \ \ \ \mbox{\hyperlink{classPCBoard}{PCBoard}}\ *create();}
\DoxyCodeLine{00094\ \ \ \ \ \mbox{\hyperlink{classPCBoard}{PCBoard}}\ *createDSN();}
\DoxyCodeLine{00095\ \};}
\DoxyCodeLine{00096\ \textcolor{keyword}{inline}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{structNetTopology}{NetTopology}}\ *PCBFactory::getTopology(\textcolor{keyword}{const}\ std::string\ \&net)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00097\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00098\ \ \ \ \ \textcolor{keyword}{auto}\ I\ =\ mTopologies.find(net);}
\DoxyCodeLine{00099\ \ \ \ \ \textcolor{keywordflow}{if}\ (I\ !=\ mTopologies.end())}
\DoxyCodeLine{00100\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \&I-\/>second;}
\DoxyCodeLine{00101\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{00102\ \}}
\DoxyCodeLine{00103\ }
\DoxyCodeLine{00104\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ GYM\_PCB\_LOADERS\_FACTORY\_H}}

\end{DoxyCode}
