Porytiles
Loading...
Searching...
No Matches
porytiles::TilesetArtifactKeyProvider Class Referenceabstract

Abstract interface for generating keys and discovering tileset artifacts in a backing store. More...

#include <tileset_artifact_key_provider.hpp>

Inheritance diagram for porytiles::TilesetArtifactKeyProvider:
[legend]

Public Member Functions

virtual ~TilesetArtifactKeyProvider ()=default
 
virtual ChainableResult< ArtifactKeykey_for_metatiles_bin (const std::string &tileset_name) const =0
 
virtual ChainableResult< ArtifactKeykey_for_metatile_attributes_bin (const std::string &tileset_name) const =0
 
virtual ChainableResult< ArtifactKeykey_for_tiles_png (const std::string &tileset_name) const =0
 
virtual ChainableResult< ArtifactKeykey_for_porymap_pal_n (const std::string &tileset_name, std::size_t index) const =0
 
virtual ChainableResult< ArtifactKeykey_for_porymap_anim_frame (const std::string &tileset_name, const std::string &anim_name, const std::string &frame_name) const =0
 
virtual ChainableResult< ArtifactKeykey_for_porymap_anim_params (const std::string &tileset_name) const =0
 
virtual ChainableResult< ArtifactKeykey_for_bottom_png (const std::string &tileset_name) const =0
 
virtual ChainableResult< ArtifactKeykey_for_middle_png (const std::string &tileset_name) const =0
 
virtual ChainableResult< ArtifactKeykey_for_top_png (const std::string &tileset_name) const =0
 
virtual ChainableResult< ArtifactKeykey_for_attributes_csv (const std::string &tileset_name) const =0
 
virtual ChainableResult< ArtifactKeykey_for_porytiles_pal_n (const std::string &tileset_name, std::size_t index) const =0
 
virtual ChainableResult< ArtifactKeykey_for_porytiles_anim_frame (const std::string &tileset_name, const std::string &anim_name, const std::string &frame_name) const =0
 
virtual ChainableResult< ArtifactKeykey_for_porytiles_anim_params (const std::string &tileset_name) const =0
 Returns the key for Porytiles animation parameters.
 
virtual bool artifact_exists (const ArtifactKey &key) const =0
 Checks whether an artifact exists in the backing store for the given key.
 
virtual ChainableResult< std::set< std::string > > discover_porymap_anims (const std::string &tileset_name) const =0
 Discovers the names of all Porymap animations available for a tileset.
 
virtual ChainableResult< std::set< std::string > > discover_porymap_anim_frames (const std::string &tileset_name, const std::string &anim_name) const =0
 Discovers the frame indices for a specific Porymap animation.
 
virtual ChainableResult< std::set< std::string > > discover_porytiles_anims (const std::string &tileset_name) const =0
 Discovers the names of all Porytiles animations available for a tileset.
 
virtual ChainableResult< std::set< std::string > > discover_porytiles_anim_frames (const std::string &tileset_name, const std::string &anim_name) const =0
 Discovers the frame indices for a specific Porytiles animation.
 
virtual ChainableResult< std::vector< ArtifactKey > > get_porymap_artifact_keys (const std::string &tileset_name) const
 Gets the keys for all Porymap artifacts present in the given Tileset.
 
virtual ChainableResult< std::vector< ArtifactKey > > get_porytiles_artifact_keys (const std::string &tileset_name) const
 Gets the keys for all Porytiles artifacts present in the given Tileset.
 
virtual ChainableResult< std::vector< ArtifactKey > > get_all_artifact_keys (const std::string &tileset_name) const
 Gets the keys for all tileset artifacts (both Porytiles and Porymap) present in the given Tileset.
 

Detailed Description

Abstract interface for generating keys and discovering tileset artifacts in a backing store.

This interface provides the key generation and discovery functionality needed by the tileset repository system. Implementations handle the specifics of how to organize and access artifacts in different backing stores (filesystem, database, etc.).

The interface separates key generation (which should be fast and stateless) from discovery operations (which may involve I/O to search the backing store). Implementations may choose to cache expensive lookups during construction to optimize performance.

From the interface's perspective, tileset artifact keys are simple strings wrapped by the ArtifactKey class. If a particular implementation requires a complex key type, the implementation must take care to ensure that this key type is string-constructable. Luckily, rich string-based formats like JSON should be able to support almost any imaginable key schema.

Definition at line 30 of file tileset_artifact_key_provider.hpp.

Constructor & Destructor Documentation

◆ ~TilesetArtifactKeyProvider()

virtual porytiles::TilesetArtifactKeyProvider::~TilesetArtifactKeyProvider ( )
virtualdefault

Member Function Documentation

◆ artifact_exists()

virtual bool porytiles::TilesetArtifactKeyProvider::artifact_exists ( const ArtifactKey key) const
pure virtual

Checks whether an artifact exists in the backing store for the given key.

This method should perform the actual existence check against the backing store using the provided key. This may involve filesystem operations, database queries, or other I/O depending on the implementation.

Parameters
keyThe key identifying the artifact to check (generated by key_for)
Returns
True if the artifact exists in the backing store, false otherwise

Implemented in porytiles::ProjectTilesetArtifactKeyProvider.

◆ discover_porymap_anim_frames()

virtual ChainableResult< std::set< std::string > > porytiles::TilesetArtifactKeyProvider::discover_porymap_anim_frames ( const std::string &  tileset_name,
const std::string &  anim_name 
) const
pure virtual

Discovers the frame indices for a specific Porymap animation.

Searches the backing store to find all animation frame files (excluding the key frame and 00.png) for a specific Porymap animation. The returned indices should be consecutive starting from 1. Since frame 0 is required, callers don't need to discover it.

Parameters
tileset_nameThe name of the tileset containing the animation
anim_nameThe name of the animation to search for frames
Returns
Set of frames found in the backing store

Implemented in porytiles::ProjectTilesetArtifactKeyProvider.

◆ discover_porymap_anims()

virtual ChainableResult< std::set< std::string > > porytiles::TilesetArtifactKeyProvider::discover_porymap_anims ( const std::string &  tileset_name) const
pure virtual

Discovers the names of all Porymap animations available for a tileset.

Searches the backing store to find all Porymap animation assets for the specified tileset. Porymap animations do not require key frames, only sequential frame files.

Parameters
tileset_nameThe name of the tileset to search for animations
Returns
Set of animation names found in the backing store

Implemented in porytiles::ProjectTilesetArtifactKeyProvider.

◆ discover_porytiles_anim_frames()

virtual ChainableResult< std::set< std::string > > porytiles::TilesetArtifactKeyProvider::discover_porytiles_anim_frames ( const std::string &  tileset_name,
const std::string &  anim_name 
) const
pure virtual

Discovers the frame indices for a specific Porytiles animation.

Searches the backing store to find all animation frame files (excluding the key frame and 00.png) for a specific Porytiles animation. The returned indices should be consecutive starting from 1. Since frame 0 is required, callers don't need to discover it.

Parameters
tileset_nameThe name of the tileset containing the animation
anim_nameThe name of the animation to search for frames
Returns
Set of frames found in the backing store (typically starting from 1)

Implemented in porytiles::ProjectTilesetArtifactKeyProvider.

◆ discover_porytiles_anims()

virtual ChainableResult< std::set< std::string > > porytiles::TilesetArtifactKeyProvider::discover_porytiles_anims ( const std::string &  tileset_name) const
pure virtual

Discovers the names of all Porytiles animations available for a tileset.

Searches the backing store to find all Porytiles animation directories or assets for the specified tileset. Porytiles animations require both a key frame and at least one animation frame (00.png).

Parameters
tileset_nameThe name of the tileset to search for animations
Returns
Set of animation names found in the backing store

Implemented in porytiles::ProjectTilesetArtifactKeyProvider.

◆ get_all_artifact_keys()

virtual ChainableResult< std::vector< ArtifactKey > > porytiles::TilesetArtifactKeyProvider::get_all_artifact_keys ( const std::string &  tileset_name) const
inlinevirtual

Gets the keys for all tileset artifacts (both Porytiles and Porymap) present in the given Tileset.

This method combines the results from both get_porytiles_artifact_keys() and get_porymap_artifact_keys() to provide a comprehensive list of all artifact keys associated with the tileset. This method will only return keys that actually exist in the backing store.

Parameters
tileset_nameThe name of the Tileset for which to get all artifact keys
Returns
A vector containing all Porytiles and Porymap artifact keys for the given Tileset

Definition at line 359 of file tileset_artifact_key_provider.hpp.

◆ get_porymap_artifact_keys()

virtual ChainableResult< std::vector< ArtifactKey > > porytiles::TilesetArtifactKeyProvider::get_porymap_artifact_keys ( const std::string &  tileset_name) const
inlinevirtual

Gets the keys for all Porymap artifacts present in the given Tileset.

Each Porymap artifact has a unique key by which the ArtifactChecksumProvider and the TilesetRepo can identify it. The format of these keys and the method for producing them are implementation-defined. This method will only return keys that actually exist in the backing store.

Returns
A vector of Porymap artifact keys for the given Tileset

Definition at line 167 of file tileset_artifact_key_provider.hpp.

◆ get_porytiles_artifact_keys()

virtual ChainableResult< std::vector< ArtifactKey > > porytiles::TilesetArtifactKeyProvider::get_porytiles_artifact_keys ( const std::string &  tileset_name) const
inlinevirtual

Gets the keys for all Porytiles artifacts present in the given Tileset.

Each Porytiles artifact has a unique key by which the ArtifactChecksumProvider and the TilesetRepo can identify it. The format of these keys and the method for producing them are implementation-defined. This method will only return keys that actually exist in the backing store.

Returns
A vector of Porytiles artifact keys for the given Tileset

Definition at line 255 of file tileset_artifact_key_provider.hpp.

◆ key_for_attributes_csv()

virtual ChainableResult< ArtifactKey > porytiles::TilesetArtifactKeyProvider::key_for_attributes_csv ( const std::string &  tileset_name) const
pure virtual

◆ key_for_bottom_png()

virtual ChainableResult< ArtifactKey > porytiles::TilesetArtifactKeyProvider::key_for_bottom_png ( const std::string &  tileset_name) const
pure virtual

◆ key_for_metatile_attributes_bin()

virtual ChainableResult< ArtifactKey > porytiles::TilesetArtifactKeyProvider::key_for_metatile_attributes_bin ( const std::string &  tileset_name) const
pure virtual

◆ key_for_metatiles_bin()

virtual ChainableResult< ArtifactKey > porytiles::TilesetArtifactKeyProvider::key_for_metatiles_bin ( const std::string &  tileset_name) const
pure virtual

◆ key_for_middle_png()

virtual ChainableResult< ArtifactKey > porytiles::TilesetArtifactKeyProvider::key_for_middle_png ( const std::string &  tileset_name) const
pure virtual

◆ key_for_porymap_anim_frame()

virtual ChainableResult< ArtifactKey > porytiles::TilesetArtifactKeyProvider::key_for_porymap_anim_frame ( const std::string &  tileset_name,
const std::string &  anim_name,
const std::string &  frame_name 
) const
pure virtual

◆ key_for_porymap_anim_params()

virtual ChainableResult< ArtifactKey > porytiles::TilesetArtifactKeyProvider::key_for_porymap_anim_params ( const std::string &  tileset_name) const
pure virtual

◆ key_for_porymap_pal_n()

virtual ChainableResult< ArtifactKey > porytiles::TilesetArtifactKeyProvider::key_for_porymap_pal_n ( const std::string &  tileset_name,
std::size_t  index 
) const
pure virtual

◆ key_for_porytiles_anim_frame()

virtual ChainableResult< ArtifactKey > porytiles::TilesetArtifactKeyProvider::key_for_porytiles_anim_frame ( const std::string &  tileset_name,
const std::string &  anim_name,
const std::string &  frame_name 
) const
pure virtual

◆ key_for_porytiles_anim_params()

virtual ChainableResult< ArtifactKey > porytiles::TilesetArtifactKeyProvider::key_for_porytiles_anim_params ( const std::string &  tileset_name) const
pure virtual

Returns the key for Porytiles animation parameters.

For Porytiles animations, the anim parameters store is the source of truth for animation names, frame sequences, timing, and other parameters.

Parameters
tileset_nameThe name of the tileset
Returns
Key for the animation parameters store

Implemented in porytiles::ProjectTilesetArtifactKeyProvider.

◆ key_for_porytiles_pal_n()

virtual ChainableResult< ArtifactKey > porytiles::TilesetArtifactKeyProvider::key_for_porytiles_pal_n ( const std::string &  tileset_name,
std::size_t  index 
) const
pure virtual

◆ key_for_tiles_png()

virtual ChainableResult< ArtifactKey > porytiles::TilesetArtifactKeyProvider::key_for_tiles_png ( const std::string &  tileset_name) const
pure virtual

◆ key_for_top_png()

virtual ChainableResult< ArtifactKey > porytiles::TilesetArtifactKeyProvider::key_for_top_png ( const std::string &  tileset_name) const
pure virtual

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