The license plate game server will be defined using two OMG IDL
interfaces that should appear in the Game module. These
two interfaces should be defined as follows:
LP_Game -- This interface defines the following
operations that implement a particular instance of the license
plate game:
void initialize (in string filename) raises
(Invalid_File, Already_Initialized) -- Allow a player to designate a dictionary
of valid words for use with a particular session.
void configure (in string letter_set) raises
(Invalid_Letter_Set, Not_Initialized, Already_Configured) -- Set the current letter set for a
session to the desired three letter string of letters from a
license plate.
boolean query (in string word) raises (Not_Configured) -- Allow a player in
a particular session to query whether the designated word contains
the current letter set in order in the word
and also exists in the dictionary. Whenever a query "matches" a
word in the dictionary, the player receives 1 point - if the query
doesn't match a point is subtracted.
Word_List list () raises (Not_Configured) -- List all the words in the
session's dictionary that match the current letter set. The list
should be returned as an unbounded sequence of strings (i.e.,
typedef sequence<string> Word_List, one for
each matching word.
Player_Results results () raises (Not_Configured) -- Return the current
results for all players in a particular game, where
Player_Results is defined as a sequence of
Player_Result structs containing information on each
player.
oneway void quit () -- A oneway call that informs
the server that the client is done playing the game. Only when
all players in a game have called quit() should the
resources for that game be reclaimed. It's possible that this method
will need to shutdown the ORB if
LP_Game_Factory::shutdown() had been called and this
is the last player to quit the last game on the server.
initialize() and configure() methods can
only be called once for a particular game. Subsequent calls on this
game will raise the Already_Initialized or
Already_Configured exception, respectively. The
query(), list(), results(), and
quit() commands can be invoked multiple times by players
of the same game, but can only run when no other commands are
executing concurrently on a game.
LP_Game_Factory -- This interface defines the
following factory and management operations:
LP_Game join (in string game_name, in string player_id)
raises (Duplicate_ID, Game_Shutdown)
-- Allows a player to join an instance of the LP_Game
interface (or create and join the game if it doesn't already exist).
This operation is passed a game_name, which is a
string that identifies the game. If the game hasn't already
been created, then allocate and activate a new
LP_Game object containing the resources (e.g.,
dictionary, score table, etc.) associated with this particular
instance of the game. Each player is identified by their unique
player_id (the Duplicate_ID exception
is raised if the player_id is not unique).
This command returns an object reference to an
LP_Game, which allows the client to uniquely identify the game.
oneway void shutdown () -- A oneway call that shut downs the
server process, ultimately leading to exiting the process. Only
when all players and games have quit, however, should the
server process actually exit. After shutdown() has been
called, however, no further calls to join() should be
allowed, i.e., it should raise the Game_Shutdown
exception.
-GI flag supported by TAO's IDL compiler.
LP_Game_Factory object and write its object reference
to a file. If you are a graduate student, please replace the use of
the file to exchange object references with the CORBA Naming Service,
which is implemented in TAO.
quit() and shutdown() commands.
LP_Game_Factory
from a file and narrow it properly. If you are a graduate
student, please replace the use of the file to exchange object
references with the CORBA Naming Service, which is implemented in
TAO.
LP_Game_Factory and LP_Game objects,
wait for the reply, and display it to the standard output of the
client.
quit() so the server has a chance to
reclaim the game resources.
If you're a graduate student, you should ensure that your server works with either the thread-per-connection or thread pool concurrency models supported by TAO. If you are an undergrad you simply need to make sure things work with the reactive model, which is the default in TAO. Please look here for more details on these concurrency models.
Please see the online help for information on how to setup your development environment on Vanderbilt University's Linux computing system.
Last modified 12:52:03 CDT 23 October 2007