Nebula
Loading...
Searching...
No Matches
Db::DbServer Class Reference

#include <dbserver.h>

Detailed Description

Provides highlevel access to the world database.

Inherits Core::RefCounted.

Public Member Functions

 DbServer ()
 constructor
virtual ~DbServer ()
 destructor
bool OpenStaticDatabase (const Util::String &dbUri)
 open the static world database directly
bool OpenGameDatabase (const Util::String &dbUri)
 open the dynamic game database directly
bool OpenNewGame (const Util::String &profileURI, const Util::String &dbURI)
 open the db subsystem in NewGame mode
bool OpenContinueGame (const Util::String &profileURI)
 open the db subsysten in ContinueGame mode
bool OpenLoadGame (const Util::String &profileURI, const Util::String &dbURI, const Util::String &saveGameURI)
 open the db subsystem in LoadGame mode
void DeleteCurrentGame (const Util::String &profileURI)
 delete current game database file
void CloseStaticDatabase ()
 close the static database
void CloseGameDatabase ()
 close the dynamic database
void Close ()
 general close method
bool IsStaticDatabaseOpen () const
 return true if static database is open
bool IsGameDatabaseOpen () const
 return true if game database is open
bool CreateSaveGame (const Util::String &profileURI, const Util::String &dbURI, const Util::String &saveGameURI)
 create a save game
const Ptr< Database > & GetGameDatabase () const
 get the world database (for dynamic gameplay data)
const Ptr< Database > & GetStaticDatabase () const
 get static database (for constant read-only data)
bool CurrentGameExists (const Util::String &profileURI) const
 return true if a current world database exists
void SetWorkingDbInMemory (bool b)
 set flag to load database as working db into memory
Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Private Member Functions

 __DeclareClass (DbServer)
 __DeclareSingleton (DbServer)

Private Attributes

bool workDbInMemory
Ptr< Db::Sqlite3FactorydbFactory
Ptr< DatabasestaticDatabase
Ptr< DatabasegameDatabase

Additional Inherited Members

Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)
Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)

Constructor & Destructor Documentation

◆ DbServer()

Db::DbServer::DbServer ( )

constructor

◆ ~DbServer()

Db::DbServer::~DbServer ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

Db::DbServer::__DeclareClass ( DbServer )
private

◆ __DeclareSingleton()

Db::DbServer::__DeclareSingleton ( DbServer )
private

◆ Close()

void Db::DbServer::Close ( )

general close method

◆ CloseGameDatabase()

void Db::DbServer::CloseGameDatabase ( )

close the dynamic database

Close the game database.

◆ CloseStaticDatabase()

void Db::DbServer::CloseStaticDatabase ( )

close the static database

Close the static database.

◆ CreateSaveGame()

bool Db::DbServer::CreateSaveGame ( const Util::String & profileURI,
const Util::String & dbURI,
const Util::String & saveGameURI )

create a save game

This creates a new save game by making a copy of the current world database into the savegame directory.

If a savegame of that exists, it will be overwritten.

◆ CurrentGameExists()

bool Db::DbServer::CurrentGameExists ( const Util::String & profileURI) const

return true if a current world database exists

Return true if a current game database exists.

◆ DeleteCurrentGame()

void Db::DbServer::DeleteCurrentGame ( const Util::String & profileURI)

delete current game database file

This deletes the current game state database.

◆ GetGameDatabase()

const Ptr< Database > & Db::DbServer::GetGameDatabase ( ) const
inline

get the world database (for dynamic gameplay data)

◆ GetStaticDatabase()

const Ptr< Database > & Db::DbServer::GetStaticDatabase ( ) const
inline

get static database (for constant read-only data)

◆ IsGameDatabaseOpen()

bool Db::DbServer::IsGameDatabaseOpen ( ) const
inline

return true if game database is open

◆ IsStaticDatabaseOpen()

bool Db::DbServer::IsStaticDatabaseOpen ( ) const
inline

return true if static database is open

◆ OpenContinueGame()

bool Db::DbServer::OpenContinueGame ( const Util::String & profileURI)

open the db subsysten in ContinueGame mode

This opens the database in Continue Game mode: the current game database in the user profile directory will simply be opened.

◆ OpenGameDatabase()

bool Db::DbServer::OpenGameDatabase ( const Util::String & dbUri)

open the dynamic game database directly

Directly open the game database, which contains dynamic game data.

◆ OpenLoadGame()

bool Db::DbServer::OpenLoadGame ( const Util::String & profileURI,
const Util::String & dbURI,
const Util::String & saveGameURI )

open the db subsystem in LoadGame mode

This opens the database in Load Game mode.

This will overwrite the current game database with a save game database and open this as usual.

◆ OpenNewGame()

bool Db::DbServer::OpenNewGame ( const Util::String & profileURI,
const Util::String & dbURI )

open the db subsystem in NewGame mode

This opens the database in New Game mode: an original database will be copied into the user's profile directory into a Current Game State database and opened.

◆ OpenStaticDatabase()

bool Db::DbServer::OpenStaticDatabase ( const Util::String & dbUri)

open the static world database directly

Directly open the static database.

The static database contains immutable read-only data.

◆ SetWorkingDbInMemory()

void Db::DbServer::SetWorkingDbInMemory ( bool b)
inline

set flag to load database as working db into memory

Member Data Documentation

◆ dbFactory

Ptr<Db::Sqlite3Factory> Db::DbServer::dbFactory
private

◆ gameDatabase

Ptr<Database> Db::DbServer::gameDatabase
private

◆ staticDatabase

Ptr<Database> Db::DbServer::staticDatabase
private

◆ workDbInMemory

bool Db::DbServer::workDbInMemory
private

The documentation for this class was generated from the following files: