Horizon
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
horizon::Pool Class Reference

Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool. More...

#include <pool.hpp>

Inheritance diagram for horizon::Pool:
horizon::IPool horizon::PoolCached

Public Member Functions

 Pool (const std::string &base_path, bool read_only=true)
 Constructs a Pool. More...
 
const class Unitget_unit (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Entityget_entity (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Symbolget_symbol (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Padstackget_padstack (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Padstackget_well_known_padstack (const std::string &name, UUID *pool_uuid_out=nullptr) override
 
const class Packageget_package (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Partget_part (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Frameget_frame (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Decalget_decal (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
std::set< UUIDget_alternate_packages (const UUID &uu) override
 
std::string get_model_filename (const UUID &pkg_uuid, const UUID &model_uuid) override
 
virtual std::string get_filename (ObjectType type, const UUID &uu, UUID *pool_uuid_out=nullptr)
 
const std::string & get_base_path () const override
 
bool check_filename (ObjectType type, const std::string &filename, std::string *error_msg=nullptr) const
 
SQLite::Databaseget_db () override
 
void clear () override
 Clears all lazy-loaded objects. More...
 
std::string get_tmp_filename (ObjectType type, const UUID &uu) const
 
 Pool (const std::string &base_path, bool read_only=true)
 Constructs a Pool. More...
 
const class Unitget_unit (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Entityget_entity (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Symbolget_symbol (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Padstackget_padstack (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Padstackget_well_known_padstack (const std::string &name, UUID *pool_uuid_out=nullptr) override
 
const class Packageget_package (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Partget_part (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Frameget_frame (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
const class Decalget_decal (const UUID &uu, UUID *pool_uuid_out=nullptr) override
 
std::set< UUIDget_alternate_packages (const UUID &uu) override
 
std::string get_model_filename (const UUID &pkg_uuid, const UUID &model_uuid) override
 
virtual std::string get_filename (ObjectType type, const UUID &uu, UUID *pool_uuid_out=nullptr)
 
const std::string & get_base_path () const override
 
bool check_filename (ObjectType type, const std::string &filename, std::string *error_msg=nullptr) const
 
SQLite::Databaseget_db () override
 
void clear () override
 Clears all lazy-loaded objects. More...
 
std::string get_tmp_filename (ObjectType type, const UUID &uu) const
 

Static Public Member Functions

static int get_required_schema_version ()
 
static int get_required_schema_version ()
 

Public Attributes

SQLite::Database db
 The database connection. More...
 

Static Public Attributes

static const UUID tmp_pool_uuid = "5e8d1bb6-7e61-4c59-9f01-1e1307069df0"
 

Protected Member Functions

std::string get_flat_filename (ObjectType type, const UUID &uu) const
 
void get_pool_uuid (ObjectType type, const UUID &uu, UUID *pool_uuid_out)
 
std::string get_flat_filename (ObjectType type, const UUID &uu) const
 
void get_pool_uuid (ObjectType type, const UUID &uu, UUID *pool_uuid_out)
 

Protected Attributes

std::string base_path
 
std::map< UUID, Unitunits
 
std::map< UUID, Entityentities
 
std::map< UUID, Symbolsymbols
 
std::map< UUID, Padstackpadstacks
 
std::map< UUID, Packagepackages
 
std::map< UUID, Partparts
 
std::map< UUID, Frameframes
 
std::map< UUID, Decaldecals
 
std::map< std::pair< ObjectType, UUID >, UUIDpool_uuid_cache
 

Detailed Description

Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.

Objects are lazy-loaded when they're accessed for the first time.

Constructor & Destructor Documentation

◆ Pool() [1/2]

horizon::Pool::Pool ( const std::string &  base_path,
bool  read_only = true 
)

Constructs a Pool.

Parameters
base_pathPath to the pool containing the pool.db

◆ Pool() [2/2]

horizon::Pool::Pool ( const std::string &  base_path,
bool  read_only = true 
)

Constructs a Pool.

Parameters
base_pathPath to the pool containing the pool.db

Member Function Documentation

◆ clear() [1/2]

void horizon::Pool::clear ( )
overridevirtual

Clears all lazy-loaded objects.

Doing so will invalidate all references pointers by get_entity and friends.

Implements horizon::IPool.

◆ clear() [2/2]

void horizon::Pool::clear ( )
overridevirtual

Clears all lazy-loaded objects.

Doing so will invalidate all references pointers by get_entity and friends.

Implements horizon::IPool.

Member Data Documentation

◆ db

SQLite::Database horizon::Pool::db

The database connection.

You may use it to perform more advanced queries on the pool.


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