Description
The GoData class implements a simple database.
It holds all the data, both about the
players and about the games. An arbitrary number of clients
(i.e. Objects derived from GoClient) may connect to a
GoData object.
You may add players of games to the database with the help of the
go_data_add_player() and go_data_add_game() functions. To query or
modify the contents of the database use client objects (i.e. objects
of a subclass of GoClient).
Details
go_cb ()
void (*go_cb) (GtkObject *obj,
void *client_data); |
struct GoData
The GoData structure has no public fields.
go_data_new ()
GtkObject* go_data_new (void); |
Allocate a new, empty GoData object.
go_data_load ()
gboolean go_data_load (GoData *self,
const gchar *filename); |
Loads the golist XML file denoted by filename into the
GoData object self.
go_data_save ()
gboolean go_data_save (GoData *self,
const gchar *filename); |
Dumps the GoData object self into the golist XML file
filename.
go_data_clear ()
void go_data_clear (GoData *self); |
Remove all entries from the database.
The corresponding GoGame and GoPlayer objects are destroyed.
go_data_notify_games_changed ()
void go_data_notify_games_changed (GoData *self); |
This must be called in order to propagate changes to the
game list. It updates all clients and emits the "changed" signal.
go_data_notify_players_changed ()
void go_data_notify_players_changed (GoData *self); |
This must be called in order to propagate changes to the
player list. It updates all clients and emits the "changed" signal.
go_data_add_client ()
Register a new client of this GoData.
go_data_remove_client ()
Disconnect the client from the GoData object.
go_data_add_player ()
Register a new player of this GoData and update all clients.
go_data_remove_player ()
Disconnect the player from the GoData object and update all clients.
go_data_player_lock ()
This function must be called before p is modified. After you are
done with p you must call player_unlock() to propagate the changes.
go_data_player_unlock ()
Undo the effects of player_lock() and update the clients.
go_data_player_count ()
int go_data_player_count (GoData *self); |
Determine the number of players in the database.
go_data_player_tokens ()
GList* go_data_player_tokens (GoData *self); |
Return the list of all player tokens.
The returned list must not be freed of modified.
It becomes invalid if the player list of self is modified.
go_data_find_token ()
Get the player denoted by token.
go_data_player_game_count ()
Get the number of games recorded for player.
go_data_player_win_count ()
Get the number of won games recorded for player.
go_data_player_game_index ()
Return the number of games in the data base self,
which involve player and are played before game.
So, if the function returns n this indicates that
game is the n-th game recorded for player.
go_data_player_component ()
Calculate the index for the connected component of player within
the game graph. The value 0 indicates the component of
players of defined rank.
go_data_add_game ()
Register a new game for this GoData object and update all clients.
go_data_remove_game ()
Disconnect the game from the GoData object and update all clients.
go_data_game_lock ()
This function must be called before g is modified. After you are
done with g you must call game_unlock() to propagate the changes.
go_data_game_unlock ()
Undo the effects of game_lock() and update the clients.
go_data_game_count ()
int go_data_game_count (GoData *self); |
Determine the number of games in the database.