<HTML><HEAD><TITLE>TokenHandler.htm</TITLE><style type="text/css"><!--.Default {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 12pt}.OBOS-Function-Def {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 16pt}.OBOS-Title {background-color: rgb(255,255,255); color: rgb(0,128,0); font-family: 'Dutch801 Rm BT'; font-size: 24pt}.Text-Background {background-color: rgb(255,255,255)}.GR-Default {}.Body {margin: 0px}.Footer {margin: 0px}.Header {margin: 0px}.WP-Default {text-align: left; text-indent: 0px; margin-left: 0px; margin-right: 0px}--></style></HEAD><BODY BGCOLOR="#ffffff"><DIV class="sheet" id="Sheet 1"><P class="Body" style="margin: 0px"><span class="OBOS-Title">TokenHandler class</span><span style="color: rgb(0,0,0); font-size: 24pt"></span></P><P class="Body" style="margin: 0px"><BR>This is a simple way to provide tokens for various reasons. </P><P class="Body" style="margin: 0px"><BR><HR></P><P class="Body" style="margin: 0px"><BR>Member Functions</P><P class="Body" style="margin: 0px"><BR></P><TABLE WIDTH=617 HEIGHT=113 BORDER=1 CELLPADDING=1 CELLSPACING=2><TR><TD WIDTH=203 HEIGHT=17><P class="Body" style="margin: 0px">TokenHandler(void)</P></TD><TD WIDTH=260 HEIGHT=17><P class="Body" style="margin: 0px">~TokenHandler(void)</P></TD></TR><TR><TD WIDTH=203 HEIGHT=17><P class="Body" style="margin: 0px">int32 GetToken(void)</P></TD><TD WIDTH=260 HEIGHT=17><P class="Body" style="margin: 0px">void Reset(void)</P></TD></TR><TR><TD WIDTH=203 HEIGHT=17><P class="Body" style="margin: 0px">void ExcludeValue(int32 value)</P></TD><TD WIDTH=260 HEIGHT=17><P class="Body" style="margin: 0px">void ResetExcludes(void)</P></TD></TR><TR><TD WIDTH=203 HEIGHT=17><P class="Body" style="margin: 0px">bool IsExclude(int32 value)</P></TD><TD WIDTH=260 HEIGHT=17> </TD></TR><TR><TD WIDTH=203 HEIGHT=17> </TD><TD WIDTH=260 HEIGHT=17> </TD></TR></TABLE><P class="Body" style="margin: 0px"><BR><BR><HR></P><P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">TokenHandler(void)</span></P><P class="Body" style="margin: 0px"><BR>1) Initialize the index to -1</P><P class="Body" style="margin: 0px">2) create the access semaphore</P><P class="Body" style="margin: 0px">3) create the exclude list with no items</P><P class="Body" style="margin: 0px"><BR><BR><span class="OBOS-Function-Def">~TokenHandler(void)</span></P><P class="Body" style="margin: 0px"><BR>1) delete the access lock</P><P class="Body" style="margin: 0px">2) call ResetExcludes and delete the exclude list</P><P class="Body" style="margin: 0px"><BR><BR><span class="OBOS-Function-Def">int32 GetToken(void)</span></P><P class="Body" style="margin: 0px"><BR>Returns a unique token which is not equal to any excluded values</P><P class="Body" style="margin: 0px"><BR>1) create a local variable to return the new token</P><P class="Body" style="margin: 0px">2) acquire the access semaphore</P><P class="Body" style="margin: 0px">3) Increment the internal index</P><P class="Body" style="margin: 0px">4) while IsExclude(index) is true, increment the index</P><P class="Body" style="margin: 0px">5) assign it to the local variable</P><P class="Body" style="margin: 0px">6) release the access semaphore</P><P class="Body" style="margin: 0px">7) return the local variable</P><P class="Body" style="margin: 0px"><BR><BR><span class="OBOS-Function-Def">void Reset(void)</span></P><P class="Body" style="margin: 0px"><BR>1) acquire the access semaphore</P><P class="Body" style="margin: 0px">2) set the internal index to -1</P><P class="Body" style="margin: 0px">3) release the access semaphore</P><P class="Body" style="margin: 0px"><BR><BR><span class="OBOS-Function-Def">void ExcludeValue(int32 value)</span></P><P class="Body" style="margin: 0px"><BR>1) acquire the access semaphore</P><P class="Body" style="margin: 0px">2) if IsExclude(value) is false, add it to the exclude list</P><P class="Body" style="margin: 0px">3) release the access semaphore</P><P class="Body" style="margin: 0px"><BR><BR><span class="OBOS-Function-Def">void ResetExcludes(void)</span></P><P class="Body" style="margin: 0px"><BR>1) acquire the access semaphore</P><P class="Body" style="margin: 0px">2) Iterate through the exclude list, removing and deleting each item</P><P class="Body" style="margin: 0px">3) release the access semaphore</P><P class="Body" style="margin: 0px"><BR><BR><span class="OBOS-Function-Def">bool IsExclude(int32 value)</span></P><P class="Body" style="margin: 0px"><BR>1) create a boolean match flag and set it to false</P><P class="Body" style="margin: 0px">2) acquire the access semaphore</P><P class="Body" style="margin: 0px">3) iterate through the exclude list and see if the value matches any in the list</P><P class="Body" style="margin: 0px">4) If there is a match, set the match flag to true and exit the loop</P><P class="Body" style="margin: 0px">5) release the access semaphore</P><P class="Body" style="margin: 0px">6) return the match flag</P><DIV class="layer" id="Layer 1"></DIV></DIV></BODY></HTML>