![]() |
Cavoke
1.1.0
A Platform for creating and hosting multiplayer turn-based board games
|
Public Member Functions | |
SessionsStorage (std::shared_ptr< GameLogicManager > mGameLogicManager, std::shared_ptr< GamesStorage > mGamesStorage, std::shared_ptr< GameStateStorage > mGameStateStorage) | |
GameSessionAccessObject::GameSessionInfo | create_session (const GameConfig &game_config, const std::string &host_user_id, const std::string &room_id="") |
Creates session for given user with given game_config. | |
void | start_session (const std::string &session_id, std::optional< json > game_settings) |
Starts session with given settings. | |
GameSessionAccessObject::GameSessionInfo | join_session (const std::string &invite_code, const std::string &user_id, std::optional< int > player_id={}) |
Tries to connect given user into a session. | |
cavoke::ValidationResult | validate_session (const std::string &session_id, std::optional< json > game_settings) |
Validates the settings for given session. | |
GameSessionAccessObject | get_sessionAO (const std::string &session_id, drogon::orm::DbClientPtr dbClient=drogon::app().getDbClient()) |
Gets an access object for given session. | |
Friends | |
class | GameSessionAccessObject |
Definition at line 11 of file sessions_storage.h.
cavoke::server::model::SessionsStorage::SessionsStorage | ( | std::shared_ptr< GameLogicManager > | mGameLogicManager, |
std::shared_ptr< GamesStorage > | mGamesStorage, | ||
std::shared_ptr< GameStateStorage > | mGameStateStorage | ||
) |
Definition at line 138 of file sessions_storage.cpp.
GameSessionAccessObject::GameSessionInfo cavoke::server::model::SessionsStorage::create_session | ( | const GameConfig & | game_config, |
const std::string & | host_user_id, | ||
const std::string & | room_id = "" |
||
) |
Creates session for given user with given game_config.
Creates a session with given game config.
Throws game_session_error
if errors arise
Definition at line 21 of file sessions_storage.cpp.
GameSessionAccessObject cavoke::server::model::SessionsStorage::get_sessionAO | ( | const std::string & | session_id, |
drogon::orm::DbClientPtr | dbClient = drogon::app().getDbClient() |
||
) |
Gets an access object for given session.
Gets a session for given session id
Throws game_session_error
if no such session
Definition at line 169 of file sessions_storage.cpp.
GameSessionAccessObject::GameSessionInfo cavoke::server::model::SessionsStorage::join_session | ( | const std::string & | session_id, |
const std::string & | user_id, | ||
std::optional< int > | player_id = {} |
||
) |
Tries to connect given user into a session.
Joins a session by id
Throws game_session_error
if errors arise
Definition at line 127 of file sessions_storage.cpp.
void cavoke::server::model::SessionsStorage::start_session | ( | const std::string & | session_id, |
std::optional< json > | game_settings | ||
) |
Starts session with given settings.
Definition at line 95 of file sessions_storage.cpp.
cavoke::ValidationResult cavoke::server::model::SessionsStorage::validate_session | ( | const std::string & | session_id, |
std::optional< json > | game_settings | ||
) |
Validates the settings for given session.
Definition at line 146 of file sessions_storage.cpp.
|
friend |
Definition at line 47 of file sessions_storage.h.