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

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#ifndef\ GYM\_PCB\_LAYER\_H}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#define\ GYM\_PCB\_LAYER\_H}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ "{}Defs.hpp"{}}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ "{}Py.hpp"{}}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ "{}Enums.hpp"{}}}
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classLayer}{Layer}}}
\DoxyCodeLine{00010\ \{}
\DoxyCodeLine{00011\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00012\ \ \ \ \ \textcolor{keywordtype}{void}\ setNumber(uint\ N)\ \{\ mNumber\ =\ N;\ \}}
\DoxyCodeLine{00013\ \ \ \ \ \textcolor{keywordtype}{void}\ setType(SignalType\ t)\ \{\ mType\ =\ t;\ \}}
\DoxyCodeLine{00014\ \ \ \ \ uint\ getNumber()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mNumber;\ \}}
\DoxyCodeLine{00015\ \ \ \ \ SignalType\ getType()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mType;\ \}}
\DoxyCodeLine{00016\ \ \ \ \ \textcolor{keywordtype}{bool}\ hasType(SignalType\ t)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ (mType\ \&\ t);\ \}}
\DoxyCodeLine{00017\ \ \ \ \ \textcolor{keywordtype}{bool}\ isSignal()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ !!(mType\ \&\ SignalType::SIGNAL);\ \}}
\DoxyCodeLine{00018\ \ \ \ \ \textcolor{keywordtype}{bool}\ isPower()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ !!(mType\ \&\ SignalType::POWER);\ \}}
\DoxyCodeLine{00019\ \ \ \ \ \textcolor{keywordtype}{bool}\ isGround()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ !!(mType\ \&\ SignalType::GROUND);\ \}}
\DoxyCodeLine{00020\ \ \ \ \ std::string\ str()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00021\ \ \ \ \ PyObject\ *getPy()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00022\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00023\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keywordtype}{bool}\ rangesOverlap(uint\ z0,\ uint\ z1,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00024\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00025\ \ \ \ \ uint\ mNumber;}
\DoxyCodeLine{00026\ \ \ \ \ SignalType\ mType\{SignalType::ANY\};}
\DoxyCodeLine{00027\ \};}
\DoxyCodeLine{00028\ }
\DoxyCodeLine{00029\ \textcolor{keyword}{inline}\ uint\ cutLayersFromRange(uint\ \&zmin,\ uint\ \&zmax,\ uint\ C0,\ uint\ C1)}
\DoxyCodeLine{00030\ \{}
\DoxyCodeLine{00031\ \ \ \ \ assert(zmin\ <=\ zmax\ \&\&\ C0\ <=\ C1);}
\DoxyCodeLine{00032\ \ \ \ \ \textcolor{keywordflow}{if}\ (zmax\ <\ C0)}
\DoxyCodeLine{00033\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ (zmax\ -\/\ zmin)\ +\ 1;}
\DoxyCodeLine{00034\ \ \ \ \ \textcolor{keywordflow}{if}\ (C0\ <=\ zmin\ \&\&\ zmax\ <=\ C1)}
\DoxyCodeLine{00035\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{00036\ \ \ \ \ \textcolor{keyword}{const}\ uint\ dn\ =\ (C1\ -\/\ C0)\ +\ 1;}
\DoxyCodeLine{00037\ \ \ \ \ \textcolor{keywordflow}{if}\ (zmin\ >=\ C0)\ \textcolor{comment}{//\ zmin\ is\ above\ the\ cut\ range\ (then\ it\ drops\ by\ dn)\ or\ inside\ (then\ its\ new\ number\ is\ C0\ as\ the\ first\ non-\/cut\ layer)}}
\DoxyCodeLine{00038\ \ \ \ \ \ \ \ \ zmin\ =\ (zmin\ >\ C1)\ ?\ (zmin\ -\/\ dn)\ :\ C0;}
\DoxyCodeLine{00039\ \ \ \ \ zmax\ =\ (zmax\ >\ C1)\ ?\ (zmax\ -\/\ dn)\ :\ (C0\ -\/\ 1);\ \textcolor{comment}{//\ if\ zmax\ is\ above\ the\ cut\ range\ it\ drops\ by\ dn,\ if\ it\ is\ inside\ it\ becomes\ the\ layer\ below\ the\ first\ cut\ one}}
\DoxyCodeLine{00040\ \ \ \ \ assert(zmin\ <=\ zmax);}
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keywordflow}{return}\ (zmax\ -\/\ zmin)\ +\ 1;}
\DoxyCodeLine{00042\ \}}
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00044\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{bool}\ adjustIndexForCutLayers(uint\ \&z,\ uint\ C0,\ uint\ C1)}
\DoxyCodeLine{00045\ \{}
\DoxyCodeLine{00046\ \ \ \ \ \textcolor{keywordflow}{if}\ (C0\ <=\ z\ \&\&\ z\ <=\ C1)}
\DoxyCodeLine{00047\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00048\ \ \ \ \ \textcolor{keywordflow}{if}\ (z\ >\ C1)}
\DoxyCodeLine{00049\ \ \ \ \ \ \ \ \ z\ -\/=\ (C1\ -\/\ C0)\ +\ 1;}
\DoxyCodeLine{00050\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00051\ \}}
\DoxyCodeLine{00052\ }
\DoxyCodeLine{00053\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{bool}\ Layer::rangesOverlap(uint\ z0,\ uint\ z1,\ uint\ Z0,\ uint\ Z1)}
\DoxyCodeLine{00054\ \{}
\DoxyCodeLine{00055\ \ \ \ \ \textcolor{keywordflow}{return}\ (z1\ >=\ Z0)\ \&\&\ (z0\ <=\ Z1);}
\DoxyCodeLine{00056\ \}}
\DoxyCodeLine{00057\ }
\DoxyCodeLine{00058\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ GYM\_PCB\_LAYER\_H}}

\end{DoxyCode}
