CursorManager class###################The CursorManager class handles token creation, calling thecursor-related graphics driver functions, and freeing heap memory forall ServerCursor instances.Enumerated Types================cursor_which------------- CURSOR_DEFAULT- CURSOR_TEXT- CURSOR_MOVE- CURSOR_DRAG- CURSOR_RESIZE- CURSOR_RESIZE_NW- CURSOR_RESIZE_SE- CURSOR_RESIZE_NS- CURSOR_RESIZE_EW- CURSOR_OTHERMember Functions================CursorManager(void)-------------------1. Create the cursor list empty2. Set the token index to 03. Allocate the default system cursor and pass it to AddCursor4. Initialize the member pointer for the graphics driver5. Create the cursorlock semaphore6. Call SetDefaultCursor~CursorManager(void)--------------------1. Empty and delete the cursor list2. Delete the cursorlock semaphoreint32 AddCursor(ServerCursor \*sc)----------------------------------AddCursor() is used to register the cursor in question with themanager, allowing for the user application to have the identifyingtoken, if necessary. The cursor becomes the property of the manager.If a user application deletes a BCursor, its ServerApp will callDeleteCursor().1. Acquire cursor lock2. Add \*sc to the cursor list3. Set sc->token to the current token index value4. Increment the token index5. Assign sc->token to temporary variable6. Release cursor lock7. Return the saved token valuevoid DeleteCursor(int32 ctoken)-------------------------------1. Acquire cursor lock2. Iterate through the cursor list, looking for ctoken3. If any ServerCursor->token equals ctoken, remove and delete it4. Release cursor lockvoid RemoveAppCursors(ServerApp \*app)--------------------------------------1. Acquire cursor lock2. Iterate through the cursor list, checking each cursor's ServerApppointer3. If any have a ServerApp pointer which matches the passed pointer,remove and delete them4. Release cursor lockvoid ShowCursor(void), void HideCursor(void), void ObscureCursor(void)----------------------------------------------------------------------Simple pass-through functions which call the graphics driver'sfunctions. Note that acquiring the cursor lock will be necessary forall three calls.void SetCursor(int32 token), void SetCursor(cursor_which cursor)----------------------------------------------------------------These set the current cursor for the graphics driver to the passedcursor, either one previously added via AddCursor or a system cursor.1. Acquire cursor lockToken version:2. Find the cursor in the cursor list and call the graphics driver ifnon-NULL3. Iterate through list of system cursor tokens and see if there's amatch. If so, set the internal cursor_which to the match.cursor_which version:2. determine which cursor to use via a switch statement and call thegraphics driver with the internal pointer for the appropriate cursor3. set the internal cursor_which to the one passed to the function..4. Release cursor lockServerCursor \*GetCursor(cursor_which which)--------------------------------------------GetCursor is intended for use in figuring out what cursor is in usefor a particular system cursor.1. Acquire cursor lock2. use a switch statement to figure which cursor to return and assign atemporary pointer its value3. Release cursor lock4. Return the temporary pointervoid ChangeCursor(cursor_which which, int32 token)--------------------------------------------------Calling ChangeCursor will allow a user to change a system cursor'sappearance. Note that in calling this, the cursor changes ownershipand belongs to the system. Thus, the BCursor destructor will notultimately cause the cursor to be deleted.1. Acquire cursor lock2. Call FindCursor and, if NULL, release the cursor lock and return3. Look up the pointer for the system cursor in question and check tosee if it is active. If active, then set the local active flag to true.Set the system cursor pointer to the one looked up.4. If active flag is true, call SetCursor()5. Release cursor lockcursor_which GetCursorWhich(void)---------------------------------Returns the current cursor_which attribute which describes thecurrently active cursor. If the active cursor is not a system cursor,it will return CURSOR_OTHER.1. Acquire cursor lock2. Create a local cursor_which and assign it the value of theCursorManager's cursor_which3. Release cursor lock4. Return the local copy