The \mbox{\hyperlink{classKite_1_1SegmentFsm}{Segment\+Fsm}} class actually perform the placement of the \mbox{\hyperlink{classKite_1_1TrackElement}{Kite\+::\+Track\+Element}} of the \mbox{\hyperlink{classKite_1_1RoutingEvent}{Kite\+::\+Routing\+Event}}. It structured around three goals\+:
\item Implement the finite state machine for the \mbox{\hyperlink{classKite_1_1DataNegociate}{Kite\+::\+Data\+Negociate}} state.
\item Provide a kind of decoration on the Routing\+Event/\+Track\+Element (it do not abide by the definition from Design Patterns).
\item Cache a lot of on-\/the-\/fly computed datas needed during the \mbox{\hyperlink{classKite_1_1SegmentFsm}{Segment\+Fsm}} lifetime and the Manipulator(s) it may uses.
The constructor of \mbox{\hyperlink{classKite_1_1SegmentFsm}{Segment\+Fsm}} triggers the update of the \mbox{\hyperlink{classKite_1_1RoutingEvent}{Routing\+Event}} and through it \mbox{\hyperlink{classKite_1_1DataNegociate}{Data\+Negociate}}.\hypertarget{classKite_1_1SegmentFsm_secSlackening}{}\subsubsection{Slackening / F\+S\+M Transitions}\label{classKite_1_1SegmentFsm_secSlackening}
A transition occurs in the F\+SM whenener all the availables ripup methods for a segment have failed. Failure means that the topology of the net itself must be altered to allow a greater level of flexibility. Modifying the net topology means to give the current segment some more slack.
\item\mbox{\hyperlink{classKite_1_1DataNegociate_ab7ccb6fc1f298728995250a3bbcf18c7a19d8d157762b2b73c5274e4865523d29}{Data\+Negociate\+::\+Ripup\+Perpandiculars}} (\mbox{\hyperlink{classKite_1_1Manipulator}{Manipulator}}) place the segments before any of it\textquotesingle{}s perpandiculars are placed to allow a maximum track choice.
\item\mbox{\hyperlink{classKite_1_1DataNegociate_ab7ccb6fc1f298728995250a3bbcf18c7a548e204a4e2ffae50774910737f11380}{Data\+Negociate\+::\+Minimize}} (\mbox{\hyperlink{classKite_1_1Manipulator}{Manipulator}}) try to fit the segment in a hole in a track, perform a hole detection.
\item\mbox{\hyperlink{classKite_1_1DataNegociate_ab7ccb6fc1f298728995250a3bbcf18c7a361bca46d5e7bdf02f50f7ecaa6018a9}{Data\+Negociate\+::\+Dogleg}} (\mbox{\hyperlink{classKite_1_1Manipulator}{Manipulator}}) create a dogleg matching {\itshape the first track candidate} with a non-\/nul overlap.
\item\mbox{\hyperlink{classKite_1_1DataNegociate_ab7ccb6fc1f298728995250a3bbcf18c7a0d4bff02b3163821c0e5f7ad9dd55f36}{Data\+Negociate\+::\+Slacken}} (\mbox{\hyperlink{classKite_1_1Manipulator}{Manipulator}}) to be reviewed.
\item\mbox{\hyperlink{classKite_1_1DataNegociate_ab7ccb6fc1f298728995250a3bbcf18c7ae08187cba35efd6229ab8acfd003a600}{Data\+Negociate\+::\+Conflict\+Solve\+By\+History}} (\mbox{\hyperlink{classKite_1_1SegmentFsm}{Segment\+Fsm}}) try to find a break point on the segment, based on the ripup history.
\item\mbox{\hyperlink{classKite_1_1DataNegociate_ab7ccb6fc1f298728995250a3bbcf18c7afce071be0ba39626ed1c865789da598b}{Data\+Negociate\+::\+Conflict\+Solve\+By\+Placeds}} (\mbox{\hyperlink{classKite_1_1SegmentFsm}{Segment\+Fsm}}) try to find a break point on the segment, based on the current position of segments on the candidate tracks.
\item\mbox{\hyperlink{classKite_1_1DataNegociate_ab7ccb6fc1f298728995250a3bbcf18c7adfd76a7d65b56ed7ecc0eedf921d6f82}{Data\+Negociate\+::\+Move\+Up}} (\mbox{\hyperlink{classKite_1_1Manipulator}{Manipulator}}) try to move up the segment.
Simple slackening operations are defined in \mbox{\hyperlink{classKite_1_1Manipulator}{Manipulator}} and complex ones directly in \mbox{\hyperlink{classKite_1_1SegmentFsm}{Segment\+Fsm}}.\hypertarget{classKite_1_1SegmentFsm_secNonSlackening}{}\subsubsection{Non-\/\+Slackening Operations}\label{classKite_1_1SegmentFsm_secNonSlackening}
In addition, some operation that do not modifies the topology are availables\+:
\item\mbox{\hyperlink{classKite_1_1Manipulator_add26b688d75a99a1ae781787eead08d5}{Manipulator\+::force\+Over\+Locals()}} mostly for global segments to ripup a track from all it\textquotesingle{}s locals.
\item\mbox{\hyperlink{classKite_1_1SegmentFsm_a7140b507da2cab137d968a037bed19df}{Segment\+Fsm\+::insert\+In\+Track()}} automates the three subsequent ripup trials.
Indicates what the \mbox{\hyperlink{classKite_1_1SegmentFsm}{Segment\+Fsm}} has done the processed \mbox{\hyperlink{classKite_1_1TrackElement}{Track\+Element}}, possible values are\+:
\item\mbox{\hyperlink{classKite_1_1SegmentFsm_a5d74787dedbc4e11c1ab15bf487e61f8a79ae4f26b8ed9c55b81f981bb5076e1d}{Segment\+Fsm\+::\+Missing\+Data}}, this is an error condition, the \mbox{\hyperlink{classKite_1_1TrackElement}{Track\+Element}} do not have associated \mbox{\hyperlink{classKite_1_1DataNegociate}{Data\+Negociate}} structure. Nothing is done.
\item\mbox{\hyperlink{classKite_1_1SegmentFsm_a5d74787dedbc4e11c1ab15bf487e61f8a13ac7e0722ca806ff25d8fa9220e980b}{Segment\+Fsm\+::\+Empty\+Track\+List}}, no \mbox{\hyperlink{classKite_1_1Track}{Track}} is available for placement (free or used).
\item\mbox{\hyperlink{classKite_1_1SegmentFsm_a5d74787dedbc4e11c1ab15bf487e61f8a8c564779c81599aaadbe879fa2b08d92}{Segment\+Fsm\+::\+Self\+Inserted}}, the \mbox{\hyperlink{classKite_1_1TrackElement}{Track\+Element}} can be successfully inserted in a \mbox{\hyperlink{classKite_1_1Track}{Track}} (i.\+e. without overlap).
\item\mbox{\hyperlink{classKite_1_1SegmentFsm_a5d74787dedbc4e11c1ab15bf487e61f8a560766bb79539564fdeda432c8efae6d}{Segment\+Fsm\+::\+Self\+Maximum\+Slack}}, nothing can be done to further slacken the \mbox{\hyperlink{classKite_1_1TrackElement}{Track\+Element}}, it is at maximum ripup of the last possible state (no more topological modifications are possibles).
\item\mbox{\hyperlink{classKite_1_1SegmentFsm_a5d74787dedbc4e11c1ab15bf487e61f8a22374bab829fac7d12af4784d80eeb6e}{Segment\+Fsm\+::\+Other\+Ripup}}, the \mbox{\hyperlink{classKite_1_1TrackElement}{Track\+Element}} can be inserted but it needs the ripup of some others.
Inserted&{\bfseries\mbox{[}Flag\mbox{]}}, the \mbox{\hyperlink{classKite_1_1TrackElement}{Track\+Element}} can be inserted in a \mbox{\hyperlink{classKite_1_1Track}{Track}}. \\
Other&{\bfseries\mbox{[}Flag\mbox{]}}, the action is {\bfseries not} related to the processed \mbox{\hyperlink{classKite_1_1TrackSegment}{Track\+Segment}}, that is, others are being topologically modificated or riped up. \\
Maximum\+Slack&{\bfseries\mbox{[}Flag\mbox{]}}, the processed segment as reached it\textquotesingle{}s maximum ripup count on the last possible slackening state. \\
Construct a \mbox{\hyperlink{classKite_1_1SegmentFsm}{Segment\+Fsm}} from a \mbox{\hyperlink{classKite_1_1RoutingEvent}{Routing\+Event}}. The constructor is in charge of computing all the cached values.
{\bfseries Returns\+:}{\bfseries true} if there are Tracks avalaibles but the constraints are such that none is actually usable. \mbox{\Hypertarget{classKite_1_1SegmentFsm_a513f39c546ef4be0d13787cdace4eadf}\label{classKite_1_1SegmentFsm_a513f39c546ef4be0d13787cdace4eadf}}
{\footnotesize\ttfamily unsigned int get\+State (\begin{DoxyParamCaption}{}\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}
{\bfseries Returns\+:} The state (Segment\+Fsm\+::\+Segment\+Fsm\+Values) which the \mbox{\hyperlink{classKite_1_1SegmentFsm}{Segment\+Fsm}} has computed for the \mbox{\hyperlink{classKite_1_1RoutingEvent}{Routing\+Event}}. This is {\bfseries not} the state of the \mbox{\hyperlink{classKite_1_1DataNegociate}{Data\+Negociate}}\mbox{\Hypertarget{classKite_1_1SegmentFsm_ad272e2f3fbbddcd6c8dc2f0187f08c4e}\label{classKite_1_1SegmentFsm_ad272e2f3fbbddcd6c8dc2f0187f08c4e}}
{\bfseries Returns\+:} The \mbox{\hyperlink{classKite_1_1DataNegociate}{Data\+Negociate}} of the \mbox{\hyperlink{classKite_1_1TrackElement}{Track\+Element}} ({\itshape cached}). \mbox{\Hypertarget{classKite_1_1SegmentFsm_abf6603c742bee65a4effa24135f2d955}\label{classKite_1_1SegmentFsm_abf6603c742bee65a4effa24135f2d955}}
{\bfseries Returns\+:} The interval into which the segment axis can be set (computed from the topological constraints and the placement constraints on the already placed perpandiculars). \mbox{\Hypertarget{classKite_1_1SegmentFsm_a9d1a7f4108b49d3096d8c733fabe60f3}\label{classKite_1_1SegmentFsm_a9d1a7f4108b49d3096d8c733fabe60f3}}
{\bfseries Returns\+:} The interval for an optimal placement of the segment axis. \mbox{\Hypertarget{classKite_1_1SegmentFsm_ab7144079976c8808e69f9aac68dda06d}\label{classKite_1_1SegmentFsm_ab7144079976c8808e69f9aac68dda06d}}
{\bfseries Returns\+:} The cost at index {\ttfamily i} in the table.
Referenced by Segment\+Fsm\+::desaturate(), Manipulator\+::force\+Over\+Locals(), Manipulator\+::force\+To\+Track(), Manipulator\+::insert\+In\+Track(), Manipulator\+::minimize(), and Segment\+Fsm\+::solve\+Full\+Blockages().
{\bfseries Returns\+:} The \mbox{\hyperlink{classKite_1_1Track}{Track}} for cost at index {\ttfamily i} in the table.
Referenced by Segment\+Fsm\+::desaturate(), Manipulator\+::force\+Over\+Locals(), Manipulator\+::force\+To\+Track(), Manipulator\+::insert\+In\+Track(), Manipulator\+::make\+Dogleg(), Manipulator\+::minimize(), and Manipulator\+::shrink\+To\+Track().
{\bfseries Returns\+:} The overlapping {\itshape begin} index in \mbox{\hyperlink{classKite_1_1Track}{Track}} for cost at index {\ttfamily i} in the table.
Referenced by Segment\+Fsm\+::desaturate(), Manipulator\+::force\+Over\+Locals(), Manipulator\+::force\+To\+Track(), Manipulator\+::insert\+In\+Track(), Manipulator\+::make\+Dogleg(), Manipulator\+::minimize(), and Manipulator\+::shrink\+To\+Track().
{\bfseries Returns\+:} The overlapping {\itshape end} index in \mbox{\hyperlink{classKite_1_1Track}{Track}} for cost at index {\ttfamily i} in the table.
Referenced by Segment\+Fsm\+::desaturate(), Manipulator\+::force\+Over\+Locals(), Manipulator\+::force\+To\+Track(), Manipulator\+::insert\+In\+Track(), Manipulator\+::make\+Dogleg(), Manipulator\+::minimize(), and Manipulator\+::shrink\+To\+Track().
{\bfseries Returns\+:} The table of \mbox{\hyperlink{classKite_1_1SegmentAction}{Segment\+Action}}, that is the delayed requests for \mbox{\hyperlink{classKite_1_1RoutingEvent}{Routing\+Event}} creation.
{\footnotesize\ttfamily unsigned int set\+State (\begin{DoxyParamCaption}\item[{unsigned int}]{state }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}
{\bfseries Returns\+:} Sets the state of the state...
Referenced by Segment\+Fsm\+::desaturate(), Manipulator\+::force\+Over\+Locals(), Manipulator\+::force\+To\+Track(), Manipulator\+::insert\+In\+Track(), and Manipulator\+::shrink\+To\+Track().
Request the creation of a new delayed \mbox{\hyperlink{classKite_1_1RoutingEvent}{Routing\+Event}}, for the meaning of the parameters, see \mbox{\hyperlink{classKite_1_1SegmentAction_acbeca58f8327b69a540628f299d5bd35}{Segment\+Action\+::\+Segment\+Action}}.
Referenced by Segment\+Fsm\+::desaturate(), Manipulator\+::force\+Over\+Locals(), Manipulator\+::force\+To\+Track(), Manipulator\+::insert\+In\+Track(), Manipulator\+::minimize(), Manipulator\+::relax(), Manipulator\+::repack\+Perpandiculars(), Manipulator\+::ripple(), Manipulator\+::ripup(), Manipulator\+::ripup\+Perpandiculars(), Manipulator\+::shrink\+To\+Track(), and Segment\+Fsm\+::slacken\+Topology().
Actually generate Routing\+Event(s) from the Segment\+Action(s). \mbox{\Hypertarget{classKite_1_1SegmentFsm_a4cf911f1f4e5ac588d502c9d069a1bde}\label{classKite_1_1SegmentFsm_a4cf911f1f4e5ac588d502c9d069a1bde}}
Try to insert the \mbox{\hyperlink{classKite_1_1TrackElement}{Track\+Element}} in the \mbox{\hyperlink{classKite_1_1Track}{Track}} at index {\ttfamily i} (in the cost table). Return {\bfseries true} if the insertion is possible.
\item\mbox{\hyperlink{classKite_1_1Manipulator_a7140b507da2cab137d968a037bed19df}{Manipulator\+::insert\+In\+Track()}}, try to push asides the neighbors.
\item\mbox{\hyperlink{classKite_1_1Manipulator_aba69c61ccb330e26aaa8211f0454795f}{Manipulator\+::shrink\+To\+Track()}}, try squeeze the segment in an existing free space.
\item\mbox{\hyperlink{classKite_1_1Manipulator_a76d3956660cfa624696e2a5f2916cd22}{Manipulator\+::force\+To\+Track()}}, perform a complete ripup of all the neighbors and their perpandiculars.
The event keeps track of the insertion attempt step (see \mbox{\hyperlink{classKite_1_1RoutingEvent_a00f02910915e7deb857f023e5d584c08}{Routing\+Event\+::get\+Insert\+State()}}). \mbox{\Hypertarget{classKite_1_1SegmentFsm_a0d9a9926ae67cc7998799347f135e28a}\label{classKite_1_1SegmentFsm_a0d9a9926ae67cc7998799347f135e28a}}
{\bfseries Returns\+:}{\bfseries true} if a suitable dogleg has been created in the segment.
Initially, global segments may be very long, and a placement solution in which each one is placed on a track of it\textquotesingle{}s own may not be realisable. In that case, at least one of the global segment must be broken. The figure below illustrate the case\+: {\bfseries (a)}, {\bfseries (b)}, {\bfseries (c)} form a first cluster and {\bfseries (d)}, {\bfseries (e)}, {\bfseries (f)} form a second one. Due to the constraints of the segments the remaining free track cannot be the same in both clusters. The only solution to place {\bfseries (g)} is to break it into two sub-\/globals. The whole point of the conflict solve is to correctly detect the cluster and choose the breaking point.
For the time beeing we limit the search to the last three dislodgers, to not waste too much time looking back the event history. We merge overlapping intervals into one (see the undocumented class {\ttfamily Union\+Intervals} and {\ttfamily Ripup\+History} in {\ttfamily Segment\+Fsm.\+cpp}).
For the time beeing we only look on the track into which the to be inserted segment wants to be placed.
Then we try to break the to be placed segment, first under the lower bound (source) of the conflicting interval then, in case of failure under the upper bound (target).
This methods achieve the same goal as \mbox{\hyperlink{classKite_1_1SegmentFsm_a0d9a9926ae67cc7998799347f135e28a}{Segment\+Fsm\+::conflict\+Solve\+By\+History()}} but uses a different strategy.
Instead of looking through the history to find dislodgers it analyses the placed segments in all the candidates tracks for the to be placed segment. Unlike it\textquotesingle{}s sibling method, which creates only one dogleg, as it uses the \mbox{\hyperlink{classKite_1_1Manipulator_a8b5b69fd5762d5a0cbc4ceea4d1b68c1}{Manipulator\+::relax()}} method, it may creates up to two doglegs.
\item For each track in the sorted list, look for a dislodger under the middle of the to be placed segment. If no dislodger is present at this place go to the next track. Otherwise\+:
Only global conflicting segments are took into account. Local segments may be took into account if they overlap global ones (all part of the same net). All overlapping segments are merged into one big conflict interval. The whole length of a conflict interval is took into account event if it\textquotesingle{}s overlap with the to be placed segment is only partial.
Interval accounting and \mbox{\hyperlink{classKite_1_1Track}{Track}} ordering is managed through the undocumented {\ttfamily Cs1\+Candidate} class implemented in {\ttfamily Segment\+Fsm.\+cpp}.
Try to create a suitable empty space in a cost \mbox{\hyperlink{classKite_1_1Track}{Track}} by moving up \mbox{\hyperlink{classKite_1_1TrackElement}{Track\+Element}} in conflict. \mbox{\Hypertarget{classKite_1_1SegmentFsm_a623d68f599c0de60cdd36af3f183e6f1}\label{classKite_1_1SegmentFsm_a623d68f599c0de60cdd36af3f183e6f1}}
Modificate the topology of the \mbox{\hyperlink{classKite_1_1TrackElement}{Track\+Element}} to slacken it. It is the implementation of the slakening finite state machine. \mbox{\Hypertarget{classKite_1_1SegmentFsm_ab8ae818baad1d0a274a7e8c308ca3f92}\label{classKite_1_1SegmentFsm_ab8ae818baad1d0a274a7e8c308ca3f92}}