Provides read/write access to Data-derived classes. The BaseAccess class allows for derived classes to access the internal data fields of the main data classes that make up a game and board: Game, PlayerGame, and TileObject. By using a common base class that abstracts the access, it is possible to totally encapsulate the data from the View, so that the View has not even the slightest possibility of write-access to the main game data. Only classes derived from BaseAccess (such as Rule, AIRule, Logic, and AILogic) are able to alter the game data.
BaseAccess.h
Provides read/write access to Data-derived classes. | |
The BaseAccess destructor. | |
Returns the number of players in the Game. | |
Returns the number of tiles on the board in the Game. | |
Returns the index in the Game’s array of PlayerGames of the current player. | |
Returns the PlayerGame data of the player at the given player index. | |
Returns the std::vector of PlayerGames data of all players in the game. | |
Returns the data field at the given key within the Data of the PlayerGame for the given player index. | |
Returns the data field for the given key within the Data of the TileObject at the given tile index. | |
Returns the TileObject at the given index. | |
Erases the given key from the Game data. | |
Returns the current Game object the BaseAccess is using. |
The BaseAccess destructor. | |
Returns the number of players in the Game. | |
Returns the number of tiles on the board in the Game. | |
Returns the index in the Game’s array of PlayerGames of the current player. | |
Returns the PlayerGame data of the player at the given player index. | |
Returns the std::vector of PlayerGames data of all players in the game. | |
Returns the data field at the given key within the Data of the PlayerGame for the given player index. | |
Returns the data field for the given key within the Data of the TileObject at the given tile index. | |
Returns the TileObject at the given index. | |
Erases the given key from the Game data. | |
Returns the current Game object the BaseAccess is using. |
| wxInt32 current() const |
Returns the index in the Game’s array of PlayerGames of the current player.
The index of the current player.
|
Returns the PlayerGame data of the player at the given player index. If the index is -1, the data for the current player is returned.
| player | The index of the player to retrieve. If -1, the current player index is used. |
A reference to the PlayerGame data for the player at that index.
| Game::PlayerGameArray &playerGames() |
Returns the std::vector of PlayerGames data of all players in the game.
A reference to the std::vector of PlayerGame data stored in the Game.
|
Returns the data field at the given key within the Data of the Game. Because it is returned as a reference, the data can be read from or written to.
NOTE: The function calls the data<> member function of the Data class with no safety, meaning that if the given key does not exist, it will be created by this call to it.
| key | The hash key of the field in the Data class. |
A reference to the data itself. It may be read to or written from.
|
Returns the data field at the given key within the Data of the PlayerGame for the given player index. If the index is -1, the data for the current player is used. Because it is returned as a reference, the data can be read from or written to. The player function is a shortcut for direct access to a player’s data within the Game.
NOTE: The function calls the data<> member function of the Data class with no safety, meaning that if the given key does not exist, it will be created by this call to it.
| key | The hash key of the field in the Data class. |
| player | The index of the player to retrieve. If -1, the current player index is used. |
A reference to the data itself. It may be read to or written from.
|
Returns the data field for the given key within the Data of the TileObject at the given tile index. Because it is returned as a reference, the data can be read from or written to. The tile function is a shortcut for direct access to a TileObject’s data within the Game.
| key | The hash key of the field in the Data class. |
| tile | The index of the tile to retrieve. |
A reference to the data itself. It may be read to or written from.
|
Returns the TileObject at the given index.
| tile | The index of the tile to retrieve. |
A reference to the TileObject.
|
Erases the given key from the Game data.
| key | The key to erase. |
| virtual GamePtr &GetGame() const=0 |
Returns the current Game object the BaseAccess is using.
| virtual ~BaseAccess()=0 |
| wxInt32 numPlayers() const |
| wxInt32 numTiles() const |
| wxInt32 current() const |
|
| Game::PlayerGameArray &playerGames() |
|
|
|
|
| virtual GamePtr &GetGame() const=0 |